Building Better Software

10
Jul

I posted a week or so ago about my solidifying realization that Java is no longer (if it ever was) one of the better languages for building web-apps.

The original article, Why Are There So Many Java Web Frameworks? can be found here.

One of the points made in that article was that as you mix different frameworks into an application you end up having to tweak or work around attributes of each framework that aren’t compatible with, or are undermined by features of another app.

For example …

A really good example of this, and the one that impacts me the most right now is probably how Spring and the hot-deploy capabilities of Tomcat interact.

When Tomcat reloads a class after the source file is changed, it dumps/clears the web context and reloads or rebuilds it. This is typical for the various application servers I’ve worked with (including Jetty, WebLogic and others). When Spring is being used, the context dump also dumps the Spring context, meaning that all of the beans that Spring manages need to be reloaded. Yuck!

Spring does have a refresh method which may avert some of the greediness of this process. I’ve never been able to implement it though because I don’t usually have control over the dispatcher servlet because I’m using Struts! This is yet another example of how frameworks compound application complexity when used together.

The net result for me is this. On an application with 3164 classes and 405 beans managed by Spring it takes me 63 seconds for the hot-deploy mechanism to pick up my changes.

So, in Java:

  • I forgot a semicolon: Add a semi-colon, wait 63 seconds, refresh the screen in my browser.
  • I need to change business logic: Change business logic, wait 63 seconds, refresh the screen in my browser.
  • I need to tweak formatting: Tweak formatting, wait 63 seconds, refresh the screen in my browser.

Ugh!

In any interpreted language:

  • Do anything. Inhale, refresh the screen in my browser, exhale, see the modified code in action.

The dream

Here’s what’s great about Java.

  1. It runs everywhere.
  2. There are an almost infinite number of libraries, tools (including IDEs) and frameworks available.

If you read almost any Java blog or talk to any junior to mid-level Java developer they’ll cite those two attributes as reasons why Java is so wonderful. There may be other reasons in addition. But you’re almost guaranteed to hear those two. Oh, you may also hear “It’s so much better than C++”. Who’s writes web apps in C++ though?

In my experience …

Unfortunately however, that’s not the whole story. If you start asking around, talking to Java developers with more experience, and particularly those who’ve worked in other language environments, particularly using interpreted languages, you’ll start to fill in more of the picture.

  1. Application servers start to get more and more difficult to deal with during development as the size of the application increases. So, by the time I get to take advantage of all of the support for “enterprise-level” applications that Java promised, I’ve discovered more than enough difficulties to offset what I thought I would gain.
  2. I’ve worked with dozens to hundreds of frameworks over the years. Every framework solves (or at least claims to solve) a problem. Unfortunately though, for every problem it solves, it creates 2 new ones. Sometimes I have to deal with them. Sometimes I don’t. When I do have to deal with them it’s usually twice as hard to solve the new problems as it would have been to just deal with the original problem that the framework solved.
  3. I get bored and lose a lot of time and focus while waiting for my darned application server to redeploy 50 times a day. Fortunately though this leaves me a lot of time to check the news on CNN and see what’s new on YouTube.
  4. Spring proxying is fantastic in terms of delivering a real platform for modular, pluggable, SOAs (Service Oriented Architectures). But it broke my debugger! My stack traces are full of references to proxies that I can’t pull up in my IDE. I have to know where the exception is occurring before I can figured out where to look to find the problem.

I could go on. But you get the point.

So have at it!

Live and let live I say. If you’re happy with your development life-cycle, the speed at which you develop applications and the tools available to make you more productive I’m truly happy for you. I would, however encourage you to look further afield. Try using some different languages. Try NOT using frameworks and just deal with the problems that the Java fundamentals (things like Servlets and JDBC as opposed to component-based UIs based on markup and ORM (object relational modeling) tools. You’ll be surprised how much faster your applications are. Whatever you think you’ll gain most likely won’t be worth the complexity and learning curve to attain it.

And lastly, if you’re a framework developer, keep it up! There may be a killer app out there that will boost Java past the yuckiness I’ve described. And you may be just the right guy to discover and/or develop it.

A final clarification

Just as a final clarification, lest you think that I’m a Java hater, I’m not saying that Java is bad. I’m just saying that it’s not the best tool, or even the best starting point for building applications for the web.

I feel that a lot of businesses have felt the need to embrace “enterprisey” platforms. At the same time, they’ve felt the need to embrace an increasingly web-based delivery model and Java has catered to that crowd. Businesses have embraced Java mostly because there weren’t any better alternatives, and or they didn’t have enough experience and knowledge about Java to be discerning or find alternatives. That is to say that there weren’t other platforms that catered to the crowd interested in “enterprise-scale web applications” to the degree that Java and Sun did. So Java was a safe choice for managers and developers starting out and looking for a technology to use as the basis for their career.

My thoughts in this article are intended to encourage IT managers and developers to look outside of the vast confines (isn’t that an oxy-moron?) of the Java landscape and consider options and alternatives for enterprise-scale computing platforms. It’s become simpler and simpler to achieve scalability (one of the biggest demands from the “enterprise” crowd) since Java became King of the Enterprise. And I think it’s time for businesses, particularly IT managers and senior/lead/principal developers and engineers to build on a platform of simpler, more nimble technologies to meet ever increasing demands for agility in the marketplace.

Category : Building Better Software | Java | Software for the Web | Blog
20
Jun

Every day it seems I read an announcement of the release of a new Java framework, or an upgrade release for an older framework.

Three facts should tip you off to a problem with using Java for web projects:

  1. There are a lot of Java frameworks for building web-apps.
  2. Many of these frameworks try to solve the same set of problems.
  3. Many frameworks are built just to improve upon weaknesses in other frameworks.

The third point causes the most concern. If every framework needs yet another framework to make it complete, then you’re never going to end up with a complete solution. You’re going to be passing the buck endlessly, and forever looking for a solution to your immediate problem.

Next question is, why are there so many of them? Surely if someone could build the perfect Java framework for building web-apps someone would have over the last ten years.

This leads me to think that:

“You can only put so much lipstick on a pig.”

Java is just the wrong tool for building web-apps. Scripting languages are far superior. The main reason for this is the statically compiled nature of Java. Interpreted languages will give you a much faster and continuous development cycle.

I welcome your comments on this topic. If you think I’m wrong, show me how and why. In particular, tell me what combinations of frameworks work best for you.

Category : Building Better Software | Java | Software for the Web | Blog