Friday, May 29, 2009

Is there Dijkstra quote on Java programming?

After about seven years I got into some serious programming recently.  The last time I wrote programs that mattered, was in 2002 when I worked for a start-up in a Seattle suburb.  Considering that the start-up didn't really get started, I can't say my work  mattered much.  At that time, it was a lot of C++, ATL etc.  I was getting wide eyed on things like annotation based programming and continous integration when I heard about the work in progress at Microsoft. The source of information was my co-worker who had quit Microsoft to find his fortune in the start-up.

Fast forward to last month.  I landed in San Francisco as an "architect"  (implied meaning: architect who would give lectures and do diagrams and do nothing useful) to kickstart a project.  Circumstances forced me to get into programming in Java with Spring and all that good things Java world is proud of.

I usually abandon learning when I go through the environment setup pains.   It was different this time.  I got to a quick start thanks to Lenny and Denis who set up the basic things functioning.  With the support of a good framework, my code was reasonably bug free until a change request came, when I tried to patch up the code in the last minute introducing a few silly bugs.

The typical development time issues I faced were mainly due to my C++ experience and MS conventions.  I tend to not see the parenthesis at the end of an if statement.  The operator = has an altogether different meaning.  Little differences like these made the development interesting.

The boring challenge was to have all the spring configuration entries for prototypes and singletons defined properly.  You miss one or misspell one, the application fails to start.  From the time you complete typing the core code to the time you get it to run, there is a big lag - thanks to the spring configuration.

Though I wasn't hands on before this project, I was in touch with software development as a discipline and was glad to use tools like liquibase, splunk etc.  These standardized tools make a programmers life a lot easier as compared to our home-grown solution for DB script management and log analysis in 2002.  I should say life is good for Java developers.... but for one question.

Isn't the Java world taking MVC a bit too seriously?  In an interview, I got into an argument with the interviewer on this.  We both agreed on the need for separating out the data, business rule and presentation.  I was fine having a separate function to take care of presentation details.  The interviewer insisted on having a separate class for presentation.  To close the interview on a smooth note, I listed the options in separating out the business logic from presentation.

Looking at the way Java applications are being developed, I wonder what Dijkstra would have said.  Though we have crossed the LoC way of measuring  programmer productivity, to me Java community seems to love the complexity.  Look at the packages and their nestings; look at the number of classes and interfaces created even for a small problem. And mindless accessor methods - a syntactic nightmare that C# carefully avoided.

I see design patterns, most importantly MVC becoming a religion preventing any rational design decisions especially on smaller projects.  I used to deal with a lot of SMEs that had requirements for a few months of development efforts.  Java projects typically got issues arising out of the complexity where the developers placed logic and presentation at wrong places.  We could blame it on the lack of training for the developers.  As compared to that, PHP as a platform for small projects worked exceptionally well.  

Sometimes, it is hard to tell the customers that your religion won't work!

No comments: