Only Software matters

Experiences in software development

Why there is no standard for developing real modular web applications?

Posted by Patroklos Papapetrou on July 19, 2011


OSGI, SpringSource, Jboss Modules,J2EE and the list never ends.All these technologies promise to their end users/developers the same thing which is more or less java modular web applications(?). How many of us out there, though, have actually tried to develop a REAL modular software system in Java? How many of us have managed to get it done? You have probably noticed that I have capitalized the word real and this is not done accidentally. I shortly explain what I mean by the definition:”real modular java system”.

IMHO a REAL software module should be able to have parts for at least business logic, persistence, user interface and configuration. A software module, in an ideal scenario, should be able to be plugged-in and plugged-off easily in a running application without restarting it.  For example in a J2EE application server ( such as Jboss or GlassFish) the running application (core system) is a .war file. Some more modules (that contain parts mentioned above) of the core system are developed and packaged in separate jar files. These jar files shoule be deployed in the application server, integrated with the core system (by some extension points in business logic AND in User Interface ) without the need of re-deploying it. Can we do something like this?

Let’s see what related technologies suggest about it. I was a fan of JBoss Modules since their first steps, and after the recent latest release of JBoss AS I was looking forward to see them in action. To be honest JBoss modules provide a very simple and convenient way to define dependencies between modules. Oops!! Did I write “modules”? What kind of modules are these? They can include business logic, configuration, data model but what about user interface? Unfortunately nothing is mentioned about that and after a little research, I have found that the concept of modularity in JBoss modules does not include any user interface. What about OSGI? The most promising way of building moduar applications. OSGI is nowadays supported from many application servers and although its configuration looks like dinosaurs in the age of industrial revolution seems to be a very nice approach. Plenty of available services, a dozen of frameworks to use and of course no reference to any user interface capabilities. On the other hand there is vaadin that integrates(?) well with OSGI to build modular web applications, as the relevant article implies. I wonder if there is a real/productive modular enterprise application developed with OSGI and Vaadin. Spring is an independent framework by SpringSource which is currently the leader in developing java enterprise applications. Spring Dynamic Modules in conjuction with OSGI claim to be the most sophisticated way to build dynamic and modular web applications, but again I still feel that even Spring is not solving the problem I have raised. From my researching experience integration of the above technologies for a modular system is a hard task. Last but not least comes J2EE. The latest version of web and full profile specifications have transformed J2EE to a very powerful set of frameworks. JSF2 and CDI as well as with all the new features have dramatically increased its popularity among Java developers. When I read for the first time this article, I believed that finally I have found a standard solution for modular web applications.  Although each jar can contain all different parts: business logic with EJB and CDI , persistence with JPA and its implementations, configuration and user interface with JSF and its implementations ) according to this issue there is no way to handle jars with JSF components as a separate module. One more dissapointment. Modules in J2EE are supposed to be jars packaged in a single war. That was too close!! We have to wait, I guess, until the release of JSF 2.2 and some months later for support of the most well-known application servers.

Since there is no standard for building modular systems, many well-known projects, have developed their own module system based on one of the previous mentioned frameworks or from the scratch. Jenkins, Atlassian’s Jira and Sonar by SonarSource are all java based applications with a powerful module / plugin system. You develop your plugin (including user interface), following some guidelines and you deploy it as a single jar through a module/plugin manager. In most cases you need to restart the system but I think that this does not bother any administrator since you can easily increase the functionality of your software.

So my dilemma is still valid. Should I start building my own module / plugin system or should I wait for a standard to come and boost the developing of modular web applications worldwide? I wonder why this kind of standardization is not yet available and why we are obligated to try-catch-finally ( still without resources :-) ) among all these technologies and frameworks! Are we close to have a standard for developing real modular enterprise web applications or not?

Thanks for reading my thoughts and I am looking forward for your comments

About these ads

