Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Techniques"
(→Provided refactorings for Ecore models (to do)) |
(→Provided refactorings for UML2 models (to do)) |
||
Line 311: | Line 311: | ||
=== Provided refactorings for UML2 models (to do) === | === Provided refactorings for UML2 models (to do) === | ||
+ | ---- | ||
+ | <TABLE BORDER=1 CELLPADDING=8 CELLSPACING=5 bgcolor="#ffffff"> | ||
+ | <TR> | ||
+ | <TD COLSPAN=2 ALIGN=CENTER><font size=+1><a name="refactorings">UML2 Refactorings</a></font> | ||
+ | </TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TH>Refactoring</TH> | ||
+ | <TH>Description</TH> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Add Parameter</TD> | ||
+ | <TD ALIGN=LEFT>An operation needs more information from its callers. Therefore, | ||
+ | this refactoring adds a parameter to an operation.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Create Associated Class</TD> | ||
+ | <TD ALIGN=LEFT>This refactoring creates an empty class and connects it with a new | ||
+ | association to the source class from where it is extracted. The multiplicities | ||
+ | of the new association is 1 at both ends. Usually, refactorings Move | ||
+ | Attribute and Move Operation are the next steps after this refactoring.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Create Class with Attributes from Parameter List</TD> | ||
+ | <TD ALIGN=LEFT>There is a group of parameters that naturally go together. This | ||
+ | refactoring creates a new class and inserts new attributes which conform to | ||
+ | the given parameter list. It is a part of refactoring Introduce Parameter Object.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Create Subclass</TD> | ||
+ | <TD ALIGN=LEFT>A class has features (attributes or operations) that are not used | ||
+ | in all instances. This refactoring creates a subclass for that subset of | ||
+ | features. However, the new subclass has no features. Usually, refactorings | ||
+ | Push Down Attribute and Push Down Operation are the next steps after | ||
+ | this refactoring.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Create Superclass</TD> | ||
+ | <TD ALIGN=LEFT>This refactoring can be applied when there are at least two classes | ||
+ | with similar features (attributes or operations). The refactoring creates a | ||
+ | superclass for this set of classes and is normally followed by refactorings | ||
+ | Pull Up Attribute and Pull Up Operation. So, the refactoring helps to | ||
+ | reduce the duplicate common features spread throughout different classes.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Extract Class</TD> | ||
+ | <TD ALIGN=LEFT>This refactoring extracts interrelated features (attributes and operations) | ||
+ | from a class to a new separated class.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Extract Subclass</TD> | ||
+ | <TD ALIGN=LEFT>There are features (attributes and operations) in a class required | ||
+ | for a special case only. This refactoring extracts a subclass containing this | ||
+ | features.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Extract Superclass</TD> | ||
+ | <TD ALIGN=LEFT>There are two or more classes with similar features. This refactoring | ||
+ | creates a new superclass and moves the common features to the | ||
+ | superclass. The refactoring helps to reduce redundancy by assembling | ||
+ | common features spread throughout different classes.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Extract Superclass (without Pull Up Operation)</TD> | ||
+ | <TD ALIGN=LEFT>This refactoring does the same as Extract Superclass but | ||
+ | moves only common attributes to the new superclass.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Hide Attribute</TD> | ||
+ | <TD ALIGN=LEFT>This refactoring hides a public class attribute by setting | ||
+ | its visibility to private and creates corresponding getter and setter operations.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Inline Class</TD> | ||
+ | <TD ALIGN=LEFT>There are two classes connected by a 1:1 association. One of them | ||
+ | has no further use. This refactoring merges these classes.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Introduce Parameter Object </TD> | ||
+ | <TD ALIGN=LEFT>There is a group of parameters that naturally go together. This | ||
+ | refactoring replaces a list of parameters with one object. This parameter | ||
+ | object is created for that purpose.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Merge State Features</TD> | ||
+ | <TD ALIGN=LEFT>This refactoring merges several features of two subsequent states | ||
+ | of a state chart (a contextual state and a parameter state). More specifically, | ||
+ | it moves all actions from the parameter state to the contextual state, redirects | ||
+ | all external transitions of the parameter state to the contextual state, and | ||
+ | finally removes all inner transitions in between both states. It is part of the | ||
+ | refactoring Merge States.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Merge States</TD> | ||
+ | <TD ALIGN=LEFT>This refactoring is used to form a set of states into a single one</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Move Attribute</TD> | ||
+ | <TD ALIGN=LEFT>A property (attribute) is better placed in another class which | ||
+ | is associated to this class. This refactoring moves this property to the | ||
+ | associated class.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Move Operation</TD> | ||
+ | <TD ALIGN=LEFT>This refactoring moves an operation of a class to an associated | ||
+ | class. It is often applied when some class has too much behavior or when | ||
+ | classes collaborate too much.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Pull Up Attribute</TD> | ||
+ | <TD ALIGN=LEFT>This refactoring removes one property (attribute) from a class or | ||
+ | a set of classes and inserts it to one of its superclasses.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Pull Up Operation</TD> | ||
+ | <TD ALIGN=LEFT>This refactoring pulls an operation of a class to its superclass. | ||
+ | It is used internally on several classes which inherit from the | ||
+ | same superclass. The aim of this refactoring is often to extract identical | ||
+ | operations.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Push Down Attribute</TD> | ||
+ | <TD ALIGN=LEFT>An attribute (property) is used only by some subclasses. Move | ||
+ | the attribute to only these subclasses. More generally, this refactoring | ||
+ | moves the attribute to all subclasses. If it makes sense, the attribute | ||
+ | can be removed from some of these afterwards. Sometimes, it also makes | ||
+ | sense to keep an attribute in all subclasses to hide it from the superclass.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Push Down Operation</TD> | ||
+ | <TD ALIGN=LEFT>This refactoring pushes an operation from the owning class down | ||
+ | to all its subclasses. If it makes sense, the operation can be removed | ||
+ | from some of these afterwards. Sometimes, it also makes sense to keep an | ||
+ | operation in all subclasses to hide it from the superclass.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Remove Empty Associated Class</TD> | ||
+ | <TD ALIGN=LEFT>There is an empty class that is associated to another class. An | ||
+ | associated class is empty if it has no features except for possible getter | ||
+ | and setter operations for the corresponding association end. Furthermore, | ||
+ | it has no inner classes, subclasses, or superclasses, it does not implement | ||
+ | any interfaces, and it is not referred to as type of an attribute, operation | ||
+ | or parameter.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Remove Empty Subclass</TD> | ||
+ | <TD ALIGN=LEFT>A superclass has an empty subclass which shall be removed. This | ||
+ | class is not associated to another class. It has no features, no inner classes, | ||
+ | no further subclasses, and is not associated to other classes. It does not | ||
+ | implement any interfaces, and it is not referred to as type of an attribute, | ||
+ | operation or parameter.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Remove Empty Superclass</TD> | ||
+ | <TD ALIGN=LEFT>A set of classes has an empty superclass which shall be removed. | ||
+ | This class is not associated to another class. It has no features, no inner | ||
+ | classes, and is not associated to other classes. It does not implement any | ||
+ | interfaces, and it is not referred to as type of an attribute, operation or | ||
+ | parameter.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Remove Parameter</TD> | ||
+ | <TD ALIGN=LEFT>A parameter is no longer needed by an operation. Therefore, | ||
+ | this refactoring removes this parameter from the parameter list of the operation.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Remove Redundant Transition</TD> | ||
+ | <TD ALIGN=LEFT>This refactoring removes a transition between two states | ||
+ | of a state chart if there is already another one between the two states | ||
+ | similar to it.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Remove Superclass</TD> | ||
+ | <TD ALIGN=LEFT>There is a set of classes having a superclass that does not make | ||
+ | sense anymore. Remove this superclass after pushing remaining features | ||
+ | down.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Remove Unused Interface</TD> | ||
+ | <TD ALIGN=LEFT>This refactoring removes a given interface which is not used by | ||
+ | and not realized by any classifier and has no sub interface.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Remove Unused Interfaces</TD> | ||
+ | <TD ALIGN=LEFT>This refactoring removes all unused interfaces from the model.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Rename Actor</TD> | ||
+ | <TD ALIGN=LEFT>Renames an existing actor to the inserted new name.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Rename Attribute</TD> | ||
+ | <TD ALIGN=LEFT>Renames an existing class attribute to the inserted new name.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Rename Class</TD> | ||
+ | <TD ALIGN=LEFT>Renames an existing class to the inserted new name.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Rename Operation</TD> | ||
+ | <TD ALIGN=LEFT>Renames an existing operation to the inserted new name.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Rename State</TD> | ||
+ | <TD ALIGN=LEFT>Renames an existing state to the inserted new name.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Rename Use Case</TD> | ||
+ | <TD ALIGN=LEFT>Renames an existing use case to the inserted new name.</TD> | ||
+ | </TR> | ||
+ | <TR> | ||
+ | <TD>Show Attribute</TD> | ||
+ | <TD ALIGN=LEFT>This refactoring shows a private class attribute by setting | ||
+ | its visibility to public and removes corresponding getter and setter operations.</TD> | ||
+ | </TR> | ||
+ | </TABLE> |
Revision as of 10:17, 25 April 2014
The following model quality assurance techniques are provided by EMF Refactor.
Contents
Provided techniques for Ecore models (to do)
EMF Refactor provides the following model quality assurance techniques for Ecore models (nsUri http://www.eclipse.org/emf/2002/Ecore).
Provided metrics for Ecore models
Context | Metric | Description |
---|---|---|
EClass | AvEPEOEC | Average number of EParameters in EOperations of the given EClass. |
EClass | ECEOEC | Number of EReferences of other EClasses having the given EClass as type. |
EClass | ECEPEC | Number of EParameters within other EClasses having the given EClass as type. |
EClass | ECEREC | Number of EReferences of other EClasses having the given EClass as type. |
EClass | HAGGEC | Length of the longest path to the leaves in the aggregation hierarchy. |
EClass | ICEPEC | Number of EParameters within the EClass having another EClass or interface as type. |
EClass | ICEPECEC | Number of EParameters within the EClass having another EClass as type. |
EClass | ICEPEIEC | Number of EParameters within the EClass having another interface as type. |
EClass | MAXDITEC | Depth of Inheritance Tree (maximum due to multiple inheritance). |
EClass | NCEAEC | Number of constant EAttributes of the given EClass. |
EClass | NDEROEC | Number of different EClasses being referenced by the given EClass. |
EClass | NEAEC | Number of EAttributes of the given EClass. |
EClass | NEOEC | Number of EOperations of the given EClass. |
EClass | NEPEC | Total number of EParameters in EOperations of the given EClass. |
EClass | NEREC | Total number of EReferences of the given EClass. |
EClass | NEROEC | Number of EReferences of the given EClass to other EClasses. |
EClass | NERSEC | Number of EReferences of the given EClass to itself. |
EClass | NFEEC | Number of features (EAttributes and EOperations) of the given EClass. |
EClass | NPECEC | Number of EClasses being parts of the given EClass. |
EClass | NSUBEC | Number of direct child EClasses of the given EClass. |
EClass | NSUBEC2 | Number of all child EClasses of the given EClass. |
EClass | NSUPEC | Number of direct parent EClasses of the given EClass. |
EClass | NSUPEC2 | Total number of ancestors of the given EClass. |
Provided smells for Ecore models
Smell | Description |
---|---|
Large EClass | The model contains an EClass owning more features (EAttributes and EOperations) than the specified limit. |
Speculative Generality EClass | The model contains an abstract EClass that is inherited by one concrete EClass only. |
Unnamed EClass | The model contains an EClass without a name. |
Provided refactorings for Ecore models (to do)
Refactoring | Description |
---|---|
Add EParameter with EClassifier type | |
Create referenced EClass | |
Create sub EClass | |
Create super EClass | |
Move EAttribute | |
Move EOperation | |
Pull up EAttribute | |
Pull up EOperation | |
Push down EAttribute | |
Push down EOperation | |
Remove empty referenced EClass | |
Remove empty sub EClass | |
Remove empty super EClass | |
Remove EParameter | |
Rename EAttribute | |
Rename EClass | |
Rename EDataType | |
Rename EEnumLiteral | |
Rename EOperation | |
Rename EPackage | |
Rename EParameter | |
Rename EReference |
Provided techniques for UML2 models (to do)
Provided metrics for UML2 models (to do)
Provided smells for UML2 models (to do)
Provided refactorings for UML2 models (to do)
<a name="refactorings">UML2 Refactorings</a> | |
Refactoring | Description |
---|---|
Add Parameter | An operation needs more information from its callers. Therefore, this refactoring adds a parameter to an operation. |
Create Associated Class | This refactoring creates an empty class and connects it with a new
association to the source class from where it is extracted. The multiplicities of the new association is 1 at both ends. Usually, refactorings Move Attribute and Move Operation are the next steps after this refactoring. |
Create Class with Attributes from Parameter List | There is a group of parameters that naturally go together. This
refactoring creates a new class and inserts new attributes which conform to the given parameter list. It is a part of refactoring Introduce Parameter Object. |
Create Subclass | A class has features (attributes or operations) that are not used
in all instances. This refactoring creates a subclass for that subset of features. However, the new subclass has no features. Usually, refactorings Push Down Attribute and Push Down Operation are the next steps after this refactoring. |
Create Superclass | This refactoring can be applied when there are at least two classes
with similar features (attributes or operations). The refactoring creates a superclass for this set of classes and is normally followed by refactorings Pull Up Attribute and Pull Up Operation. So, the refactoring helps to reduce the duplicate common features spread throughout different classes. |
Extract Class | This refactoring extracts interrelated features (attributes and operations) from a class to a new separated class. |
Extract Subclass | There are features (attributes and operations) in a class required
for a special case only. This refactoring extracts a subclass containing this features. |
Extract Superclass | There are two or more classes with similar features. This refactoring
creates a new superclass and moves the common features to the superclass. The refactoring helps to reduce redundancy by assembling common features spread throughout different classes. |
Extract Superclass (without Pull Up Operation) | This refactoring does the same as Extract Superclass but moves only common attributes to the new superclass. |
Hide Attribute | This refactoring hides a public class attribute by setting its visibility to private and creates corresponding getter and setter operations. |
Inline Class | There are two classes connected by a 1:1 association. One of them has no further use. This refactoring merges these classes. |
Introduce Parameter Object | There is a group of parameters that naturally go together. This
refactoring replaces a list of parameters with one object. This parameter object is created for that purpose. |
Merge State Features | This refactoring merges several features of two subsequent states
of a state chart (a contextual state and a parameter state). More specifically, it moves all actions from the parameter state to the contextual state, redirects all external transitions of the parameter state to the contextual state, and finally removes all inner transitions in between both states. It is part of the refactoring Merge States. |
Merge States | This refactoring is used to form a set of states into a single one |
Move Attribute | A property (attribute) is better placed in another class which
is associated to this class. This refactoring moves this property to the associated class. |
Move Operation | This refactoring moves an operation of a class to an associated
class. It is often applied when some class has too much behavior or when classes collaborate too much. |
Pull Up Attribute | This refactoring removes one property (attribute) from a class or a set of classes and inserts it to one of its superclasses. |
Pull Up Operation | This refactoring pulls an operation of a class to its superclass.
It is used internally on several classes which inherit from the same superclass. The aim of this refactoring is often to extract identical operations. |
Push Down Attribute | An attribute (property) is used only by some subclasses. Move
the attribute to only these subclasses. More generally, this refactoring moves the attribute to all subclasses. If it makes sense, the attribute can be removed from some of these afterwards. Sometimes, it also makes sense to keep an attribute in all subclasses to hide it from the superclass. |
Push Down Operation | This refactoring pushes an operation from the owning class down
to all its subclasses. If it makes sense, the operation can be removed from some of these afterwards. Sometimes, it also makes sense to keep an operation in all subclasses to hide it from the superclass. |
Remove Empty Associated Class | There is an empty class that is associated to another class. An
associated class is empty if it has no features except for possible getter and setter operations for the corresponding association end. Furthermore, it has no inner classes, subclasses, or superclasses, it does not implement any interfaces, and it is not referred to as type of an attribute, operation or parameter. |
Remove Empty Subclass | A superclass has an empty subclass which shall be removed. This
class is not associated to another class. It has no features, no inner classes, no further subclasses, and is not associated to other classes. It does not implement any interfaces, and it is not referred to as type of an attribute, operation or parameter. |
Remove Empty Superclass | A set of classes has an empty superclass which shall be removed.
This class is not associated to another class. It has no features, no inner classes, and is not associated to other classes. It does not implement any interfaces, and it is not referred to as type of an attribute, operation or parameter. |
Remove Parameter | A parameter is no longer needed by an operation. Therefore, this refactoring removes this parameter from the parameter list of the operation. |
Remove Redundant Transition | This refactoring removes a transition between two states
of a state chart if there is already another one between the two states similar to it. |
Remove Superclass | There is a set of classes having a superclass that does not make
sense anymore. Remove this superclass after pushing remaining features down. |
Remove Unused Interface | This refactoring removes a given interface which is not used by and not realized by any classifier and has no sub interface. |
Remove Unused Interfaces | This refactoring removes all unused interfaces from the model. |
Rename Actor | Renames an existing actor to the inserted new name. |
Rename Attribute | Renames an existing class attribute to the inserted new name. |
Rename Class | Renames an existing class to the inserted new name. |
Rename Operation | Renames an existing operation to the inserted new name. |
Rename State | Renames an existing state to the inserted new name. |
Rename Use Case | Renames an existing use case to the inserted new name. |
Show Attribute | This refactoring shows a private class attribute by setting its visibility to public and removes corresponding getter and setter operations. |