Last week I whined about a Python-based object-oriented Web application development environment called Zope. Zope has enough obvious potential that I'll keep working with it until I've learned it well enough to decide if I really love it or hate it. But right now I prefer the Java-based development environment called Lutris Enhydra (www.enhydra.org). For some people the contest between Zope and Enhydra comes down to Python vs. Java.
Python fans tend to hate Java, and vice versa. Not so with me. I happen to like both very much, although I have a slight preference for Python. Nevertheless, if you're familiar with Java and like it, you'll probably think Enhydra is a dream come true.
I'm rather unhappy with Zope's lack of refinement when it comes to its Web-based development environment, so you'd think I'd really be upset by Enhydra's almost total lack of visual development tools. But I'm not. I'm perfectly satisfied with the fact that you have to use your own editor and a few command-line utilities to use Enhydra.
Enhydra has one Java-based visual development tool, the Data Object Design Studio (DODS), which you use to build and manage data objects for your applications. To get an idea of what this tool is like, look up the word "arcane" in your dictionary and you'll probably find a screen shot. Enhydra also has a Web-based debugger and administration tool, both of which seem more usable than DODS. A visual application development wizard is in the works.
To be fair, I should mention that you can use external visual development tools to develop Enhydra applications. Enhydra has a tool called Kelp that lets you build Enhydra applications using Inprise JBuilder or Oracle JDeveloper. I haven't tried Kelp, though. I've used Enhydra strictly at the command line along with my favorite text editor, NEdit (www.nedit.org).
All you have to do to start a new Enhydra application is type the command "newapp myApp," substituting your own application name for "myApp." This will create a directory tree for your application, a set of "make" files, and some bare-bones HTML and Java source files. Enhydra expects you to build your applications on a three-tiered model, so it creates separate directories for your presentation layer, business logic, and database code. You can thwart Enhydra and put all your business and database logic into the presentation layer, but I don't recommend it. You'll find it much easier to build and maintain sophisticated applications if you respect the three-tiered design.
You'll spend most of the rest of your development time using your favorite text, HTML editors, and a tool called XMLC (XML Compiler). XMLC converts an HTML or XML file into a compiled Java class that serves up the page as if it were still written in HTML. The important thing to understand is that the Enhydra Java servlets don't actually use the HTML files when the application runs. XMLC simply uses the HTML files as templates to create the Java code to produce the same results.
Although XMLC leaves behind only compiled Java classes by default, you can also have the XMLC utility produce the Java source code. XMLC analyzes the HTML according to the World Wide Web Consortium DOM (Document Object Model). It uses the DOM to create Java-based references to all the HTML document elements. You can then manipulate these Java elements in order to customize how the servlet will serve up the page. The only real complaint I have so far about how XMLC works is the way Enhydra-generated Java code handles things like HTML tables. You have to go through a few contortions to fill a table with data from a database, for example.
The power of Enhydra is that you can design a Web page with your favorite HTML editor, run XMLC to create Java source code based on the HTML page, and then edit the Java source code to add custom behavior to your page. This can be good or bad depending on how well you plan ahead, because you can get yourself into a trap if you want to modify the HTML template after you've written a lot of custom Java code. But I've found it to be an excellent approach so far. Give it a shot and let me know what you think.
Nicholas Petreley is the founding editor of LinuxWorld (www.linuxworld.com). Reach him at email@example.com.