Geeks With Blogs
My Blog geek yapping Refactoring
Creating abstractions instead of using generic collections

Posted On Monday, January 23, 2012 5:38 PM

Remove<T>(this IList<T> source, Func<T,bool> selector) why not?
Maybe I am just crazy, but it seems like removing or deleting items from a collection is always an after thought. Take IList for example, a list of items, with the ability to add and remove from it. We have a flurry of extension methods that are inherited from IEnumerable to add items but it seems like no one thought maybe it would be nice to beef up the remove method with some extension methods. Maybe I missed an extension namespace, maybe I am just crazy. How many times do we have to write the ......

Posted On Wednesday, November 25, 2009 11:58 PM

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: