News for hackers. Stuff that matters.
Re:JavaScript Patterns Collection by camus on Monday March 18, 2013 @06:22AM (#5393341)
I clicked on the Builder Pattern , it linked to a file but it would be more interesting to have a bit of an explanation. That why UML diagrams are usefull. right now https://github.com/shichuan/javascript-patterns/blob/master/... is hard to understand. I would propose a simple exemple for the builder pattern .

let's say we have an array of datas : [0,10,200,50] and we want a representation of the data.

So the director would use different builders to represent these datas ( a bar chart , a line chart , etc ...).

What i find important with design patterns and often lacking in books is real use cases.You often get strange exemples that , may be interesting but you actually can use them in a real application. Usually the builder ,the fly-weight and the chain of reponsability are often explained badly or with horrible exemples.

I dream of a book that does 2 things :

- explain each pattern with real exemples and propose a list of real uses cases where the pattern would be usefull

- has an extended tutorial at the end of the book the makes the user actually build a full application with all the patterns studied. For instance , a drawing application with different shapes, pens , filters , commands , menus , undo , redo , data serialization , that would use all the main design patterns and make them work together.

If such a book exists ( in java , as3 , C# , javascript ,... (just not in C++ or smalltalk ;) ) ) , i would be interested to know about it.

Now javascript has some patterns of its own ( module pattern , etc ... ) that's interesting to know them too.

There are no comments on this comment yet.