Monday, February 25, 2008

Six reasons why you should know internals of your IDE

May be this is overwhelmingly obvious to geeks, but I am going to describe it nonetheless. This might not significantly impress non-developers or the people and programmers (yes, they are different) who can't describe the word 'tooling'. A developer's productivity is highly dependent on the tools they use, whether it's a fancy big fat IDE platform or an editor as abstemious as VI.

Apparently, the business we work for doesn't really care for the tools we use most of the time - unless of course they are suppose to pay for it. But as simple as it is, If you know how the IDE you use works and how you can make it work the way you want, can make all the difference in your productivity. Here are some unimpressive hows:

1. Many mundane and stupefyingly boring tasks can be automated if your IDE supports macros or extensions. Learn it, it will relieve your back/wrist pain.

2. You may have some fun exploring a totally different software architecture than you may be writing day-to-day, this may turn out to be way too interesting than your day job. Learn it you will know how to design.

3. Sometimes your IDE is just used for a single purpose - coding, but If you know how to extend it you might be motivated to add some cool stuff to it like chat view next to problems view in Eclipse or may be rolling reddit RSS entries in status bar. Learn it, possibilities are never ending.

4. Integrate your IDE to reproduce bugs in your application. This is similar to 1 but different in the way it solves your problem, this may not always possible but worth a thought. I managed to write several plug ins for quickly reproducing bugs related to my application components. Learn it and you can quickly fix them.

5. You can devise custom metrics from your code like how many lines you delete everyday compared to how many you write. Learn it and you will get to know your weird programming habits.

6. You never know when you get in to alternative job market if you know your tools well. Tool developers are far less than application developers. So learn how your IDE works and you might end up earning more money than your own job pays.


All of these, among others I can't really word without beer, are from my own experience. Since Level 1 Human Programmer in 'M$-Land' I've been curious about the tools I use, right from Visual Studio Add-in to Eclipse plug-ins, it has been wonderfully interesting journey so far. Given a chance to speak and I would totally be interested in how Eclipse is architected and how Gel used to support extensions and how painful it used to be to debug Add-ins in Visual Studio 6.0. Boy, it is interesting!

Tuesday, February 12, 2008

State of Eclipse based Python Development Tools

For starters, Python Interpreter console isn't a bad place for trying hands on the language. But if you plan on building larger programs with it you will need a good development environment, There are plenty of integrated development environments for Python today. Most of them are freely available open source projects, some have specialized support for GUI building while some are general purpose.

Since I'm Eclipse platform zealot, the first one I used was PyDev, PyDev is excellent python tooling built on Eclipse platform. It builds on excellent Eclipse UI and non commercial version offers basic refactoring, integrated debugging, Jython integration, Unit testing and several regular features which most Eclipse based IDEs inherit.

When it comes to dynamic languages tooling, DLTK is one potential place to look for in Eclipse Ecosystem. From time to time I'm lurking around DLTK newsgroups as well as keeping an eye on things moving in codebase for Python IDE. As of today, Python support in DLTK isn't too bad but it's still not as good as other IDEs out there, although it's coming up slowly. Eclipse DLTK is one fantastic tooling idea, it is so cool to build IDE for dynamic languages that you might want to try your hands building one, have a look at the guide here.

Out of Eclipse ecosystem, Eric is an IDE which I got chance to try hands on so far. Although It doesn't look as refreshing as PyDev or Eclipse in general, but it's pretty decent IDE nevertheless. It has lot of features, so many of them that you will confuse yourself on where to start, Eric UI has to be the last thing to impress anyone. It primarily features syntax highlighting editor, refactoring tool, debugger, package diagram viewer, regex builder, integrated version control and Python shell among others. While I'm not sure if Netbeans has any rock solid plan to support Python as Eclipse DLTK but I came across JPyDbg which is cross-IDE (and one of it's kind) for Python development. JPyDbg is kind of inspiring idea and I'm wondering if cross-ide-platform plugins would be a good idea? but that deserves separate post.

I haven't mentioned JyDT etc. because they seem to be dying or not actively compatible with later Eclipse versions. I would keep posting on python tooling as I go along working more on it.

PS: DLTK, I'm watching you.

Monday, February 11, 2008

Climbing the Python hill

Finally I have started working on new year's resolution. As a part of it, I'm learning a dynamic language called Python.

There are several reasons why I'm a new Python convert. One of them is not because blogosphere keeps intimidating Java programmers that they are writing crap. And I've honest sympathy for those who hold the assumption that Java is dead and other strangling naive opinions like that.

I am rather going ahead with some mature opinion like programming in a language with different philosophy gives you another way of solving the same problem, And sometimes the other way is better or at least, it will bring out interesting techniques which can be useful in general. Since I have very limited experience writing sizable software using them, I am expecting a lot from dynamically typed languages, Python in particular.

Python has been particularly interesting to me because I am curious about it since academics. I've played with it in past but that was just a stab that didn't bleed my nerve. I have no hard feelings for Ruby (or "hoopla oriented" Rails), because I'm not a huge fan of Web applications - web applications are boring.

Python is actually fun to program, programming in Python is like kidding, no it's not as frightening as it's name implies. For example, Methods in Java you know? they can't be moved around with out puzzlers and pain. But in Python, methods are also treated as types, called function types, which you move around like variables - no wait believe me it's as simple as passing around variables. Look at the closure example below and tell me how difficult it is to understand?
x = lambda: a,b: a**b

x(10,12)

Like you do in a regular mathematical equation, assign an expression to a variable or symbol and bind that symbol with value as shorthand like this.
a = x(10,2) * x(6, 8) / x(10, 2)
Also, any method which is not using 'lambda; keyword is also treated in same way, no partiality. Other obvious thing to like about Python is - it forces correct indentation in source code, that makes Python program much more readable in a consistent style. No need for one thousand formatters and coding standards.

I'm not comparing Java with Python, that's not my Job. I'm just trying to realize that how apt it is to solve the same problem aptly in a different way.

Python community, like Python itself, looks great. It isn't impossible to realize that - hangout on Python google group sometime and you will know. I am glad that they are very accepting and responsive to the n00bs like me.

I have started with SQLAlchemy ORM and db api in general to learn python because I'm curious on how they play with tuples and all. Later on I'll write a bit of parser as I've heard Python has some neat and funky stuff for parsing.

And oh, I'm having little trouble getting out of Java shoes lately - hmm, there is nothing like private fields or methods. But I guess that's better than writing getter and setter for that private variable which does nothing but to add overhead for dynamic compiler of hotspot VM to inline it after 3000 iterations, gosh!! But hey, Python is missing the package convention or let me say it prefers configuration over convention here, __init__.py is not as intuitive, is it?

Wednesday, February 06, 2008

How to Auto Increment version (build id) with Ant

For those who are still stuck with manual ant builds, this tiny little tip will tell you how to auto increment the version number with each Ant build. Follow the steps:

1. Create a file say build.number (or change the name to one which gives you pride)
2. Add the following target to your build.xml file, change entry key to whatever you want the property name to be:
<target name="increment_teh_build_number">
<propertyfile file="build.number"
comment="Build Number for ANT. Edit not!">

<entry key="build.number" type="int"
operation=
"+"
default=
"1" />

</propertyfile>
</target>
3. Make sure this target is executed on successful build for example after 'test' target, Once this target is executed you can use property build.number where-ever you like in build.xml, For example,

<property name="app.version" value="${major.minor}.${build.number}" />

Hope that saves you some.