Geeks With Blogs
My Blog geek yapping Patterns
Chain Constructors
Chain Constructors is another refactoring from the book Refactoring to Patterns, it helps remove duplication in constructor overloads. This should be a very familiar refactoring for most developers. Catch all constructors are produced, and hopefully minimized, that other constructors rely on either directly or indirectly. Mechanics Study the constructors in the class and find the two with the most shared code. Say I have two constructors to create lines as follows: public class Line { ... private ......

Posted On Wednesday, June 17, 2009 5:52 PM

Refactoring, Creation Methods
Lately, I’ve been engulfed in several design books, one of which is Refactoring to Patterns by Joshua Kerievsky. The book is an extension of Martin Fowler’s book, Refactoring. It emphasizes learning to use patterns by working with existing code, identifying code that “smells” and then finding a pattern to refactor the code “to, towards or away from.” Smelly code typically involves duplication, complexity and/or ambiguity. Joshua believes, rather than heavy pattern use up front, to let code evolve ......

Posted On Tuesday, June 16, 2009 8:46 PM

Copyright © Wes McClure | Powered by: