University of Leicester – Department of Computer
Science
M.Sc. of Software Engineering in The E-economy
2004/2005 - System Reengineering CO7206
Labs 2 (19 Nov.), 3 (24 Nov.) and 4 (26 Nov.)
Objective: (1)
Applying Refactoring on a code base. (2) Learning to use a tool, IntelliJ, for
Refactoring java code. (3) Learning to automate testing using JUnit.
In these three
labs, students will try out a java integrated development environment (IDE)
that supports refactoring. We will try IntelliJ IDEA from JetBrains, which is a rich java IDE with
built-in refactorings. This allows you to mark the variable, code, etc. of
interest and then ask IntelliJ IDEA to apply a particular Refactoring with a
mouse click. However, it is important to remember that the tool does not think.
In other words, it is your job to examine a subject system carefully, discover
the bad smells, and then remove them with an appropriate refactoring(s). The
tool’s job is to automate the refactoring application. Also, it is important to
know that refactoring depends on the programmer’s experience, style and
preferences. So, there is not one right solution for every refactoring
exercise.
Task:
These are the activities to perform in the
three labs assigned to refactoring. My estimate is that each lab will need
about an hour to perform the basic tasks. If you finish one set of activities
in less than an hour, proceed to the next set.
Lab 2: 19 Nov. @ 9:30 am
1-
Start IntelliJ
and follow the instructions emailed to you to enter the required password and
license key and to set your project directory.
2-
Familiarize yourself
with IntelliJ and read the relevant documentation (e.g., there is an overview, online help and tutorials)
4-
Load or
write, compile and run your own java examples and programs.
5-
Review the refactoring
example given in the class and see how code evolved step by step. Think of
the relational behind each step and think for yourself whether you agree or not
with doing this step.
Lab 3: 24 Nov. @ 11:30 am
6-
Try out JUnit, read its Cookbook and other documentation
7-
Read the online help of IntelliJ
to see how to use JUnit from IntelliJ
8-
Use JUnit to
build a comprehensive test suite for the original version of the refactoring
example given in the class. Try this test suite for some of the later (refactored)
versions of the program and see if they pass the test.
9-
Read the
about the refactors supported by IntelliJ and how to perform them (this info is
in the online help
and possibly in other documentasions as well)
Lab 4: 26 Nov. @ 9:30 am
10- Review this example code,
compile it and run it. You may need to adjust some directory
Some Useful Resources:
q
http://www.intellij.com
(JUnit is integrated with IntelliJ)
q JUnit Cookbook
q
CO7206 Reading List under Blackboard
q
The class example
code, step by step