It started as a 5 minute exercise just to test my JavaFu. 2 weeks in and I'm gob smacked at how complicated this exercise has become. That exercise is ButtyMaster.
So what is the best way of dealing with this problem? Well, I'm a Java programmer, so my immediate reaction was to write a Java program, but what sort?
Do I write:
- Distributed Swing program that talks to a central database?
- A centralised web app with a database backend?
What login system do you use?
Should I use a portal tool?
Should I use struts / JSF?
Should I use EJBs / Hibernate / DAO
Should I go for Weblogic / JBoss / Tomcat?
Which database should I use?
Should I use a database?
Where should I base it?
Should I design for easy maintainability or speed of development?
Should I use AJAX?
Should I use HTML / XML / XHTML?
In the scheme of things this is a very simple application. All people need to do is login, add/ change / request a butty and then logout. The average use case should take less than 5 minutes to complete, and yet its turning into a monster. I guess that's the problem with Java web apps. Java forces you to ask these questions as it makes no assumptions for you. The whole language is designed to make you think about the security and concurrency issues associated with an application, that even on this low level, requires the coordination of some many interacting parts.
And in that respect I'm probably using a sledgehammer to crack a walnut. PHP would stop me from being able to make any of these decisions as I'd put all the code in the page. Of course, this is at the expense of ease if change later on in the process.
Perhaps I could create an Access front end to a PostgreSQL database and make that available on the company intranet. Certainly a strong contender, but that means that everyone needs to have Access and as I learnt on the Forklift project, Access makes a lot of things very easy, but other really important things almost impossible (it's also as reliable as a chocolate teapot).
So here I am with ButtyMaster the Java web app. I've designed the database, and now I'm looking to connect it to the app. Even this involves a lot of choices, the current one being do I use a pure JDBC 2.0 solution, or use SQL and JDBC 1.0, should I be building stored procedures, do I need to use DAO, if so should I use an interface? I keep telling myself that this is just a butty app, that really I don't need to worry about any of this, that premature optimization is the root of all evil: perhaps, the reality is, the problem is more complicated that I thought.