Wednesday, January 04, 2006

The Origins of a Web Application

I'm developing a new website from scratch. If you're a web programmer, you know this isn't just a folder of HTML files or CGI scripts anymore, that would be too easy. This is Java, and it's real frickin cool but really complicated. If I didn't have the experience I have, I wouldn't understand a lick of it, but thank God I do.

It's amazing the choices you have for each component of an application, and it's a total buzzkill to take the time to pick your programs and frameworks, because it takes time away from architecting.

For this project, the basic requirement is that there is a business process that needs persistence (thus an admin interface) with a publishing process (for in-progress work parallel to public delivery) and a public read-only interface for the data. Not brain surgery.

Here are the software and frameworks I've chosen for the project:

  • Java 5 - all programming logic
  • Struts Framework - application controller
  • Spring Framework - Dependency injection for chosen implementations
  • Hibernate 3 - persistence ORM
  • Mysql 5 - Database
  • Apache Commons - for all the utils I need that I shouldn't have to write
  • Tiles/JSP - presentation layer
  • JSTL - presentation logic
  • XHTML/CSS2.0/JavaScript - presentation implementation
  • Maven 2.0 - project management, building, packaging, deploying
  • Subversion - source control
  • Eclipse IDE - client IDE
  • Resin/Tomcat - servlet container (still weighing)

Unless you have an existing app with the stuff you want in it, getting to this point is sometimes unbearable. In my opinion you should never start coding unless you have a HelloWorld type example working with all the components talking properly to each other. Another solution is to have a starter app, and a great one is Appfuse.

Here are a list (in no order) of some of my design decisions:

Maven 2 over Ant (and over Maven 1.x) - I was never a huge fan of Ant, the build files were just to messy. THere was a lot of documentation on maven 1.X, but Maven 2.X seemed like the way to go. The initial project setup using creation based on ArcheTypes is liberating. There is also a good guide to getting started and also a Maven 2 Plugin which helps manage the POM and dependencies.

Struts over JSF - I have a lot of experience with Struts and although JSF might be the framework of the future, I just didn't have time to learn it

Mysql - with Hibernate3, the database is almost an afterthought. Mysql is proven and free. 'Nuff said.

Spring - Spring was new to me ...well, not new ... but i was using it previously without really knowing how it worked and how useful it really was. After reading the O'Reilly Developer's Notebook on it (in about 2 days), I'm a Spring disciple.

JSTL was chosen over velocity and struts tags just to go with something that seems like it has staying power and is tied into the core technologies. Also I like how there is the word "Standard" in the acronym =)

Tiles/JSP - This also had to do with the Struts decision, that if a better template system is available, I will upgrade to it in the future, but for now Tiles does what I want it to do. In my opinion, it is more difficult to configure when you have a lot of master templates, but what I've done to compensate for that is to make my designs simpler so that Tiles management is easier. Is that a compromise? I don't think so. Sometimes making something simpler for you to manager makes for a better user experience because the layout is more consistent.

CSS/XHTML - using complete separation of formatting between the XHTML and CSS. All HTML is contained within DIV tags with standard formatting. So far individual elements are not using the class attribute. To me, if you want to go the whole nine yards, using class attributes ties what's in your DIV tags to the CSS and when you have an application like mine where content editors will be entering simple HTML articles, you do not want to have them entering in class attributes. Most of the layouts are designed through amazing CSS tutorials such as the Floattutorial and CSS Zen Garden

Subversion - best version control system out there. I had a decision between using Subclipse (Subversion Plugin for Eclipse) or use TortoiseSVN with Windows Explorer and I chose to use Tortoise. I felt Subclipse was still a little buggy and it really made the Package Explorer view messy with the modified SVN icons.

You can see from all this description how much is really involved in setting up a software project. I know mine is also a drop in the bucket compared to large enterprise projects but for now I am the sole developer on a project, which I'm sure applies to a lot of developers out there.

I have a backlog of small solutions to all of these pieces mentioned above which I hopefully will knock off the queue for reference, but I wanted to set the foundation for the decisions to use a lot of these products, because, ya never know when you might switch and seeing these trends might cause someone some headaches in the future.