I am an ERP Project Manager for 7 years within a big company which has many subsidiary companies. As ERP team, we are not only implementing ERP software but also writing our own ERP with the target that we sell this product in the future. Our platform is Java and our applications are web-based. Ibrahim has posted 11 posts at DZone. View Full User Profile

Better Java Web Frameworks

01.29.2009
| 23909 views |
  • submit to reddit

I have been doing web application framework development for a long time. In my first experience, we developed a “Web Application Framework“, to ease development so that even a business user could write an application. As the years passed, I never saw any business user writing applications because of the fact that this job belongs to programmers. Today some 4GL or DSL tools are still on the search of the same promise. Before writing our own framework, we had used WebObjects development tools, for Java web development. It was a very good platform that allowed front-end GUI development from a GUI editor with a component model. Every web element can be used as a component and it had events like “clicked”, and click handler Java code can be added with double-click in GUI editor. One disadvantage was portability that you were bound to this platform and its Application Server. This model is similar with Visual Studio ASP.NET development environment that was presented years ago from the .Net emergence. Years later, JSF tries same model.

Web Application Frameworks meet the web application requirements. It is hard to define its border, but it should at least support a presentation layer. It may expand to a “Business Logic” layer or a data access layer. In Java, we have following technologies for web development; JSP, Servlet, JSF, EJB. There are many Java-based web frameworks: Struts, Spring(Spring MVC), GWT, WebWork, Tapestry, Apache Wicket etc.

