Working with Eclipse
Introducing Eclipse Refactoring Support
Modern Integrated Development Environments now provide support for
refactoring. Of course, refactoring can be performed by hand, but
specific refactoring functions make the process faster and less
error-prone. Eclipse has a Refactoring
Menu to provide access to refactoring actions.
Give these refactoring actions a try while refactoring the MatchGame
class to remove smells:
Rename - uncommunicative and
inconsistent names should be improved
Extract Method - could be
useful in reducing length/complexity and redundancy in code
Extract Constant - hard coded
numbers and string literals can be replaced with constants
Extract Local Variable -
expressions can be replaced with local variables
Finding and Fixing Problems
Eclipse can help spot
problems. Sometimes a problem is an indication of a smell. Eclipse
can sometimes suggest possible
quick fixes for problems it detects. While this can be a great time
saver, realize that this is not true for all problems and often several
solutions are suggested. It is up to you to understand your code well
enough to pick a correct solution suggestion (or decide on your own
correction). One technique that is sometimes useful is to temporarily
comment out code and see the problems that result. Eclipse has a Source menu that can be useful in
commenting/uncommenting blocks of code as well as in automating code
formatting and indentation tasks.
Keep in mind that Eclipse keeps a history of what you do. If you find
yourself wishing that you could consult/retrieve old code, check the "Compare
with Local History" command. The refactoring actions are also saved
in a refactoring history.
Version Control
In CS435F09 we use subversion through
an
Eclipse client called Subclipse. Here is a link to the subclipse
installation
instructions. Please install the latest version of the plugin
on your machine. Here are some notes
on using version control.