Monday, June 25, 2007

do not forget the simplest AOP: the command pattern

Just to balance out my recent framework craziness: do not forget the simplest AOP: the command pattern. Windows workflow foundation shows it every well. CSLA is the framework represents that.

Also, MVC encourages “actions” from controllers. So, it is really very nice fit.

Further, in .Net, you can put more classes in one file, which is nice for those command classes.

Command pattern will always be the elegant architecture, it does not require any framework – sorry, CSLA, because of command pattern is in the low end, I will always use CSLA, but will always only its pieces.

I will use it when do maintenance development and I cannot introduce springframework or castle – or any situations that I cannot use springframework or castle.

You may ask, why choose springframework over the command pattern? The core reason is that command pattern is only for very-light weight thing. A result of that is that all good framework must use façade, command is not right (again, sorry, CSLA). A command pattern based “framework” can only be very light weight, and only “educational”. As a result, either you choose no framework, or, you got to choose a façade based framework.

You may ask why façade is a better fit for “framework”, because façade is more intuitive, easier to use. That is it, simple. Another deeper reason is that command pattern has no future or depth in AOP: it cannot get to the fine-grained entity methods.

So, it boils down why we need a framework. We do not really need it. However, a framework have all the stuff you need, you do not need to recreate things. So, as long as it is a large enough project, it is definitely worth it. I want to emphasize that the “design” time of the “things you need” are especially important. “architecture paralysis” is a very bad thing, it leads to “architecture chaos”. A good framework shut up all “discussions” about architecture: it is here, just learn to use it, and make it work. It devalues “architecture”, and promote business-value work, while at the same time, gracefully getting the architecture work done and done right!

In short, a framework has a lot of stuff you can get for free, and without painful uncertainty and perplexing thinking. You can just play and have fun!

Really, I love good teachers/coaches. A good teacher/coach always has strict rules and at the same time having fun in teaching and make it fun for learning. Only when you have a strict structure, then, you can boldly do things and push the limits, knowing that you are safe, the real hard and necessary limits will never be broken, and therefore you can have fun.

Strict rules, if they are the good ones, are all about pushing the limits of creativity, i.e., having fun!


Post a Comment

Subscribe to Post Comments [Atom]

<< Home