The power of Java and richness of web technologies have produced many web frameworks (and that's not even considering internal frameworks). It is getting harder and harder to find a compatible development environment. Even some of vendors are pushing scripting languages for “Ease of Development”, another interesting move is “Cloud Computing”. I don’t favor scripting languages for enterprise web application development for “Ease of Development”. On the other hand, “Ease of Development” is a very important topic for programmers (this includes both “Ease of Testing” and ”Ease of Deployment”). “Ease of Development” is closely related with productivity. As development environment complexity increases, development becomes harder thus productivity decreases. Today, we witness low-productivity in many software projects. Low-productivity results in low quality and delays in projects. We need better, simpler and yet powerful web frameworks that truly understand web architecture and its requirements. It is very important to make value proposition of framework before accepting.

Choosing A Java Web Framework: A Comparison

Choosing a JVM Web Framework

The API Field of Dreams – Too Much Stuff! It’s Time to Reduce and Simplify APIs!

Rethinking JSF - The Real Problem

Criticisms of Spring, Struts, PHP, and Rails

Here are required features of a web framework according to our enterprise application development experience:

  1. Includes all core application layers (MVC)

    A web framework should include data access, business logic, controller and presentation layers internally. As frameworks turn out to be an integration hub, it loses value. Every integration among the core layers introduces new complexity, new glue code, new dependency, and conflict of intersecting features. If data access layer (Model) uses another framework, presentation layer (View) uses another framework, integrating these frameworks adds a very big challenge even if frameworks support each other.
    Replacing any framework causes many new problems later. For example, JPA is developed for data access independence but at this time you are limited only the features of JPA. IDE is a major development tool, but at this time we need an “Integrated Development Frameworks” environment within IDE. (Similar with ERPs that brought together enterprise applications under the same umbrella)
     
  2. Avoids heavy-componentization:
    In web architecture, desktop-like componentization is heavy and inflexible. Components in desktop applications were very successful. They utilized reusability and could be used in IDEs. In web applications, the component model doesn’t work at the same form. Efforts to convert HTML (+JavaScript) into component model will not be as successful. This is because HTML is dynamic (DHTML), works on client and is declarative (Declarative Programming).

    With heavy-components, we lose declarative programming to some degree. We lose “Web Graphics Designer” ability to edit web pages because of moving from design-time to run-time and moving structure information from HTML to programs (while losing HTML Editor functionality). A web editor’s favorite structure format is CSS files so what about CSS componentization?

    Another problem is architectural. A web GUI has 2 runtimes; server and client (Browser). In previous years, web frameworks supported only server-side functionality. Today we see client-side-only approach. I think best solution is balanced mixture of both client-side (JS) and server-side code with component templates (not hard components but light partial HTML+JSP+Servlet codes). I will discuss this further, there are already many discussions about “Component-based” versus “Action-based” frameworks on the web.

  3. No new tag markup or page template:
    Some web frameworks require learning a new markup with no added-value. Your form inputs turn out to be strange tags. Finally, developers don’t understand HTML, JavaScript, CSS because there is no time left for this learning. Who will fix GUI errors? Frameworks should bring a minimum or no new tags. Instead we may prefer attributes. HTML tags with simple JSP expressions are enough (KISS). Isolating developers from HTML and JavaScript is not possible.
  4. No XML usage:
    Heavy XML usage for configurations makes programs hard to develop, hard to understand, hard to test. One example is “Page Flow” information in XML files. Another example is bean configuration. Yes, pulling this information makes it flexible but who needs it? How many times does your page flow really change? How many times did we utilize flexible bean configuration? What about source code readability? I don’t like “Dependency” or  “Dependency Injection”. I think dependency is not free as you have to manage its subtleties. Here is my anti-pattern “Dependency Rejection”. XML can be used in other useful places like AJAX messages or data import-export.
  5. Has its own web GUI page elements:
    Rich web elements (say light components) are generally found only in JS or AJAX libraries. Web frameworks should provide rich elements like; Calendar, Dialog, Menu, Popup, Progress Bar, List, Grid, Tab (With sub-levels), Master-Detail Windows, Child Windows, Record Navigator etc. Developers can easily extend these elements. We are still turning around simple features like table sorting, filtering etc. We should step ahead. There is still no desktop-like web grid components to use (I see this only in JS libraries) that I mentioned in my previous blog post.
  6. Code generation:
    Code Generation makes “Rapid Development” possible. Every piece of software should be generated (Generative Programming); CRUD data access classes, business code, controller code, and view pages. Code generation takes development one step ahead of “Drag and Drop” WYSIWYG editors. If a web framework facilitates code generation, developers could jump to customization details of application instead of building everything from scratch (MDA).   
          
  7. Has its own GUI JavaScript library:
    Another bleeding integration point is JavaScript libraries. JavaScript libraries are not fully-integratable with web frameworks. They try to solve the problem on the client side. What we need is close cooperation with client-side and server-side. Unfortunately, most of the web frameworks have little or no JavaScript in their presentation layer.
  8. AJAX support (Asynchronous Communication):
    AJAX eliminates page-refreshes. Web frameworks should properly blend AJAX functionality into their code architecture. AJAX requires server-side coding. As we make client runtime powerful with AJAX, GUI state management code is duplicated. For example, if we update and fill a combo-box with AJAX call then server-side bean that is bound to this element is not aware of this state change. We have to change server-side state as well. AJAX functionality should be implemented without code duplication (Another interesting trend is AJAX MVC).
  9. Portable among application or database servers:
    Application and database portability is not easy. In Application Server side, class loader policies change, session management changes, deployment model changes etc. In DBMS side, join clauses change, paging, and sequence generating changes. Web frameworks should provide portable packages for different platforms. On the other hand, some web frameworks have their own IDE and Application Server (believe me even DBMS). I think we must leave this job to the famous products (IDEs and Application Servers in the market).
  10. Input validation:
    Data input validation is a very important feature. If validation doesn’t occur in an application, database errors occur. Database errors are not user-friendly. Some validation errors may not be related to database. Programmers need automatic validation according to database object metadata. Custom validations should be added if needed.
  11. Bug-free:
    Because of bugs in frameworks, all average developers become framework experts spending valuable time to figure out the problem. “Focusing on business problems” is lost. I have read many open source framework hacks and workarounds in many blogs, which is not the task of a developer.
  12. Handles exceptions in a user-friendly way:
    If error or exception occurs, user-friendly messages should be returned. Application programmers have some responsibility for this but web frameworks may ease this task.
  13. Eliminates double-click, double-submission problems:
    Double-click may cause double-submission. Double-submission may cause unexpected errors in application (2 threads trying to do same thing). Web frameworks can eliminate this problem even in client-side without going to server.
  14. Authentication and authorization support:
    User login (authentication) is still developed by programmers without knowledge of SQL-Injection attacks. Web application authorization is still missing. Who will be granted CRUD access on which application etc.?(User roles, permissions) I am sure that in every enterprise web application, application authentication and authorization is re-invented.
  15. Security controls for web attacks:
    Web frameworks should prevent web security attacks like; Cross-Site Scripting (XSS), SQL Injection, URL Manipulation, HTTP Injection, Session Hijacking etc. Web client data is un-trusted and open to tampering so this is why we can’t quit totally server-side validation for the sake of client-side validation.
  16. Reporting integration and barcode support:
    Reporting integration is important. We need reporting products/frameworks integration. Would you use your data access objects in your reports? Would your reporting engine use the same JVM runtime? Barcode is not a general requirement but in ERP applications it is very useful (AI/DC Automatic Identification/Data Capture). Barcode printing, barcode reading and matching may be provided by your web framework.(What about RFID?) Would your reporting product support barcode?
  17. Messaging and workflow integration:
    Web frameworks may support easy integration with messaging (JMS) and workflow products. Workflow is one of major element of BPM (Business Process Management). In some middleware stacks, this is included (i.e. JBoss Seam jBPM). Web application frameworks may support business events and workflow activities. These events can also be used to feed the messaging backbone (ESB).
  18. Application to application integration (i.e. Web Services):
    In Java, there is external system (EIS, legacy) integration API, which is JCA, but inter-application communication within same JVM is not standardized. Let’s say we have two applications and one should use some call to the other's application code. There is no standard for this. Basic solution is just adding other application’s path into its class-path and then using other application objects. We developed an Adapter API for standardization of this. In one-application environment, this is not a problem but if many applications are required to communicate, it gets more important. You can even convert your APIs into web services when necessary (integration with remote or non-Java systems). Web frameworks may provide tools for web services code generation, deployment and monitoring.
  19. Admin application for run-time process and user session monitoring:
    This is very important in the case of user and system management view. What are my users executing at the moment? Which applications take longer to finish? Which users are on-site? Which pages are they surfing? In each session, which objects are they created? What are the URLs that a user requested? Which SQL statement did a user execute?
  20. System resource management:
    If your application runs big queries that require a lot of system resources (CPU, RAM, DISK I/O), we are faced the reality that resources are limited. If applications don’t restrict user processes, then system will consume its all resources and will not respond to even small processes. For the sake of system availability some user may be rejected by system. The web framework may have such limitation API’s.
  21. Cluster support:
    When server load is high and performance is a major concern, load-balancing is required. Application server clustering will not suffice, web frameworks must support a cluster architecture. One simple example is framework’s id generators. They will collide in clustered Application Server environment.
  22. Multi-database, multi-company, multi-window, multi-session support:
    The application user may need to work on multiple database instances. One user may have to work with multiple companies. The user may want to use multiple GUI windows. Web framework should handle or prevent state corruption among windows. The user may need to work on the system with many sessions.
  23. Internationalization:
    If there are global users, then i18n support is important. One key aspect here is that the Application Server and DBMS should also support your localization.
  24. SSL support:
    If the web application is required to be secure in insecure networks, SSL-support is important. SSL deployment in an HTTP Server would not be enough. Even if SSL is not used, frameworks must encrypt sensitive data between client and server, like user passwords.
  25. Document attachment:
    In every enterprise application, document attachment is important. Users may want images or Excel documents attached to their application records. Every programmer first search for an upload utility then tries to understand server document folders. Instead, built-in functionality saves valuable time.
  26. Mobile device support (i.e. Internet Explorer Mobile):
    If we want to plan mobile access to our applications, how can we do this with web technologies? Many mobile devices have built-in web browsers and we may run our applications in these browsers. Web framework mobile support would be very beneficial at such cases. Otherwise, you should explore mobile web browser limitations by yourself.
  27. Portal features:
    Partial web components should be supported to use in Portals or external sites. In portal terminology, its name is portlet. There are many synonyms; Widget, Mashup etc.
  28. Scheduling:
    Application tasks may be batched and scheduled. After task completion, users may see results.
  29. Keyboard hot-keys:
    Users, especially old TUI (Text UI) users want keyboard hot-keys. Buttons, command icons should be bound to hot-keys. Web frameworks elements can support this instead of developing in every application.
  30. Alerts between users:
    Users may want to send messages to each other or system admin may want to send messages to users like notifying a shutdown or an application restart. This feature will be very handy.

Since this list is long enough, I had to skip the following features (plus non-functional features): email support, back button, page navigation, bookmarkability, post-get support, formatters/converters, page skins, context-sensitive helps, URL manipulation, caching, logging etc.

This feature list is application-centric. A web-site-centric feature list may have different items. In web development, these two camps (web-based application developers and web-site developers) are joined and have some conflicting requirements. Scripting languages (PHP, Ruby or Groovy) and RIA platforms (Flex, Silverlight or JavaFX) may be much more appropriate for web-site developers. This is a controversial issue and differentiates framework architecture. In this aspect, we say that some web frameworks are much more appropriate for web-site development and don’t fit into enterprise application development.

Another argument is “Web architecture is not appropriate for enterprise application development”. I think we have overcome the barriers of web architecture with many bright standard technologies thus making it a good application platform; Powerful Browsers, JavaScript, CSS, HTML(DHTML, XHTML), XML technologies, Web Services and finally AJAX meet the application platform requirements. Let’s make Web 3.0 possible.

References
Published at DZone with permission of its author, Ibrahim Levent. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Otengi Miloskov replied on Thu, 2009/01/29 - 9:04am

Openlazslo is a good tech for web site development, it supports flash or dhtml backends. I will say that Stripes framework is pretty good for web site development with Java can compete with PHP or Ruby or Python. Java is capable of anything great in the right hands, As they said with a great power comes big responsability and it is posible to do anything more than the scripting languages.

Guillaume Jeudy replied on Thu, 2009/01/29 - 9:15am

Seam anyone? It's not perfect but I believe its a few strides ahead of all the other offerings. Also check out Web Beans spec, if that becomes a reality it may very well be the next evolution in Web development.

David Lee replied on Thu, 2009/01/29 - 10:39am

Seam ?  No Thanks. 

This is list is a little unrealistic and almost no java web framework meets these requirements.  If there was one, it would be "the" framework and this framework debate would be over.

 

 

 

Guillaume Jeudy replied on Thu, 2009/01/29 - 11:32am

David,

I'm not saying Seam addresses all the requirements, I don't think we'll ever see a web framework adressing all the above listed requirements.

But more than anything I think Seam is a step in the right direction especially to address requirement #1. I could argue that it also addresses a majority of the listed requirements as well.

Isidoro Trevino replied on Thu, 2009/01/29 - 5:25pm

Well I think Grails might implement some (not all) of the features you mentioned, I think it is worth a try -> www.grails.org

 But yeah, a framework like that would be excellent

Raphael Valyi replied on Thu, 2009/01/29 - 8:41pm

Hi,

First of all, I practised Java for 5 years in various situations before and never dismissed from it. The thing is that my Company paid me more than 6 months to compare open source ERP's. IMHO no Java one was fitting the bill. Especially the Java ones were either too imature (say JFire), or based onvery old poor design, basically static servlets at best hooked with Oracle pl/SQL + ugly XML generation.

My extensive (120 pages) but polytically correct analyisis is available for free in French here:

http://www.smile.fr/publications/livres-blancs 

So I should say you really should give OpenERP a try  http://www.openerp.com/ . It's not as pretentious as some are, but it's just fucking well architectured. I really mean it's fucking awesome overall. Watch their community, people trying it tend to stick on it.

Of course it has a few catches, but it does most of what you require. The small company behind it had no priority in the marketting  stuff until now (but they will put a new site online within a week) but instead they focused on their product. It's really great after chossing it we have now satisfied customers and developpers. The popularity growth is just amazing. Right now they have around 120 parallel branches in their public VCS (Bazaar). The community is there and growing quickly, expanding overseas (and I found no credible alternative I should say).

They just released their doc in public, around 600 pages showcasing what they can do with their version 5 and I believe no other open source ERP can handle a third of it. It's available here: http://doc.openerp.com/

it's both the functionnal and developper doc.

They fit in nearly all your requirements (including barcode readers for instance), except may be the portlet thing. Still, they expose all their business methods + CRUD on XML/RPC so it's just too easy to remote it form any system in any language. Still, they have the gadget portal (REST) integration thing on their short term roadmap too.

Instead of being based on marketting driven bloatware,  OpenERP is based on a small framework ('OpenObject') that is less then 6Mb. That's the anti crapload and it does a lot actually. It has a correct ORM (with ORM cache+transactionnal database cache for computed functions)+an integrated BPM+an amazing module system allowing to extend any business object/view in a snap.

Their framework is showcased there:

http://www.openobject.com/index.php?option=com_content&task=view&id=30&Itemid=72

with integrated Business Intelligence showcased here:

http://www.openobject.com/index.php?option=com_content&task=view&id=48&Itemid=98

By the way, I'm just porting it on Jython (Java based interpreter, being actively supported by Sun), so we could benefit from Java multithreading, performance and good libraries. May be you get interrested in that.

Don't get it wrong, don't test their version 4.2 but their beta version 5 instead (final due withing a week). You'll really be amazed. If you have question you can contact us (smile.fr) or mail me at rvalyi-no-spam-thanks@gmail.com (without  -no-spam-thanks).

 

Finally OpenERP is driven by a small, very dynamic team. There is no catch, there aren't gonna sell you the world. They sale support but ALL their code is free real GPL code, they are just good guys.

 

Since I found it I prefered learning Python since it was obvious I wouldbe more productive faster that way than re-coding the world on a poor Java plateform. I mean Java as the JVM is really great (JRuby rocks so much). As a language it's okay, quite okay as a static langyuage but it's just not adapted to building an ERP with lots of functionnal requirements, my 360° study drive to that conclusion.

You have better to join me porting OpenERP on Jython to bring it JMS and other nice java lib integration rather than starting from scratch. Not all ERP's suck believe me.

 

Raphaël Valyi.

Jay Spring replied on Fri, 2009/01/30 - 12:03pm

asp.net + linq => that model in java would be nice

Tristan Bezotte replied on Fri, 2009/01/30 - 5:20pm in response to: Isidoro Trevino

+1 to Grails

EG replied on Sun, 2009/02/01 - 10:34pm

 

 

The Java Pattern Oriented Framework (Jt) meets a lot of the points in your criteria ( code generation, Ajax integration, Web Services,messaging, BPM integrations, etc.)

 

 http://freedom.lunarpages.com/Jt/

 

 -------------------------------------------------------------------------------

 

Jt - Java Pattern Oriented Framework (Jt 3.0)

Jt3.0 has been released. Jt is a pattern oriented framework for the rapid implementation of Java applications. Jt has been utilized in several large mission critical systems. Jt implements many well-known patterns including Data Access Objects (DAO), GoF design patterns and J2EE patterns.

Jt3.0 features several enhancements to the Jt components and a version of the Jt automated Wizard (JtWizard). The Jt Wizard is an application built on top of the Jt framework that provides automated capabilities for generating framework applications. The Jt Wizard is able to automatically generate application modules based on several design patterns including Jt Messaging, DAO, MVC and GoF. The current Jt Wizard implementation provides integration with MVC Struts and DAO Hibernate. DAO mapping files, Struts configurations files, Views (JSPs), Java classes are automatically built by the Jt Wizard. The Jt Wizard is also a reference web application implemented using the Jt framework.

The framework addresses the following goals and requirements:
A) The pattern oriented framework implements and facilitates the implementation of well-known design patterns like GoF design patterns and J2EE Design patterns. The framework itself is conceived and implemented based on design patterns (from the ground up). The framework facilitates and accelerates the implementation of applications based on design patterns.
B) The framework architecture is based on a messaging design pattern: framework objects are able to interchange information and perform computations by sending, receiving and processing messages. A messaging API provides strong encapsulation and loose coupling; framework components can be easily plugged into complex framework applications using a “lego/messaging” architecture. The framework takes full advantage of the power and simplicity of the messaging design pattern.
C) The framework lego/messaging architecture provides transparent access to remote components: remote framework objects is treated as local objects. Design patterns implemented by the framework (adapters, remote proxies and facades) make this posible by hiding the complexities associated with remote APIs.
D) The framework provides transparent integration with other technologies via framework adapters, proxies and the implementation of related design patterns. These technologies include BPM, DAO implementations, MVC implementations, EJBs, JMS, XML and Web Services.
E) The framework is designed to be lightweight and fast in terms of performance (low overhead).
F) The framework messaging/lego architecture should improve and simplify design/development efforts. There should be a tight correspondence between UML design diagrams and the framework messaging based applications and components needed for the implementation. Ideally, the framework provides wizards and automated capabilities for generating framework applications. Framework components should be easily added to BPM process diagrams. In future versions of the framework, it should be possible for applications to be generated directly from the UML design diagrams.
G) The framework messaging architecture facilitates testing and debugging efforts. The framework provides capabilities for testing components independently (each component as a unit) by sending messages and verifying the reply (output) messages.
H) In order to provide additional productivity benefits, the framework is integrated with open source IDEs.

 

