
This section contains a
walkthrough of how to configure dotEASY with a simple example
Let’s take a deeper look to
dotEASY following a simple walkthrough. Suppose you or your team works under
the paradigm of extreme programming and you want dotEASY to help you during
development. Let’s see step by step what you need to do in order to configure
dotEASY efficiently.
We’ll create a Category,
configure the metrics then we’ll create a couple of Attributes then we’ll
create a Code Smell and an Advice and finally we’ll configure the reports.
Part 1: Categories
First, you should create a Category in order to sort your configuration, so go to the tools menu>dotEASY>Configuration>Categories and write on the name box “Extreme Programming” and on the description box write “Category for Extreme Programming”. Then click the “Add” button and your category will appear on the Categories list. See also configuring categories.
Part 2: Metrics
Now you may want to choose which code element is the most important for you, so you should first select what metrics you want dotEASY to calculate, so you should go to the tools menu>dotEASY>Configuration>Metrics. There, suppose you choose to work heavily on classes, so check the Class Metrics item and uncheck the rest. This will select all class metrics. If you want specific metrics to be calculated and not all class metrics, simply check or uncheck the ones you desire to be calculated. We’ll assume that we have selected all class metrics. See also configuring metrics.
Part 3: Attributes
Then, it’s time to define attributes for your advices, so go to the tools menu>dotEASY>Configuration>Attributes. There add a new attribute named “performance” by writing it on the name text box and add the description “improves the performance of the code”. Then click the “add button” and the Attribute will appear on the Attribute list. Finally, add a second attribute named “Understablility” with any description. See also configuring attributes.
Part 4: Code Smells and Advices
Now,
if we want dotEASY to detect anomalies in our code, we should define Code
Smells and Advices.
First, let’s define a new Code Smell. To do this, go to the tools menu>dotEASY>Configuration>Code Smells. There, press the button “add new”. A second window will appear containing the four tabs mentioned on the configuration section.
In the first tab type the name for
your Code Smell. Let’s type “Large Class” and add the description “The class is
large, so this may impact the performance of this element”. Then, select the
category we’ve just created (“Extreme Programming”). Set the level to “Warning”
and the appliance to “Class”.
Let’s jump directly to the third tab
(we’ll explain tab two later). There you add the metrics thresholds for the
Code Smell. Let’s select the metric Lines of Code (LOC) of a Class, and set the
upper threshold value to 1000. Finally, click the button “add” to add the
threshold to the Code Smell.
Finally, if you’ve programmed any
validation library, you can associate it on the fourth tab by checking the
option “enable validation library” and by typing its full path (or selecting it
by use the “select” button).
Now,
let’s add a new advice that gives us a hint of what to do when the Code Smell
is detected. To do this, go to the tools menu>dotEASY>Configuration>Advices. There, press the button “add new”. A second window will appear
containing the four tabs mentioned on the
configuration
section.
In the first tab type the name for your Advice. Let’s type “Extract SubClass” and add the description “You should define a subclass , extracting specialized implementations from the original”.
In the second tab, add to the
improved attributes the one named “Understability”,
and add to the affected attributes the one named “Performance”
Let’s suppose you have a validation
library that is in charge of making some
validations. In the third tab you can associate it by checking the option
“enable validation library” and by typing its full path (or selecting it by use
the “select” button).
Finally, if you’ve programmed any
execution library, you can associate it on the fourth tab by checking the
option “enable execution library” and by typing its full path (or selecting it
by use the “select” button).
The
final thing you should do is associate the Advice with the Code Smell. To do this go to tools
menu>dotEASY>Configuration>Code Smells. There, go to the second tab and select the Advice we’ve just
created (“Extract SubClass”) and click the button
“add”.
We’re
done. Now, every time you request for a code Evaluation and a class with more
than 1000 lines of code is detect, the Code Smell is triggered and the advice
is shown to the user.
Part 5: Reports
The final thing you want to configure is the report. Let’s say that you want the metric report to show only the Metric abbreviation and its name, sorted by name on the metrics reports and the Advice name, Advice description and Code Smell name on the Advice Reports. Go to the tools menu>dotEASY>Configuration>Reports and select the “metrics report” tab. Click on the “metrics name” check box and select sorted by name on the “sorted by” option. Then, go to the “Advice report” tab and check Advice name, Advice description and Code Smell name. See also configuring reports.
See also