A few lessons from IntelliJ IDEA
My wife is currently taking Java classes as part of her curriculum at the university. I've played with Java a couple of times in the past, but because I never got a real chance of “working” with it, it never really grew into anything more than fiddling with it a little bit and then forgetting everything.
Fast forward a couple of years, and now I've been “playing” with C# for quite a while, and loving every minute of it. Now my wife has to play with Java, and I'm thinking, “What the hey, I might help her out with homework a little, just to get my feet wet again in this java thing”, besides, I really wanted to get a good look at the new IntelliJ IDEA java IDE, which some of my friends have been raving about like mad. Sure, I promised to help out with homework, but that doesn’t mean I can’t take a couple of hours and just play with the world of snazzy features that just fell into my lap, right? Oh man. The refactoring features in the IDE are dreamy. Take every piece of code you ever wrote, and make changes to it with the ease of a few mouse clicks. One of my favorites is the ability to write private/public fields and then hit ALT+INSERT and select “Implement getters/setters” from the menu that pops up. Then I just check off the fields I want and they automatically get Getters and setters (and are turned private). Do the same routine again, but select “Create constructors”, and again, you get the ability to just check off the fields that will be initialized automatically inside the constructors.
You also get tips that act like smart tags:
Here you can see what happens when I write a variable name in my method that is not declared. How cool is that? You get these tags when you do all sorts of things like not implement an interface correctly and so on. Another favorite of mine: “Refactoring->Rename” allows you to change a field’s name and automatically make all the other code conform to the new name. You can do the same with class names, method signatures and so on. You can also extract code into a separate method, extract interfaces, extract superclasses, move members between class hierarchies… very nifty.
Now, what I’ve outlined here is just the tip of the iceberg. There are literally hundreds of useful refactorings available in the IDE, and I love the amount of thought that went into creating this usability heaven. I don’t know just how good Whidbey will be at refactorings, but if it offers just half of this, it will be very cool (still, you have to wonder, why just half? How hard is it to implement all those features? Not very hard. It’s all pure nitty gritty work of search and replace mostly, that’s all).