Published on ONJava.com (http://www.onjava.com/)
 See this if you're having trouble printing code examples

Bringing the J2EE Cathedral to the Bazaar

by Satya Komatineni

While Sun is quite diligently planning, coordinating, and building infrastructure for building cathedrals around J2EE, Microsoft's .NET is poised to steal the marketplace and own the bazaar, as they did with VB and the component market in the client-server wars. We have some parallels to go by. While CORBA focused on rearing thoroughbreds, COM stole the market with a mule called VB.

The only way out of this quandary is to wake up and invite the J2EE cathedral to the bazaar. (Both words are used in a positive sense in this article.) I believe there is a lot at stake; not only for Sun and Java, but also for regular programmers like you and me. The potential of enabling programmers of all kinds to this work in this wonderful world of the Web is a prize worth contending for.

Skill Sets of the Bazaar

Web programming flourished even before Java entered the market space. CGI, Perl, PHP, and ColdFusion have dominated this space. Programmers are eager to build systems that are driven by relational databases. There are millions of programmers who understand the Web space very well and are looking for scalable and robust architectures. Here is a list of the kinds of APIs, tools, and facilities used in the Web bazaar on a daily basis, and a general description of the kind of developers who use these tools.

Development tools
Developers have been very productive with such tools as PHP, ColdFusion, and Crystal Reports, and know how to build Web sites that can do credit card processing and produce reports.

Some might know how to install simple databases and the basic administration of databases.

Data Modelling
Some might know about creating tables and their cross relationships.

Stored Procedures
A sophisticated user may also know about stored procedures, in databases that offer them.
Developer knows how to work with basic databases, such as Access, MySQL etc. Knows how to do basic SQL-related stuff.

Knows such concepts as Flash/SVG animation, etc.

Knows that the HTTP protocol is stateless and knows how to maintain sessions using such concepts as cookies and URL rewriting.

Knows what Web security means. Knows authentication, authorization, etc. Knows about SSL and certificates.

Knows how to do form processing, HTTP request headers, HTTP response headers, and such. Knows how to program CGI with Perl and other Unix programming tools.

Web Servers
Knows about Web servers, such as Apache. Knows how to set up Web sites and knows such concepts as virtual hosts, URLs, and URIs.

Some sophisticated users might even know XSLT to transform XML documents to HTML.

Knows JavaScript well enough to do form validation and form processing. Knows how to work with frames.

Knows style sheets to standardize the look and feel of HTML tools. Accustomed to using a productivity tool such as DreamWeaver or FrontPage to work with HTML pages.

Understands HTML syntax and knows the significance of each of the HTML tags.

The Cathedral

J2EE is an enterprise-level framework that can do a stellar job of providing solutions to the IT market space. The increasing levels of complexity of J2EE with each release meant that only IT departments with large budgets could make the most of J2EE. J2EE, without the right tools, is not approachable by a common programmer. Let us take a look at the series of things that a programmer has to know to effectively utilize J2EE:

Java programming language
Programmer needs to be familiar with server-side Java programming, which luckily is not the most difficult task. Complex things like threading are taken care of.

An implementation of the CGI protocol. With about four or five central classes and a handful of methods, this can be taught in a week.

A Java API allowing you to call databases. It appears simple, but to enginner systems, it takes a ton of experience to do well.

Java Server Pages. Paralleling ASP, this API is intended to simplify Servlets.

Introduced to further simplify JSP and improve MVC (model-view-controller). It hasn't really achieved the levels of programmer productivity expected so far.

An application server to exercise what you have learned so far.

Enterprise Java Beans (EJB)
The idea is that server-side components can relieve the programmer from threading and transactional issues.

Entity BeansM
An EJB standard where relational data can be represented as objects. Expected to relieve the programmer from the nuances of SQL and relational databases. It is in full debate whether the intended benefits of this approach have been fully realized.

Message beans
The transactional paradigm is extended to asynchronous messages. A great help to an IT-level programmer, but it does not carry the same significance for day-to-day Web programming needs. (In other words, not used in a bazaar setting.)

Other APIs
There are other API stacks that a Java programmer could take advantage of.

As a Java programming community, we are at best disingenuous when we propose: "Come on in, it is a piece of cake. Let us do Servlets, JDBC, JSP, and J2EE." To design good J2EE systems (with the existing J2EE infrastructure) you not only need good designers but good Java programmers. And good Java programmers don't come cheap. Companies end up spending lots of money to produce systems. It is not difficult to prove a 5x increase in cost from failure to realize this.

Related Reading

Java Enterprise in a Nutshell
By William Crawford, Jim Farley, David Flanagan

The question at hand is, how can you make J2EE accessible to your everyday programmer who is not steeped in Java experience? And "everyday programmer" is not a homogenous group. It includes database programmers, Unix system administrators, fresh college grads (both computer science majors and otherwise), and legacy programmers (transitioning from mainframe disciplines to Web-centric programming).

How can we take the J2EE infrastructure and make it palatable to this varied set of communities? The key is to distill the minimum they need know so that it can be taught in a matter of weeks as opposed to months and years. We should start out with teaching the bazaar skills first. The only complex skill set among the bazaar skills is database programming. If you already know database programming, you are already way ahead of the game. A database programmer knows the following important skills:

Similarly, Unix system admins have an inherent advantage as well. They usually know how to set up Web servers and are fully aware of URLs and CGI. The only skills they need to learn are a set of database skills.

For the other two categories, you have to teach both the Web programming skills and the database skills. This could be easily done in a couple of weeks. The next question is, how can we take J2EE and allow these programmers to be effective immediately?

The Mantra for Bringing the Cathedral to the Bazaar

A good tool should stay out of the way when it is being used. J2EE is no exception. J2EE middle tier should be completely hidden behind a declarative middle tier that allows programmers to directly work with their presentations, data, and business logic. This should be done in an architecturally controlled environment where the following properties are preserved:

The tool that brings the Cathedral to the Bazaar should be able work with a set of abstractions that are familiar in the Bazaar. For example, if you are able to make a SQL call and see its result in the confines of your database, it should be no more difficult to see the same results on a Web page. Moreover, you should be able to see that data as XML, HTML, or some other format. The mechanics of how this could be done are not that hard. The question is one of focus with the tool builders. What are they focusing on? Are they focusing on EJB-enabled IT or are they focusing on the mallable Web-based Bazaar? I believe the following tiers will help bringing J2EE closer to the masses.

Declarative Data Tier
  1. Gather data from your data sources declaratively.
  2. Compose the retrieved data into infosets declaratively.
This should help the ordinary programmer to retrieve data using a predefined set of components in a declarative fashion.

Declarative Navigational Tier
Allow navigation between pages declaratively, based on success code, error codes, and exceptions. This is not entirely different from the current Struts framework.

Horizontal Data Definition For a Page's Worth of Data
A data abstraction to suit the needs of a page. In a sense, the consumer-centric abstraction for data vs. the producer-centric data abstraction that we have today.

Declarative Transformational Tier
The ability of the programmer to pick any transformation that the programmer is comfortable with: JSP, XSLT, Tags, or your own.

Under such a tool you can expect the following:

Required Skills

One important question that we can quantitatively answer is this: if I were an experienced Bazaar programmer, what skills would I need to run my programs on a J2EE framework?

Here is the list of skill sets I foresee you would need:

You don't need AWT or Swing, just the basic syntax and regular procedural programming concepts like assignments, if-else, while, for, etc. And you'll need to know how to access objects. You can learn this in less than a week using the first edition of the Java book from the creators of the language.

Java Classpaths
The next thing you need is a complete understanding of the Java class paths and how they work.

JAR files
The next thing to know is how Java executable code is packaged as JAR files. Quite simple once you know it, but you will take some time getting used to it.

Very basic understanding of servlets and how to configure them under Tomcat. You only need to know how to configure them, not how to program them.
How to install and configure Tomcat. With some help, this is not a daunting task

Once a programmer is taught these basic skills, the declarative nature of the tool could allow these programmers to immediately integrate their skills to create a fairly complex database-driven Web application. As the business logic is allowed both in Java and non-Java paradigms, such a tool will allow the programmers to learn Java in a gradual fashion. The framework is responsible for the stability, transactions, and modifiability.

Can You Show Us What You are Talking About?

One can see a demo of some of these concepts explored at This demo is running using Tomcat 3.2.1 and a very low-powered PC. So, with a little patience, you should be able to see how a table worth of data is collected and presented as part of an HTML page. This should demonstrate the following basic facts:

Let me raise the bar a little bit. One might say, "Well, this is too simple." Let me show you another demonstration where the collected data is in fact presented as a set of graphs (pie, bar, etc.). Again, all of the charts you are seeing here are done declaratively and using no Java. And even where Java is used, it is only used as a transformational language (as JSP). Here is the Web link for it:


This article is born out of multiple questions from programmers that are new to Java server-side programming on how they can become effective J2EE programmers. The urgency of an answer became imminent as .NET is getting released to enthusiasm that it makes it extremely easy to write Web programs.

It can be extremely easy (fewer lines of code, less bugs, etc.), and cheap, in the J2EE realm as well. One doesn't have to abandon J2EE when simplicity and productivity is at stake. J2EE can be as productive, if not more, as .NET. But focus has to shift to the Bazaar commerce and not necessarily how to build better cathedrals.


Satya Komatineni is the CTO at Indent, Inc. and the author of Aspire, an open source web development RAD tool for J2EE/XML.

Return to ONJava.com.

Copyright © 2009 O'Reilly Media, Inc.