|
|
Caught Josh Kerievsky's tutorial Tuesday. If you missed it--too bad for you! If you missed it and don't have the book, do like the guy who sat next to me: Jump up, run out of the class, and buy it.
Basically, what Kerievsky does is take patterns out of their religious context, saying that of the people who actually get design patterns, too many are "patterns-happy" and want to build them in regardless of need.
The trick is to wait. YAGNI, right? The simplest thing that could possibly work? When the code starts to smell, you'll need to refactor; at that point, consider your refactoring in the context of patterns.
That's the central takeaway from the class, and the book. But it's a biggie.
Note that I said "in the context of", not necessarily "to implement". Kerievsky points out that sometimes, the refactoring just isn't worth it unless you build it to the pattern (although he railed about slavish adherence to the "structure" examples in GoF and other pattern books--you don't have to build every special case and widget in just 'cause it's in the book!). But other times, as you refactor, you get to a point where the smell goes away before you've implemented the official pattern. Stop there. Kerievsky calls that refactoring "towards" a pattern--that's good too. Finally, he shows where you might refactor away from a pattern (the example he showed was converting a Singleton instance to a considerably-simpler inline implementation).
His slides and demos showed lists of smells, relating them to specific refactorings, and showed how to perform the mechanics. Moving, say, embellishments into a Decorator pattern involves multiple refactoring steps, not just one pull of the Eclipse lever, and he gives a good account of how to get there (as well as an appreciation of the process of developing and improving your own).
Me, I've got the book. Actually, I've got two, I keep loaning it out.
Josh has been working on the concept of refactoring to patterns for several years now. A few years back at the XP conference in Sardinia he presented the beginnings of this really good work. I was lucky enough to discuss these ideas with him way back then, and I was so impressed with his work that it motivated the Agile Modeling practice of Apply Patterns Gently (www.agilemodeling.com/practices.htm#ApplyPatternsGently). As Rick said, you need to get his book.
ASDF is coming soon! Don't be left behind!
Well done!
[url=http://ndvedtvw.com/xtry/rwdr.html]My homepage[/url] | [url=http://qjauhwcf.com/ehpj/ypiu.html]Cool site[/url]
Well done!
My homepage | Please visit
Thank you!
http://ndvedtvw.com/xtry/rwdr.html | http://dqoevrkr.com/tvuo/rkwg.html
Thanks for article!
I like articles like this. Thanks!
Thanks for article! Very interesting.
Do you can write anything else about it? Great article!