Affichage des articles dont le libellé est Java. Afficher tous les articles
Affichage des articles dont le libellé est Java. Afficher tous les articles

jeudi 14 août 2008

Java gives you pleasure...


Yesterday, I discovered again the pleasure of programming !
You know, when you enjoy spending your evening writing code and seeing your software building up ? This was lovely.

I guess I should give a word of explanation at this point. My first job involved writing project management tools in Java. I did it for 3 years. Now I am developping a data quality monitoring tool in C++.

I always considered C++ uglier than Java, old-fashion and unproductive. But, as a smart guy should do, I also tried to convince myself that was bad "a priori" and that I would change my mind if really working in C++.
I was f***** wrong !
C++ stinks. C++ is ugly. C++ makes you focus on the language instead of focusing on the core purpose of the software.

Coming back to yesterday's evening, I was looking for a simple Todo application ; something just a bit more convenient than a file text, where I could log the stuff I have to do for a project. Surprisingly, I couldn't find anything fitting my needs on the web. It was always too complicated. There are plenty of smart tools to manage issues or bugs, but I really wanted something which need no more than 1 minute to fill a new item.
Finally I decided to write my own tool. I am pretty sure this is a very common exercice in programming course and it would clearly be a very small task.

Here comes the interesting point. I hesitated between Java and C++ started listing my needs and how each of them would cope with it.

First point, I would need a gui proposing an editable table component. Java has one in the sdk, no problem with that. Moreover, I found in less than 2 minutes a free GUI builder for eclipse. What about C++ ? Well, nothing standard here. I have not much experience about that and would have to go through the documentation of several frameworks before finding what I need and understanding how to implement it.

Second point, I need to save the data. C++ sucks and I would have to spend time on that point whereas Java provides me with serialization. Of course, it would maybe take less than 30 minutes to write a basic serializer fitting my needs, but it took less than 2 minutes to do it in java...

Third point, if possible it would be nice to have the tool able to cope with new columns/fields for the Todo. In java I can use the introspection to look at the properties of the Todo and create the table accordingly. In C++ I guess there is a solution but I can't see it right now. No introspection for sure...

Last point, I want to write it fast and dirty, during a single evening if possible. I did it in java and it works. The code is far from perfect, but thanks to the nice IDE and the fact that I don't need any external lib, a few hours were enough. In C++, I can't believe it would have been as quick and stable as that, even for someone with several years of experience.

I know I am not fair with C++ because most of the reasons I didn't choose C++ were mostly related to my lack of experience. Anyway, when writing Java code I really enjoyed it and felt productive. No needs for any external library to solve trivial problem. No problems with those nasty pointers. Just a smooth development process.