Want Some Guice? Yes Please..

I don’t know if you guys ever watch the Google IO presentations but if you don’t you should because sometimes you find a gem. Guice is one of those gems. Guice is a lightweight Java dependency injection framework (not another one I hear you cry) but it does look very interesting. Take a look at the video if you have time.

Those of you that read this blog regularly will know that I have been moaning about Java web development for a while because it takes more time setting stuff up than it does actually coding the thing and it puts me off. I have been threatening the world that I would be working on my own framework but I now may not have to because Guice actually seems to have most of the things that I was looking for. I am going to take a further look and see if their are any more cool things or any concerns.

It fits well with the new Java app engine api as you would expect and the very cool thing I liked is GWT with GIN that can actually compile your modules/injections to Javascript so that they can be used to write the client side interface. I found that rather cool. There are a few pieces missing such as the ability to compile down method injections but in the video they confirmed this is coming soon. I now think that the app engine has finally reached the stage where I would be interested in releasing apps onto it and would recommend it to others. Yeah there are plenty of concerns about data privacy but the same can be said with any cloud environment and especially one that is hosted in the USA. As far as I see it, as long as your app is not storing data critical to national safety I don’t see a problem :)

So, I am currently setting it up, will write an app, release it onto the app engine and write something about it here with any insights I may have.

Java Rocks (and Sucks)

I have been helping out a friend by creating some software for a business that he is starting. Once again I have been going through the process of choosing a suitable platform but, to be honest I wish I hadn’t bothered now. I had been trying to convince myself to use Java because I love it – mainly because it is ace, has the potential to rock and because I know it best (perhaps the last one is more of an objective reason). So why is it that I have not yet used it for any of my own web projects? Developing Java web apps? Because I think it is just too much hassle to get going. There is so much stuff to setup even before you actually start coding it puts me off every time. I want to be able to get going immediately with what’s in my head. The last time I gave Java a chance I got that bored after having set everything up and learning what everything was that I gave up with the project pretty much soon after. I just keep wishing that someone would start a Java framework/platform from the ground up that is not based on JEE (well perhaps just some of the best bits). There are no reasons why Java could not have a framework that would trample all over Rails/Django or in the very least be as enjoyable.

It is worth noting though that if I were writing software that was ultimately critical (such as banking software etc) I would not use anything else (.Net would be suitable but it would take a while for me to get to the same level of experience) because this is where all that configuration and power makes sense and allows applications to scale easily, allowing disparate groups from different locations to easily work on the software. The sheer amount of professional tools available for Java projects is also amazing and I have gotten so use to some of them that when writing in another language I miss them. Eclipse is a god send (Netbeans is not too shabby either) and I miss it greatly when working in other languages. This even includes when an eclipse plugin is available to use. They are just never as polished as the standard Java editor, even though a lot of them are very good (so don’t take this as some sort of insult).

Let’s face it, in reality most web applications that you work on these days are relatively simple in nature. Usually you are taking information -> processing -> displaying in some simple fashion. For this kind of use why would you need to be running a JEE server + Spring + Framework(struts et al) + ….. ? Let’s face it, most companies ditch the full stack servers and go with a plain servlet engine (tomcat). For most projects it always seems like an overkill. I would prefer to see a very simple (but production capable) web server that is capable of running a variety of simple but powerful frameworks that adhere to some standard (like WSGI on python) all written in Java. I think this would increase the use of Java in the web space by a huge amount. Companies that trust Java would choose it over buzz word frameworks any day of the week and for good reason as well.

By the way, all this moaning does not mean that I am saying that any of the other languages or frameworks are rubbish. Quite contrary actually because they have managed to fill this gap that Java could have so easily filled years ago. In the end I decided to use RoR for my friends business just because I could start work on it immediately and show him results. Everyone seems happy with that. For the kind of app it is, it will never go crazy and need to scale like your facebook or twitter so that’s one less thing to worry about. The application has already been designed so that nothing is shared from the beginning allowing requests to be forwarded to any server providing enough scale for what it will be used for. Using RoR (would be the same with Django) I have managed to get the main application skeleton (different users, authentication, signups with verification/states/file upload, admin sections and much more) up and running within a week of working in my spare time. The last time I tried using Java it took this long just to get up and running.

Some of you might be shouting that it could be that I am lacking experience developing Java web apps, and you would be both right and wrong. I develop software for Java web applications all day long but, they have already been setup and I just add new functionality and fix bugs etc. But why is it that my most experience is with Java but I find it tiresome developing web apps for it? Yet I had no Ruby/Python experience at the time but found the whole experience developing with Rails/Django a much easier and enjoyable experience??

So what does all this mean?? Well if anybody is perhaps interested in rectifying this situation and working on a Java open source web server and framework then leave a comment expressing your interest. If we can get enough people interested (I am guessing about 3-4 people to start with) we might as well go ahead and do it ourselves. It would be interesting, we will learn loads and it will finally shut me up moaning about Java frameworks all the time.

Custom Java Web Framework

I mentioned a while back that I had the beginnings of a new web framework in Java, and I have managed to get a little bit more work done on it since then. It’s still not ready to launch anything but as soon as it is I will host it on my machine and let you take a look. I have always been a great believer in not reinventing the wheel, so you might be asking “why the heck have you done this then?” and the answer is I never intended to do it. I started playing one day, and then started playing some more, adding this and that until it turned into a mini project.

Read more »