Free chapter (and equally free critic) of the book “PHP in Action” – Design Patterns
http://devzone.zend.com/node/view/id/1684
http://devzone.zend.com/node/view/id/1734
http://devzone.zend.com/node/view/id/1755
Or the link to the pdfs:
http://devzone.zend.com/content/pdfs/PHPinAction_part1of3.pdf
http://devzone.zend.com/content/pdfs/PHPinAction_part2of3.pdf
http://devzone.zend.com/content/pdfs/PHPinAction_part3of3.pdf
But you always have to be careful to get a second opinion (and a third and fourth). I consider that there are some conceptual errors or that some of the explanations left incomplete.
For example, about the Strategy pattern, saying that the purpose is to create reusable components or plugins is an incomplete concept and even incorrect. Usually design patterns have the purpose of enhancing code reusability, conforming a common base of design strategies. Plugins creation is but one of the posibilities where the Strategy pattern can be used, however the purpose of Strategy is to decouple an algorithm from its host, for example, an object may have sorting capabilities, but we know there are many sorting algorithms, or, in other words, different sorting strategies. The object receives sorting strategy object which decides how to sort without knowing how it’s actually done, on the other hand the sorting strategy object does the sorting without knowing anything about the object where the sorting is actually done (this way the Strategy objects can be reused out the original context, and changed without refactoring the original object).
The Strategy pattern can be confused with the Bridge pattern, as their UML graphic is almost the same. The Bridge pattern has as purpose decoupling an abstract data type from its implementation, for example a “Colection” object can be is implemented using arrays, linked lists, trees, etc. Using Strategy and Bridge together is usually known as policy-based design.
I don’t recommend using the Null pattern, specially when the existence of null is recognized by the language, and specially if it’s used to overlook a null result on a function as suggested on the book. If a function has the option of returnin null is for a reason, and checkin the output is not only necessary but adequate. In the example given by the book is coherent that a search may give a null result, indicating that the object being searched doesn’t exist, you should be the one checking the nullity of the result and act accordingly. On the other hand, it’s not coherent that the function returns an object when ther is not one, even if the object represents the inexestence of an object (there is a null language construct for that purpose).
About the explanation of the Iterator pattern, it fails to fully explain the reason of this pattern, specially because it tries to compare iterators with arrays. The purpose of iterators is simply to keep a common interfase for going through item list one item at a time, without knowing what’s the actual implementation. An array is an implementation, it doesn’t make any sense to compare it with iterators.
Finally, the Composite pattern is confused with the Tree abstract data type. The use of Composite implies tree structures but is mora than just that, conceptually speaking. A composite is an object that allows to perform actions over more than one object as if it were only one, for example, a drawing is a composite of strokes, figures, colours and even other drawings.
The holy grail of videogames
Profiting from the fact that I was bedridden today, thanks to one of those virus that comes when seasons change, I red some of the many articles I left to be red later. Among those there was one I though it’ll be a profitable reading, as it was a thesis on storytelling in singleplayer action games, that promises to unveils some of the misteries around getting a game to work better with a story. The abstract and complete text of the thesis are here:
http://www.gamecareerguide.com/features/320/masters_thesis_storytelling_in_.php
In the beginning I was thrilled about it, because action games are a very interesting area of videogames, specially filled with controversies about stories inside games. But I had to leave its reading for later.
Now that I had the chance to read it fully (although I didn’t actually red every word, I skipped some parts), I notices first something that made most of my thrill go away: the list of analized games. The list is as follows: Just Cause, Gun, GTA: San Andres, Fable. The first three are so similar that it seems ridiculous not having taken only one as sample of the others. Fable I haven’t played it (yet), but from what the critics say, it seems to be a good choice (anyway, evidence in the writing suggest that it was added later on the thesis and on suggestion from someone else).
¿Can we really obtain substantial conclusions about the effects of storytelling in a videogame from these 3 titles (leaving Fable besides)? My opinion is simply NO. The only one worthy of analysis is GTA:SA, but not because of the game itself but because of the evolution of the whole series, from the first GTA to what it has become nowadays. The GTA series is a very good example of storytelling and gameplay evolving together to become a product that has broken many barriers, and even become succesfull in the most difficult market for foreigners game developers, Japan.
There are many titles to analyze on this topic, but there is one that can’t be left outside in an investigation of this kind, as it set a before and an after y the relationship between action games and storytelling: Half-Life. To understand why I say this, a good starting point is this article, which recounts the events of the key moments of the creation of this game:
http://www.gamespot.com/features/halflife_final/index.html
About the thesis, it turned out to be another critic voice in the debate narratology vs ludology, and as expected of such, it denies being part of the debate. You can see hard evidence of this right at the beginning, as the thesis starts with a direct critic to another writing from another voice of this debate: “Games telling stories?” form Jesper Juul, which can be found here:
http://www.gamestudies.org/0101/juul-gts/
Although I don’t deny that most of the criticism made to that article are right, it’s not a very good starting point for the objectives of the thesis, and shows that the author is biased, and the bias keeps showing up in the rest of the writing, making me doubt the objectivity of the thesis.
I leave my opinion of the narratology vs ludology bout for some other time.