- Written by
Bernie
- Posted July 20, 2007 at 2:18 am
OK, straight up I’ll admit I’m on rant mode. I’m tired, overworked and probably a little bit stressed. But that won’t stop me from blogging. Here’s some context - I’ve been very busy with a project lately, more than usual, because the roll-out date has passed but instead of wrapping up and celebrating, we’re just starting User Acceptance Tests. Bummer. But enough of that. What I like to share is the (painful) experience of a team lead, just pre-UAT.
- Integration is painful. OK, I know, this really isn’t some secret but no matter how much I try to minimize this, it never fails to surprise me. I’ve had problems with Weblogic, Oracle, XA JDBC drivers, even software libraries (log4j and MyFaces if you must know). I made sure we had a running build on local machines but made the ultimate mistake of not using the same application servers. Well actually, we just ran an oh-so popular Servlet container on dev machines (all under-powered laptops btw) while the production server was running Weblogic 9. I was totally caught off-guard when doing integration work to our staging server which also ran Weblogic. I’ll save you the horror stories though. Safe to say that next time, yours truly will start integrating work ASAP as in the 1st week of coding on an environment mirroring the production’s. It’s better to have a continuous integration than during a pre-SIT/UAT phase.
- Deployment & packaging is painful. The problem not only lies in figuring out where to place the compiled source, libraries and configuration files but also what type of archive to place them in. Oh, I’ve had the joy of deploying 1 EAR, which contained a WAR, an EJB (with a few Message Drive Beans in it) and a core application library which all needed to share logging and Spring configuration as well a plethora of 3rd party libraries. Absolutely lovely. I spent a whole weekend figuring out where to put what. I have to admit that in the end it was pretty simple but it was a terrible experience trying to start.
- Logging is absolutely crucial, and yeah, it’s painful to get it right. I don’t know if it’s just me not understanding log4j or a configuration problem but I seem to never get it right. The requirement is pretty simple, have an catch-all log file, a catch-all ERROR log file, and some other log files for important components. But I somehow ended up having jumbled up entries in the ERROR log file. I’ve also had issues with configuration but that was solved when I repackaged my EAR. Some errors were also solved by making sure the correct lo4j logger instance was being obtained (copy-paste style programming being the culprit here). Also, I’m always surprised at how so many junior developers think of logging as an after-thought. This coupled with a terrible way of handling Exceptions (which btw is why I’m still up so late), ends up in totally meaningless logging. It’s too common to see too many throws and watering down of Exceptions until all the context information have been lost. So now I have log files which has some mixed up entries, with meaningless information. Great.
- A solid, extensible framework is very crucial to development. Even though I was overseeing just one project, the project itself is split into two smaller projects. A front-end project which is a web based project which ran on JSF-Hibernate-Spring. The other was the back-end project which was a lot of Java classes, a couple of MDBs, some simple servlets doing batch processing. For persistence it used Hibernate as well. The front-end project was pretty well structured, a framework was thoroughly discussed and agreed upon among all the developers before work began. Build files, directory, packaging, architecture, everything under the sun was laid out. Sure we had issues along the way but overall development work was smooth. The back-end project however, was total chaos. An all too often and common excuse given by the person in charge was “I’ll do this later, have to figure out this programming problem first”. Two weeks before the project goes rolls out, I took a look at the codes and almost had a heart attack. The whole thing was thrown away the next working day. I was pretty sure that had that project gone into production with that set of codes, it wouldn’t survive one day. And it wouldn’t be maintainable. Actually, now I’m pretty sure it will also never get deployed in the first place because no one can figure out how to package it short of throwing all the junk together and hoping it’d some how stick together. Now, 2 weeks later (after long hours and working weekends), the back-end project is 95% up and running. The initial development time took 5 weeks. I had a few excellent pair of hands helping but the same pair of hands struggled with the earlier version of the project. I like to think that the clean-cut architecture as well as the easy deployment (which facilitates fast testing) helped shortened coding time.
Another discovery worth mentioning is that Spring is absolutely the most brilliant piece of work I’ve ever seen in the sea of frameworks. Anyone that does any sort of large Java project should seriously check it out. You will not regret it. The best thing about Spring is that it actually enforces a style of coding that follows best practices (very layered architecture for example Services and DAOs can be clearly defined). It also provides a very easy way to handle cross-cutting concerns via AOP. I’ve managed to implement a very smart way of doing auditing, one which requires very little coding on the audited objects by using AOP. The non-intrusive nature of AOP is important here because relying on developers to do auditing will usually result in no auditing at all. Last but not least, Spring can be very useful because it provides utility classes for almost all the other frameworks or libraries - Quartz for scheduling, JMS for distributed messaging, JNDI templates, Hibernate templates, etc. And best thing of all is that learning how to configure these things takes 1 to 2 days at most. Usually you’ll get something running in a few hours. But I think the ultimate satisfaction from using Spring is the beautiful code that results from it. You’re rid of all the boiler plate codes and everything is so configurable with zero code change. Heck I moved from a local JDBC datasource to a JNDI without making a single code change. I enforced Transactions without code change. Then I enforced distributed Transactions via JTA without code change. I put in a scheduler, again, without code change. Well, you get my point. Magic? Nope, just Spring
I truly believe that because I decided to use Spring, the current project I’m working on has been developed much faster, is much more robust and will be easier to extend and maintain in the future. By the way, there’s Spring for .NET as well.
OK, that’s it, time to get some shut-eye.