17 Responses to “Why there is no standard for developing real modular web applications?”

  1. Lincoln said

    http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-532

    That is only a single problem with JSF, but there are many ways around it. Nevertheless, I agree with you that ease of modularity can always be improved. I would go as far as to say that you shouldn’t use faces-config.xml for navigation, and should roll your own flow system for now. That’s basically the easy solution. http://ocpsoft.com/prettyfaces/ should make this easier since it brings all navigation logic into java :)

    • Hi Lincoln
      Thanks for reading and your comments!!
      We have tried to impelement a modular system and to be honest with the assistance of PrettyFaces. The truth is that the ONLY problem for real modularity ( modules in separate jars deployed outside of war ) is that J2EE and especially JSF cannot handle jars as a single module. The problem is ( as always ) classloading which is quite restricted in JSF2. Of course you can have all these jars included in .war file as well as the functionality of PrettyFaces :-)

  2. Chetann said

    Have a look at Sling at http://sling.apache.org/site/index.html. It enabled modular web application development and is based on OSGi. Allows you to package the business logic and ui in a single package

  3. Nicolas said

    Put it simple, there is no real need for most softwares. All this module/hot plug is marketing from tools vendor.

    How many time do you develop several UI or persistance layer for the same application? Hey stop I do not say how many time to do you develop several UI, let say a mobile and desktop one, or if you’ll have several datasources. No, how many time do you enconter the need to develop in house several implementation of something and use only one? So what we change every week? For the sake of it?

    Let imagine now you are a software vendor. You may provide a MySQL connector or a NoSQL connector. You may authenticate users using LDAP or provide an internal system. What do you really need? A JAVA interface, a factory that choose the right implementation depending of configuration. And because changing the DB from MySQL to Oracle don’t happens 3 times a day, that not a problem if you don’t provide a fancy module mechanism. Nobody really care. But the data migration project will cost a few man month at least anyway.

    Another application using the software? You don’t need modules, just use the public API. Problem solved.

    So basically. Storage is cheap. We can have all implementation in the class path anyway and choose the right one without doing nothing really special. Hot plug? We don’t need it. In fact we don’t even need several implementation of something for in house dev most of the time at all.

    My understanding is that this hot plug and module thing is seducing, it is easy to understand. This is like a car. You choose the small basic wheel or the big one. With added flexibility of changing them while driving without any downtime. Wow !! We must have that.

    What problem does it solve you can manage in simpler way? Not many. How much will it cost? More than you think. Will it work? In theory…

    • Hi Nicolas
      Thanks for reading and commenting. I like the parallelism with the car although I don’t agree with it for the simplest reason that you don’t develop a car you just manifactured in a factory. But even the car is composed of thousands of resuable parts integrated together to a single object :-) . Probably I will never have the need to change wheels in my car, while I am driving but you don’t expect 100% up-time from your car. You can live with it even if it’s broken. You can take park it and take a nap :-). You cannot do such things with software systems. The latter have to be more sophisticated ,clever easily customized for each customer :-). I agree that this modularity will surely help sales for but the real value will come to the customers and the developers themselves. It is much more easy to maintain and expand a modular system than a dinosaur – monolithic system :-).
      Kind Regards

  4. Nicholas,

    I feel there is still a need for modular web applications. But unfortunately, as the author mentions, it’s hard to achieve.
    Most of applications we use everyday are “modular”. The browser, IDE etc are modular. Why not the web applications we develop?
    When you use Hudson or Jira or Sonar, you extend the application’s functionality by installing additional “plugins” or “modules”. Isn’t that useful?
    With a modular web application, you can give more value to your customers. You can “sell” certain modules to some customers. And they can install it from within your application just like installing a Firefox plugin.
    We have OSGI, but as even Rod Johnson explains, it is unnecessarily complex and most applications don’t need it.
    If only the community comes out with some simple to use framework, it would be really great.
    Of the web frameworks I have worked with, I feel Wicket is best suited for modular development.

  5. Is Wicket + OSGI is what we need? – http://code.google.com/p/wicket-osgi-extension/

    • Hi James
      Thanks for reading and commenting. Wicket+OSGI seems to be an interesting approach. Although it is still inmature ( v.0.1. ) I think it is worthing a more detailed research and try :-)
      Wicket is a very stable and I think popular enough framework for web presentation. If the above “marriage” with OSGI works then probably it may be a solution. Time will show

  6. hi!

    I almost disagree with this article cause standard is what’s standard is called… i mean… JSF2 is a JEE6 standard… so that’s the standard way to develop modular web application… :)

    Moreover… what’s a module? i disagree to define a module like a hot-deployable plugin, a module is a part of an extensible framework… so, i would like to drop the hot-deployable plugin definition and focus with the ability to easily extend an application runtime, so, we can keep the plugin definition if we can consider WAR files as a packaging activity… once the WAR is in production, it’s always possible to add jars into it, and, with a good managed bean model, we can access dynamically every module

    We can also keep the modular approach to increase maintenability even before compiling… a modular workspace decreases developers pain while working, reducing time to deliver.

    I agree with you about the lack of a good framework to develop pluggable applications that support hot-deploy for its plugins (which are not modules…)

    by

  7. Thank you for sharing this post about the Web Development. This is very useful for Web Development Application Development. Thanks again :)

  8. Jason said

    What do you mean by user interface?

    • Hi Jason, thanks for reading the post.
      By user interface I mean the graphical user interface, what the end users actually gets in front of his/her screen.
      Regards

  9. To answer the question in the article title:
    Yes there is.

    It’s called Eclipse Application Platform.

    And you get not only web application, but also the desktop UI for free.

    • Born said

      u get crap for free – yes your right ;)

      currently I don’t see any good solution for this… you may have a look at spring-dm and the virgo server (it’s using equinox as a default osgi-framework… but nevertheless I think it’s the most valuable thing at the moment). Virgo has also a addon called snaps, which is great, when you want to compound your modules… osgi services on the other side are nice to develop using spring-dm which makes heavily use of dependency injection stuff.

      Unfortunately osgi is complex and makes some things very hard to achieve… things you wouldn’t expected before of course.

  10. I am a little bit late but here are my 2 cents:

    If you need a maximized uptime OSGi is the way to go. At our site we are developing the main system with Vaadin + OSGi and it works like a charm. Everything is split into its own bundle and installed separately and thus separately exchangeable and updateable. You got a new web app to install: just install the bundle and you are done. No restarting of anything. It is just there, accessible to the user. You need to upgrade an app? It is just a one-liner and you are done.

    And don’t let somebody try to fool you in saying that you don’t need any hot-deploy, that you always can restart the whole server. Totally BS.

    … and if OSGi is too complex for you to learn then quit the job. Software engineering is evolving. If you can’t keep up with it you’re out. Best example is IBM i a.k.a. AS400, especially the proprietary programming languages RPG and CL and the programmers using it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 628 other followers

%d bloggers like this: