Tuesday, April 10, 2012

Helper Classes and SRP/DRY

The single responsibility principle sometimes drives the creation of helper classes as inclusion of their functionality could leave the core class with multiple responsibilties. Helper classes may also be created to stick with the DRY Principle (Do not Repeat Yourself); i.e. a piece of code that somehow seems to appear in all sorts of places needs to be consolidated in one place but doesn't have a natural home (though one should use this case very sparingly - it's more likely that you don't yet fully comprehend what's going on in your object model).

Peer Reynders
http://www.coderanch.com/t/100578/patterns/helper-functions-good-design

No comments:

Post a Comment