Design Patterns Illustrated
by Herman Peeren on Jun 03, 2010
- 9,167 views
Illustrations to show the essence of the 23 "classical" Gang Of Four design patterns. Plus some general info about object oriented progr
Illustrations to show the essence of the 23 "classical" Gang Of Four design patterns. Plus some general info about object oriented progr
Accessibility
Categories
Tags
More...Upload Details
Uploaded via SlideShare as Adobe PDF
Usage Rights
© All Rights Reserved
Statistics
- Favorites
- 38
- Downloads
- 664
- Comments
- 6
- Embed Views
- Views on SlideShare
- 8,682
- Total Views
- 9,167
Unfortunately the video doesn't show the slides. You should see both at the same time.
Before the talk I showed a picture of Saint Isidoro di Sevilla: http://sjsm.files.wordpress.com/2009/04/san-isidoro2-jpegggg.jpg . That is what I talk about in the beginning. 1 year ago Reply
- If you mix in a method in a base class, you can later choose to override that method in an extended class. This give you the ability to re-use the mixin functionality and specialize it by extending the class.
- If you mix in a method and you want to override that method you could also do so by mixing in a new mixin that specifies the same method. The mixins are mixed using a LIFO array.
In both scenarios you are not coupling, but de-coupling.
As a bonus, the mixin implementation in Nooku Framework is even more powerful then the one in Rails. We have added the concept of dynamic and selective mixing.
- Dynamic mixing allows you to instantiate a mixin and mix it with multiple objects as in a one to many relationship. This offers a number of benefits and some interesting flexibility.
- Selective mixing allows the mixin to make available a number of it’s public methods to the mixer based on a set of conditions, or it can choose to not make available any methods at all.
Both the dynamic mixing and selective mixing bring Nooku Framework very close to the basic concepts of AOP (Aspect Oriented Programming).
Hope this helps to further clarify. 1 year ago Reply
That is a comment on my remark 'beware of tight coupling'. I made that remark mainly because IMHO there could be a problem if mixing in a method with a name that allready exists in the 'native' or mixed methods of that KObject. You have to know those names in order to prevent conflicts. So that is tight coupling.
A mixin is a very powerful and handy way to put the same functionality in several parts in the code. Nothing wrong with it. I think it is very useful if the number of mixins is limited and their methods are treated as 'reserved words'. 1 year ago Reply
The commands in a KCommandChain in Nooku are command-objects (see: Command-pattern). They are KCommandHandlers, that implement the KCommandInterface. So: they are objects that execute their task upon calling their execute()-method.
When running the command-chain you run a task and look in the chain which command-object will handdle it. Just like here:
https://www.ibm.com/developerworks/library/os-php-designptrns/#N101DE
(the IComand in that code has the same purpose as the KCommandInterface in Nooku).
The NFW chain of command == chain of responsibility + command pattern.
Thank you, Johan, for showing this to me.
So: I was wrong thinking the KCommandChain was just a kind of macro, meant for running a series of commands. The confusion is that the commandhandlers are called 'commands'. The commandhandlers are command-objects and they handle the request (the parameters of run()). 1 year ago Reply
http://www.blaisepascal.eu/index.php?actie=./peeren/page1
(from an article for a Delphi magazine). Some small examples are from Delphi, but the principles remain the same. 1 year ago Reply