Additional features include:

* Implemented J2EE design patterns include J2EE business delegate, J2EE Session Facade, J2EE Service Locator and J2EE Value Object.
* Web Services integration via the implementation of Web Services adapters and proxies. The Jt messaging API greatly simplifies the development and deployment of web services.
* Integration with business process modeling (BPM). A jBPM adapter is provided within the Jt framework. jBPM is an open source implementation of  the BPM technology. A Jt application can now be modeled using a process graph. This provides users with a very powerful way of modeling business processes.  
* Integration with the MVC (Model View Controller) design pattern and Ajax. Universal Jt components and adapters provide a transparent interface between the Jt framework API and these technologies. The business logic (controller piece) can be implemented using Jt framework components and/or BPM business processes.
* Integration with the Hibernate implementation of Data Access Objects (DAO). A Jt adapter provides a transparent interface between the Jt framework and Hibernate DAOs. A native Jt DAO implementation is also provided. Additional DAO strategies can be easily plugged in.
* JDBC integration via a JDBC adapter.
* The Command pattern implementation supports a request log, a queueing mechanism and undoable operations.
* JavaMail API integration via the implementation of a JavaMail adapter
* Integration with J2EE Enterprise Java Beans (EJBs) via Jt Adapters and proxies. EJB clients are able to gain transparent access to remote framework objects. No need to deal with the complexities of EJB application development. An implementation of the J2EE Service Locator pattern is also provided.   
* Easy customization of framework applications. This is done via resource files: object attributes can be automatically loaded from a resource file.
* Java Server Pages (JSP) integration.
* Integration with the XML APIs via XML adapters, helpers and built-in bean/XML mapping capabilities.
* Integration with the asynchronous Java Message Service (JMS). Jt messages can be sent and received via JMS adapters.
* Built-in logging/debugging capabilities. Messages between framework objects are automatically logged. This simplifies the debugging and testing tasks.
* Built-in  testing capabilities.
* Efficient and lightweight in terms of memory utilization.
* The framework can be easily extended by implementing additional Jt adapters and helpers.
* The Jt Framework provides a consistent way of handling and logging application messages, errors and exceptions.
* Proven technology. The Jt framework has been used for the development of several large enterprise applications.
* Cross-platform, implemented using JavaTM technology.
* Integration with the Eclipse environment.
* Runs on any J2EE compatible application server.

Leif Ashley replied on Sat, 2009/02/07 - 12:00pm

My 2 cents, and yes this is very cynical, SUN has done a horrible job with java. It started good at the beginning and dwindled ever since then. Everything is a spec that someone implements with varying "tweaks" and degrees of quality. JSF sounds good on the surface but in practice, it's a total pain in the ass compared to something like asp.net. Same is true with other frameworks like seam, etc. To do x in one framework could take 5 times as much effort to do it in a more "rhobust" one.

It just seems like my job is harder with ever new framework promising to make the development process work like a well oiled machine. One is either too simple or another too complex for the task at hand. I do find it both amusing and interesting that all of you here, my friends, and I have these same feeling on java dev.

There's no one size fits all approach any more. We've all become experts at making square pegs fit into round holes.

Jarred Haley replied on Wed, 2009/05/06 - 2:08am

We saw many frameworks and eventually went with http://code.google.com/p/startsoft/ a combination of Struts 2.1, Spring and Hibernate.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.