Exercise
As an example of simple refactoring, we'll provide some sample "bad
code" with a prevalent smell and ask you to walk through the process of
refactoring it.
Checkout the CircleCalc Eclipse project from
https://subversion.assembla.com/svn/ee461l-circlecalcrefactoring/trunk/
and perform the following
actions:
- Critique the code
- identify the most
offensive smell
- identify potential
problems that could be encountered in developing and/or maintaining a
system that uses the code as it is written
- Identify a refactoring from
Fowler's catalog that can be applied to remove the smell
- Apply the refactoring to
"fix" the code
- Describe why the refactored
code is better
Exercise
Extending our refactoring capabilities, in this exercise we'll again
provide some sample "bad code" with a prevalent smell. But
here we'll apply refactoring with an eye on moving the code to employ a
design pattern.
Checkout the ShapeCalc Eclipse project at
https://subversion.assembla.com/svn/ee461l-shapecalcrefactoring/trunk/
and perform the following
actions:
- Critique the code
- identify the most
offensive smell
- identify potential
problems that could be encountered in developing and/or maintaining a
system that uses the code as it is written
- Identify a design pattern
that's use could improve the code
- Identify a refactoring (or
set of refactorings) from
Fowler's catalog that can be applied to remove the smell and implement
the design pattern you identified above
- Apply the refactoring to
"fix" the code
- Describe why the refactored
code is better