the almighty "add layer of abstraction" refactoring that never existed

hi community,

there is one thing no ide has ever offered. a feature to clean up "in future would be" messed code in one single step. let me give you an example. let's say you have lots of calls like these:

load(key.getSysId())

and at other places:

showSomeWhereInGUI(key.getSysId())

now, someone decides that the user should not be able to see internal ids because they have to be changed because of a migration.

another example:

you have a little simple container that is used widely in the system. now, you need to add a business method to the container. but wait - that will mess things up on the long run. you'll want to replace all usages with usages of a new business object which hides the simple container. that way, you can put all business methods into the business object that contains the containes which is no longer directly exposed.

in both cases you'd need a refatoring that let's you select the usages that you want to be "pushed back" and hide behind a "layer of abstraction". in the first case you might want to replace the result with a class "Key" which holds both the sys and the view key. in the second case, you might want to wrap the container.

what do you think?

Please sign in to leave a comment.