This post originated from an RSS feed registered with .NET Buzz
by Sudhakar Sadasivuni.
Original Post: Three things to avoid when using design patterns
Feed Title: {Sudhakar's .NET Dump Yard;}
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/ssadasivuni/rss.aspx
Feed Description: using Sudhakar.Dotnet.Blog.Main;
from Terje's weblog I found these three issues in many J2EE apps built. Design patterns used when those are not required too.
Using design patterns is a good thing, but as any other programming technique, it can easily be misused. Here‘s three things you should avoid when using design patterns:
Using evil design patterns A few design patterns are considered evil by some. This includes one of the GoF-patterns; Singleton. Some people even call Singleton an anti-pattern, and the use of an IoC-container is a good way to avoid being tempted to use Singletons. If you don't want to use an IoC-container Singletons can be used (sparingly) if used wisely.
Using design patterns the wrong way Most design patterns are well documented. Using a design pattern the wrong way leaves a pitfall in your code. A programmer looking at the code might think a design pattern is used when it in fact is bad code disguised as a design pattern.
Overuse design patterns A simple functionality does not need a complicated design. Overusing design patterns complicated things, and can in fact make the code harder to maintain. An obvious rule is to only use a design pattern when it improves the design.