When I’m working on a group of classes that offer similar functionality, I’ll want to create a parent class or interface to share functionality or allow the children to be used polymorphically. Eclipse has a couple of refactoring tools that make the process of creating the parent easier. Ctrl-Alt-T to open the refactoring menu and [...]
Archive for the ‘refactoring’ Category
Extract supertype
Posted in refactoring, tagged who's your daddy on June 18, 2008 | Comments Off
So many refactorings to pick from…
Posted in refactoring, tagged ...so much code to refactor on December 5, 2007 | Comments Off
Ok, by now we all know that REFACTORING IS GOOD. Say it again! Testify! But with so many refactoring choices in this workaday world, how is a developer to know which one to pick? Well, in a given situation Eclipse will guide you towards refactoring bliss by showing you a neat list of all the applicable refactorings. Select [...]
Taming large methods
Posted in refactoring, tagged what you've got hold of there is an anteater on November 28, 2007 | Comments Off
Next to using a chair and a whip, one of the most effective ways to tame large, complicated, methods that do many things is to refactor them into smaller more manageable methods that each do a single thing. Eclipse offers an “Extract Method” refactoring for this case. You can select a block of code that you want [...]
When your code has an identity crisis
Posted in refactoring, tagged a rose by any other name would smell as sweet on November 21, 2007 | Comments Off
Did you know that Sting used to be named Gordon Sumner, that John Denver was Henry John Deutschendorf or that Michael J. Fox was Michael A. Fox? Name changes are uncommon when we’re talking about people (except in the entertainment industry, apparently) but they’re very common when we’re talking about code.
Renaming is one of the [...]