I don't KISS, but I like to keep it DRY.

If you didn't get past the disgusting interpretation of that title, then you probably shouldn't be reading this blog ;)
I make elephants out flies and flies out of elephants, after-all, the human genetic code is 40% bananas!

Monday, January 25, 2010

A small case on IDEs

Upper class 3rd-generation programming language frameworks, such as Java and .NET make it impossible to code anything beyond a simple algorithm in a simple text editor. One may even think that these languages were designed to make us use IDEs, but that would probably be an overstatement. So, there exist various IDEs to make our jobs as coders for these frameworks much less of a burden, and oh my do they do a great job! I'm sure, those of you familiar with such coding, won't object me too much when I say that code-completion in Visual Studio, Eclipse, Netbeans, and so on, probably makes all the difference in the world!

Recently, from a bit of over-coding in Java I've noticed a pattern, or rather an itch that I've had for while, with all of these big IDEs. The thing is that they do a great job at analyzing the code standing before the cursor, and in other functions and classes, but there seems to be no analysis of the code between the position of the cursor and the end of the current line of code! Let me give you an example:

Assume that I make the novice mistake of using
m.group(1) == "maze";
instead of the built in equals(Object anObject) method in the String class.

So I decide to correct that. Being the cautious user that I rarely am, I decide not to erase "maze", but rather change the code around it. So I move the cursor to the closing ", and put a ):
m.group(1) == "maze");
Then I move the cursor to the opening ", delete until, but excluding, the closing ), and putting a . right next to it:
m.group(1)."maze");
This causes my IDE to pop-up a smart auto-completion box with all the available to me fields, properties & methods of the String class. I genuinely type a few of the first letters of the word equals, until it is the only method present, and in desperation hit TAB to autocomplete. The dumb thing is that this results in:
m.group(1).equals(anObject)"zoom");
A totally unusuable peace of code. Thus, I end up doing more work cleaning this up, than I would've originally, if I simply decided to delete the intere == "zoom" sequence, and write it all over again. Sadly, sometimes the line to keep is long, and the change in comparison is subtle, which begs for copy/paste, but how irritating is it to have to resort to selecting code when coding!

So, my dear IDE, will you please learn look not only behind, but also ahead when you autocomplete?

P.S. I didn't include screen-shots to emphasize this goes for any IDE I've ever used, but correct me if I'm wrong of course :) Oh and I'm open to suggestions on how to fix this, if such a feature comes built in. I know that Eclipse is open-source so don't tell me that ;)

No comments:

Post a Comment