If you have too much free time, use Java.
Posted by Tomaj on December 25th, 2007 filed in UncategorizedNow, I am no superstar programmer, this I admit. However, I do believe I am fairly intelligent, and have a decent breadth of knowledge and ability when it comes not just to programming, but IT as a whole.
This weekend, I decided to spend a little time attempting to re-invent an intranet app I created using Java in Applet form, as opposed to the present PHP/Ajax solution. To provide a little background, the present application is basically an administrative tool which keeps track of computers & users. It presents several tables identifying e-mail accounts, Southware users, PCs, and the relationships of these various items to each other. For now, I use PHP5 with Smarty templating, and use XMLHttpRequest calls to update just certain portions of the page instead of reloading the whole thing each time you want to sort a table, or edit a field.
I am pretty pleasd with the solution thus far, however I like to experiment. Previously, I tried using Flex — and did OK until the point that I hit what I believe was a limitation of Flex itself, having to do with binding controls to the gridview and having changes propagate back to the control that the edit controls were bound to. So this time around, I said to myself “Hey, I took Java back in college and even did my senior project in that!”.
Can’t be too hard right? Taking some data, displaying it on a grid, edits, etc. Boy was I wrong!
CHALLENGE #1 — Finding a decent IDE
Good luck! I tried probably 5 different IDEs, and ditched them all for various reasons — mostly because they weren’t free. Finally I ended up with Netbeans, which I happened upon completely by accident, as I was browsing around Sun’s website. It’s actually a pretty nice IDE. It has several built in project templates, a drag & drop WYSIWYG designer, code completion, etc. This IDE also had a cool feature where you can easily set up a JDBC connection to several database servers, in my case PostgreSQL. I was able to connect, browse around the tables (however, you must have a primary key before any tables can be used!?), and bind the tables to various controls for example a list or a data grid. I had some problems with the IDE though — I had a tough time wrestling for control. It wouldn’t let me delete function declarations, variables, etc.. They were just simply a different shade of gray, and somehow untouchable.
CHALLENGE #2 — Getting anything done
Once I had finally gotten everything set up with my little project, I tried to compile it. UHOH it seems it couldn’t find javax.persistence. WTF is that you may ask? Well, apparently it’s necessary (at least with this IDE) to bind the database to the control. After another half an hour of searching, I resigned myself to having to download the enterprise edition of the SDK (100+ megs..) and then trying again. After that was finally done, I tried to run it again… It compiled, but now it was giving exceptions on start, and it STILL wouldn’t work..
CHALLENGE #3 — Debugging!
There may be a nice quick solution for this (if there is, please let me know). If you’re writing an applet you should be debugging in your browser right? Well if you do, then your browser will cache the Applet, and your subsequent rebuilds will not be represented.. I am using firefox, and to counter this, it is suggested you load up your Tools -> Java Console, and hit ‘x’ to clear the java cache.. So I did it. And did it again. And again and again. NO EFFECT! I discovered I had to exit firefox in its entirety after clearing the cache, then re-launching, and THEN it would show the new applet. SO, what kind of way to debug is that?? As I said above, i’m no superstar.. I like to code a little, then check it. Then code, then check. I just can’t work like that. Yes, you can run the program as a regular application then switch to be an applet, but then you have various security permissions issues which may come back to bite you if you’re not careful no?
The above may not seem particularly frustrating, but all of this came after several hours of playing around with SOAP. I had gotten one of the functions of my app set up via SOAP, and was going to test that with java. I was looking around the web, and all the samples I saw were horrible… They were hand-crafting the request XML, OR using some 3rd party framework to get the job done. I didn’t want to do either of those things, so eventually I gave up on SOAP, and that is when I tried the direct database connection.
In closing, those of you out there who are PROs at Java will read this and laugh — no problem there. What should be taken away from this though, is that while Java may be perfectly good once you immerse yourself in the intricacies, it is not for the faint of heart, and in the age of integration, polished languages & IDEs, it’s just not up to the hype.
One Response to “If you have too much free time, use Java.”
Leave a Comment
You must be logged in to post a comment.
January 9th, 2008 at 11:18 pm
Tomaj,
I have to mostly agree with you here. Had it not been for the other issues you probably would have been more successful in debugging your application in a way that did not require a manual cache clearing. However, I would have been mentally exhausted at that point.
Java is quite big at this point, and none of the IDEs have a low cost of entry.