University of Leicester –
Department of Computer Science
CO7206 - Fall 2003 –
Assignment #3 (8%)
Due on Nov. 28, 2003 at 11:59 pm
program and produce a list of all the bad smells in this code
this program by countering each bad smell with one or more refactorings
report that describes the steps of the refactorings you implemented. For each
smell or other reason was behind this refactoring
Where in the
code, this smell exists (e.g., method X is too long).
The name of
the refactoring, if it is in the catalogue, or a description of it if it is
your own refactoring.
description of the refactoring implementation in the given code (e.g., the loop
that does Y was extracted from X to a new method Z)
Add to the
report a comparison of the original and the final versions of the given program
using OO Complexity and Maintainability metrics. Discuss the differences
between the two versions.
code for refactoring step in a separate directory with serial version numbers.
Add to each version a ReadMe.txt file that describes: (a) What bad smell in the
previous version was removed and using which refactoring. (b) What bad smell is
now going to be dealt with and using which refactoring.
separate directory store the code used for testing the program and the test
Create a zip
file with all the versions of the code, each in a separate directory, and the
report and the zip file.
that the first step in refactoring is preparing a suitable test suite.
that refactoring needs to be done one small step at a time.
There is no
obligation to use any particular tool. However, instead of wasting time doing
the work manually (e.g., implementing refactorings and counting the lines of
code), I would strongly encourage you to invest the time instead in speed
learning a tool that can do the job instantaneously. A list of possible tools
is suggested below. But I did not have a chance to try all of them. You may be
able to find other free or better tools on your own.
There is no
upper or lower limit on the length of your report. Certainly you do not need to
write using the detailed style of Fowler, used to explain refactoring to his
readers. But need to write enough description that helps me understand your
steps to change the code and the rationale behind each step.
examples on refactoring, read the Refactoring Reading
q The JUnit testing
be used for automating testing. It has a Cookbook.
q IntelliJ and JRefactory are
tools that automate refactoring implementation
q Finally, here is a brief
on complexity and maintainability metrics suitable for OO code.
q And a possible tool, JMetrics, for collecting
metrics about Java code.