User Tools

Site Tools


sad

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
sad [2014/02/16 06:38]
yann
sad [2019/10/06 20:37] (current)
Line 27: Line 27:
 ===== Anti-patterns Generation ===== ===== Anti-patterns Generation =====
  
-The generation of code and design smell identification algorithms is straightforward. Class ''​sad.rule.creator.RULECreator''​ expects to find rule cards, i.e., files with extensions ''​.rule''​ in the ''​rsc''​ directory of project ''​SAD Rules Creator''​. It provides a main method that iterates through all the rule cards and generate ​the corresponding identification ​algorithm ​into the ''​SAD''​ project.+The generation of code and design smell identification algorithms is straightforward. Class ''​sad.rule.creator.RULECreator''​ expects to find rule cards, i.e., files with extensions ''​.rule''​ in the ''​rsc''​ directory of project ''​SAD Rules Creator''​. It provides a main method that iterates through all the rule cards and generates ​the corresponding identification ​algorithms ​into the ''​SAD''​ project. Once the generation process done, refresh and compile the ''​SAD''​ project and the new identification algorithms are available.
  
 ===== Anti-patterns Identification ===== ===== Anti-patterns Identification =====
  
 Identifying code and design smells using PADL is made easy by the helper class ''​sad.helper.SmellsIdentifier''​. After having installed CPL, PADL, and POM, just go into the ''​SAD Tests''​ project and have a look at this class. It provides a main method with snippets of code to call the method ''​analyseIdiomLevelModel(String[],​ String, IIdiomLevelModel,​ String)'',​ which handles all the details. Also have a look at the constant array listing the smells that must be identified or avoided: ''​SMELLS_TO_IDENTIFY''​. Identifying code and design smells using PADL is made easy by the helper class ''​sad.helper.SmellsIdentifier''​. After having installed CPL, PADL, and POM, just go into the ''​SAD Tests''​ project and have a look at this class. It provides a main method with snippets of code to call the method ''​analyseIdiomLevelModel(String[],​ String, IIdiomLevelModel,​ String)'',​ which handles all the details. Also have a look at the constant array listing the smells that must be identified or avoided: ''​SMELLS_TO_IDENTIFY''​.
 +
 +SAD requires [[POM]] to compute various metrics involved in the definitions of the code and design smells. These metrics are referenced by name in the rule cards, for example:
 +
 +<​code>​
 +RULE_CARD : ComplexClass { 
 +   RULE : ComplexClass { UNION LargeClassOnly ComplexClassOnly } ; 
 +   RULE : LargeClassOnly { (METRIC: NMD + NAD, VERY_HIGH, 0) } ; 
 +   RULE : ComplexClassOnly { (METRIC: McCabe, VERY_HIGH, 20) } ;
 +};
 +</​code>​
sad.1392532692.txt.gz ยท Last modified: 2019/10/06 20:37 (external edit)