Skip to main content

Dive into Java

Recently a friend of mine asked me to help him develop a small web application to be run on a tomcat server. So that would mean I have to develop the application using Java, which I have not used ever since my student days. But because the requirements were pretty small, I took up the challenge just for the opportunity to learn something new.

The system was meant to capture the answers of a questionnaire and calculate the score they got. Then display back the past scores. It's pretty small involving just CRUD and a small amount of business logic to calculate the scores. Could probably be done in a bit over an hour if using tools I'm already familiar with like CakePHP or Django. But with Java, it was a completely different story.

My experience with CakePHP when developing MyMeeting made me quite reluctant to ever not use a framework ever again. Unless it's just a small trial program to understand a new language, it's better to use a framework. In the framework usually there is already quite a lot of thought put into how things should be organised and what's the best way to achieve our goals. So you get the benefit of quite a lot of wisdom without having to go through acquiring it. So that was the first thing I did. I googled for a 'java framework' and BOOM. Despair. There was tons of them. So many I had no idea what to choose. So I started to search for reviews and comparisons. You basically can't read about Java framework without struts being mentioned. Tapestry was pretty popular too. But they all seemed to have quite a high learning curve and you read a lot about the DREAD of configuring xml files and all. Finally I tumbled on wicket. Reading reviews and presentations about it got me pretty excited. And when I started developing I realised this framework is just for the UI. It made it pretty easy to do quite ajaxy stuff, but there's nothing about database connection and stuff. And there was no tutorial on how to get CRUD even. So after more googling I finally found Databinder. It is basically using Wicket as UI framework and either Hibernate, ActiveObjects or Cayenne for the database abstraction and interaction. Alhamdullillah. With plenty of examples to copy and paste from (hey, I didn't have a lot of time okeh.. :P) , I was finally able to get simple CRUD working.

Of course by then I met with a lot of the things which made programming in Java a pain. The dependencies, all the declaration, putting in setters and getters for almost every variable. UGH!!!! But in the examples they showed how to set up your project to easily work in Eclipse. And I followed it. And now I understand why Java developers swear by their Eclipse IDE. It's way freaking cool. I mean want to put in all the setters and getters for every variable even though you've got around 50 of them? Forget about typing it, how about just right clicking on the file and choose 'source->generate getters and setters' and it will all be done for you. How cool is that? What's it? You just copied from one file to another a bunch of lines which declared types you've got to import? No problem. Eclipse will automatically copy the imports too if it's already resolved. It's way seriously cool. If only it had vim keybinding.. :P

Anyhow. That took most of my weekends recently but it was very well worth it. I'm not 100% comfortable with it yet, but at least now I can do dev in Java. And if someone was to read my resume and ask me do I know Java I won't have to answer 'Well.. I did a few assignments with it when I was a student'... :P So now the only languages I'd really really like to have a serious go at it is ruby (probably with Rails) and Lisp. Maybe the opportunity would present itself in the future. In the mean time, I still got to polish my Java-fu.

Comments

Popular posts from this blog

Food first post

My blogs' name is High-Tech Rojak but I don't recall ever talking about food. So here's a first. Just recently I got some free time and finally got to cook the pasta I've bought for ages. So here's an account of how it went down.. :) Okay. That's the thing I cooked. I have no idea what it's called. At first I was thinking of buying the ribbon ones, then my wife looked at the colorful spiral ones and said "why not get these? they're more colorful" and so we got them (yes, we know nothing about pasta.. :) So I boiled it, actually put some salt and oil into the water so that they won't stick, drained it and tadaaaaa, you'd get the above. I remember once I tried to cook macaroni and I didn't drain it after boiling it, it filled up the whole pot. LOL... Learned my lesson. Next up the sauce. Like I said we don't know anything about pasta so here's the ingredients we prepared. Yes ladies and gentleman. Instant pasta sauce all bottl

Documentation is a must... after this.

I've been thinking quite a bit about documentation and the 'cost' it involves. And when I say documentation, I mean documentation in general about anything. One obvious case with the industry I'm involved in is user documentation (a.k.a The Manual). Creating great features in software takes time and effort but if it is not documented then the user won't even know about it and finally it never gets used. But then while documenting it you just wish that you're working on the next cool thing rather than have to write this up. So finally you end up not doing the documentation or doing it rather badly. Same thing with this blog writing. I have been doing some pretty interesting things with my phone (rooting it and using cynogenmod and all), some pretty significant life changes (my grandmother passed away) and a lot of other things which I should probably like to remember better or reflect more on it but not documented (here or anywhere permanent) and it would probabl

The Future Of Gaming

I love playing computer games. It's what originally drove me to learn computer programming, I wanted to create my own games. Until now I still have very little success with that, but... I have learnt to program web applications quite well and earning my pay using those skills. And I love open source software. Ever since I started programming professionally, my main work OS has always been Linux (various distributions and all and currently on Arch Linux). I always install dual-boot because... hardware problems (some projectors and printers just couldn't be detected by Linux when I started out, that's mostly not a problem now) and mainly to play games (sure there was some open source games available, but apart from "Battle for Wesnoth" and "FreeCiv" I don't actually recall any games I've played extensively enough to be remembered). But recently the gaming scene in LinuxLand has improved tremendously, partly thanks to the Windows 8 app store like