Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools

( Object Oriented Programming ) - ( Black Box Testing ) - ( Small Refactoring ) - ( Refactoring the Three Key Cup App )

Small Refactoring

The automated refactorings in Eclipse are more effective if you use some tricks:

  • Before extracting a method extract those expression you want to become parameters into local variables.
  • Before moving a part of a method to another class, you should extract this part into an own method in the current class.
  • If you need more tips: Ask on the mailing list! :-)

We have an implementation of a class Rectangle that stores its coordinates in two instances of the class Interval, one for the horizontal and one for the vertical extension of the Rectangle.

  1. Review the code below. Give us six ideas how to improve it. If you can name a bad smell somewhere, do it. Which refactorings would you apply? We won't count the suggestion to introduce getter-methods. (Maybe you understand later why (see 3)).
  2. Give us for four cases the code that we would get after your refactoring.
  3. Reviewing your code after executing the refactorings, could you imagine why we suggest being reluctant concerning the introduction of getter-methods?

You can find the source code for this task (with a JUnit-test) here

Source code

Source code

Resources about bad smells and refactorings

private/daniel/public/tutorials/small_refactoring.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2021