The Source for Java Technology Collaboration


Home | Help | Changes | Index | Search | Go

AntiPattern

AntiPattern is a pattern that tells how to go from a problem to a bad solution.

There is a lengthy dicussion at the PPR:PortlandPatternRepository on PPR:AntiPatterns and a whole slew of examples in PPR:AntiPatternsCatalog many of which are applicable to Java.


Magic Servlet

Magic Servlet is an anti-pattern that is specific to java web solutions.

Problem: A magic servlet is a servlet that tries to address a large number of inputs, and/or produces a variety of outputs. Some of the common signs of a magic servlet are very large methods with recursive or convoluted logic encompassed into one servlet class.

Cause: Magic servlet pattern becomes difficult to debug. One of the main causes of this pattern is the result of addressing numerous quick fix solutions. The problem pattern grows as a result of developers not dedicating time to refactor the servlet, or high developer turnover. This pattern is similar to BigBallOfMud and Spaghetti code, which have similar causes.

Solutions: Apply good refactoring rules of extracting methods, and extract class processes can help with improving the Magic servlet pattern. A longer term solution is to identify the real purpose of the servlet, and apply an appropriate design pattern. One suggested pattern, Model View Controller is often used within the context of Java Faces and Struts frameworks, and is helpful in addressing multiple output scenarios.


Discussion about AntiPattern

Topic AntiPattern . { Edit | Ref-By | Printable | Diffs r5 < r4 < r3 < r2 < r1 | More }
 XML java.net RSS

Revision r5 - 02 Jul 2003 - 07:28:26 - Main.zander