Geeks With Blogs

News My Blog has been MOVED to

Michael Freidgeim's OLD Blog My Blog has been MOVED to
If there is an existing  non-trivial function and you need to change it , do NOT copy and paste it , but modify to satisfy new requirements.
You may be need to split a big function into small ones and call them in different order or with different parameters.
Often you need just to add extra parameter to the function and have if-else branches depending on a new parameter.
In some cases new change is actually a fix of the problem, that applicable to all usages of the function.
Remember that "Copy and Paste" is NOT a good way of code re-use.
I also strongly recommend to read Exploring Smelly Code article to avoid other anti-patterns.
Posted on Wednesday, May 13, 2009 12:03 AM .Net Framework , General Tips | Back to top

Comments on this post: Don't Repeat Yourself(DRY principle) when modifying existing function

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Michael Freidgeim | Powered by: