| Antipatterns |
|
|
AntipatternsAntiPatterns are related to Design Patterns, in that Design Patterns provide solutions to recurring problems, while AntiPatterns are ”a literary form that describes a commonly occurring solution to a problem that generates decidedly negative consequences”. AntiPatterns are useful in several ways:
AntiPatterns are categorized into three groups,
Reference: AntiPatterns:Refactoring Software, Architectures, and Projects in Crisis. Wiley, W. J. Brown, R. C.Malveau, H.W.McCormick, and T. J.Mowbray. Analys4j provides metrics based search to identify antipatterns in Java. Identifying Development Antipatterns in Java using Analyst4j.Applying antipatterns to control development and maintenance, starts with identifying such elements. Given the volume of code, it is relatively difficult to manually find these artifacts. Analyst4j propose a method to identify antipatterns in Java using software metrics. As software metrics are quality attributes of code (Java) elements, some metrics with a given threshold can identify the symptoms of an antipattern in those Java elements. Lets study how this can be accomplished, here we understand some development antipatterns with Java perspective and formulate an equation to find these antipatterns using automated software metrics.
The BlobBlob class or God class is a procedural design even though it may be represented using object notations. A procedural design is process oriented and separates process from data, while object-oriented design merges process and data. Hence a Blob class contains majority of process. Blob classes must be identified and refactored to ensure maintainability. * A class with 60 or more attributes and operations usually indicates the presence of the Blob. Impact of a Blob's * Too complex for reuse and testing. Identifying Blob using software metrics
Results of case study on JFreechart Source
Spaghetti CodeThe Spaghetti Code AntiPattern is probably the most well-known and the most widespread AntiPattern. In the early days of computing and programming, when the design of software systems was not very well understood and often done in an ad-hoc style, Spaghetti Code was pervasive. But even today, in the age of object-oriented programming (OOP) and high-level languages, the pattern still persists. Symptoms of Spaghetti Code * Process oriented design, rather than data oriented design. Impacts of Spaghetti Code * Code entropy.
Results of case study on JFreechart Source Swiss Army Knife ClassesA Swiss Army Knife, also known as Kitchen Sink, is an excessively complex class. The designer attempts to provide for all possible uses of the class. * Too many methods and data.
* Decreases maintainability.Identifying Swiss Army Classes using software metrics
Class antipatterns report generated using Analyst4j (doc) for JFreechart source.Analysis of 513 source files took 296 seconds, all source analyzed excluding unit testing packages/files. The following is report generated automatically using the definitions discussed above. Download report ConclusionThe choice of metrics and threshold have been the result of analyzing metrics value distribution in several projects, however they may or may not fit all projects. Analyst4j search definitions are highly customizable and the user may modify as needed. |
|||||||||||||||||||||||||||||||
| < Prev | Next > |
|---|