A lot of time is spent on developing and using good refactoring tools, so that if we do decide to change something, we can, with minimal effort. However, refactoring doesn't generally work between codebases, encouraging large, monolithic codebases. The old wisdom about always programming to interfaces, in case you want to change which implementation to use later, seems a bit flawed in the presence of refactoring IDEs. When I'm teaching, to keep things simple I let students use ArrayList references, rather than List ones. Of course, that breaks down with subList, because subList doesn't return an ArrayList. They'll never ever want to change their ArrayList to be a LinkedList, or a Vector, and even if they did, it would be a simple change with a refactoring IDE. Ok, so the difference is that my students aren't generally writing APIs.. Well, Josh Bloch suggests that writing internal code as if you're writing APIs is a good idea. After playing with a dynamic language again, I can see the benefits of that straight away, if you don't have a refactoring IDE. I can also see that the refactoring IDE encourages you to use one codebase. My main project, a network simulator, relies on a set of functional programming utilities (functionalpeas) that I keep as a separate project. If I want to change the API of the FP utilities, I open the FP project, edit, build a jar, then go back to the simulator, copy the jar across into lib/, rebuild and fix the errors. This experience makes me less likely to split my work into several separate modules. I can, at any point in the networking code, get access to any part of the GUI. Obviously I don't do this very often, maybe just during debugging, but it would be nice to be able to actually prevent myself from doing that by accident. I see two solutions to this: either I can get it right first time, every time, or IDEs can start to support refactoring between projects, possibly even pushing the refactor out to remote developers. Imagine this: "A library that this project uses has been updated. Would you like to review the refactoring script that comes with the update?".
Editor's Soapbox: The Billable Hour
2 hours ago