Bringing the J2EE Cathedral to the Bazaar
Pages: 1, 2
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:
- Easily Maintainable
- Highly productive
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
- Gather data from your data sources declaratively.
- Compose the retrieved data into infosets declaratively.
- 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:
- Creating a new application involves a minimum of J2EE specifics but a number of XML-based declarations.
- Authentication/authorization is declarative for all transactions.
- Data can be gathered for that page without bringing J2EE into the picture, even though J2EE has supplied all the building blocks.
- Data can be transformed into the target format with any transformation that the programmer is comfortable with. It could be Java, Tags, or XSLT.
- The data representation for a page (the model part of the MVC) is efficient and complete.
- Data from a form can be saved in the database without invoking J2EE-related APIs (instead of declarative).
- Data is saved in a transactionally-secure manner by invoking business logic that is either in Java procedures or stored procedures. The invocation itself is declarative.
- Business logic in response to a request could be done using any language and not just Java. Could be stored procedures or another component- based framework if necessary.
- Data can be collected from any data source declaratively.
- Page production and processing is rapid.
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 http://18.104.22.168/aspire/ 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:
- Data is collected declaratively one time for the entire page. Pre-built components are used declaratively to gather data. The gathered data is an XML infoset.
- Data is transformed with your chosen transform (Tags, JSP, XSL).
- No Java coding is necessary to accomplish the first two points.
- Even when JSP is used, you are using JSP only as a pure transformational language and not as an OO language.
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: http://22.214.171.124/aspireCharts/demo.html
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.
Return to ONJava.com.