Choosing an Oracle Open Source Web Technologyby Sean Hull
Enter the world of open source Web technologies. They are many, so there will be much to cover and review. Take your time with each technology. Consider the pros and cons of the type of language you'll be using, and what that solution is often used for. Try to find case studies of commercial sites that are using that technology and learn about their experiences. You can email the developers of these various tools and technologies as well as the contacts at the sites that use them in their day-to-day operations.
This article covers both scripting technologies and Java technologies (although JavaServer Pages fits somewhat into both categories) and concludes with an end-to-end solution. First, let's take a look at the various scripting technologies.
Language considerations cover a bunch of different areas. Scripting languages are quick for prototyping and ideal for the fluid and changing development environment of the Web. Java, in the form of servlets, however, has many advantages, including a robust graphical API, garbage collection, and the ability to compile into byte code. Depending on your environment, it may be faster or slower than a scripting alternative, but you must weigh the pros and cons before choosing one technology.
PHP stands for the recursive PHP: Hypertext Preprocessor. PHP was started by Rasmus Lerdorf. It is a very simple yet powerful scripting language, which in a nutshell allows you to embed code in your HTML pages to do various things. This code can be expanded or it can return various complex HTML itself. For example, you could connect to your Oracle database and verify if a user-and-password combination entered in a form was valid, and then return the appropriate information.
PHP has native Oracle support, along with support for many other databases, including Informix, Microsoft SQL Server, MySQL, and ODBC drivers. If you've made a commitment to go with Oracle you should be confident that PHP will work well for you. However, if you have considered prototyping with a different database from the one you use in production you might want to think carefully. Although you can use PHP for both MySQL and Oracle for instance, you won't find yourself using one set of code. You'll be using different calls, thus breaking your database abstraction. This is probably one of the only caveats about using PHP.
If all this isn't enough, you'll find that if you're using Apache as your Web server, there's already a module (mod_php), which provides a PHP script interpreter that is built into the Apache engine. Powerful indeed.
As of version 4.0, PHP has grown to include an incredible array of functions and associated technologies. It should be easy for programmers familiar with most imperative programming languages to quickly pick it up. In addition, there is a vast collection of developer sites and all-in-one packages released as PHP open source technologies, which may fit your needs well. All in all, PHP comes highly recommended as a simple-to-learn, yet powerful and well-supported technology.
Like PHP, you can write embedded scripts with Perl as well. You can do this with the EmbPerl technology developed by Gerald Richter. There are many advantages to using Perl for development, one of which is the large collection of prebuilt packages available from CPAN (Comprehensive Perl Archive Network). There are literally hundreds to choose from. Thus, just as with PHP, you have a bustling developer network, which means plenty of people to bounce ideas off, plenty of email lists, and plenty of code to comb through.
One other huge advantage to building your Web site with Perl is that your database access is accomplished through a generic driver called DBI. This is the DataBase Interface built by Tim Bunce, and it uses various drivers to connect to different databases: DBD::Oracle to connect to Oracle, and DBD::mysql to connect to MySQL. If you want to prototype with MySQL and have Oracle as your production database, it's no problem with the DBI. You won't have to change your Perl code at all.
If that's not enough, you'll find there's an Apache module (mod_perl) to bring the perl interpreter into the Apache engine, making the running of all this code even faster. It's hard to argue with speed.
Mason - Perl
On the surface Mason, developed by Jonathan Swartz, is much like EmbPerl. You embed perl code or scripts into your HTML documents, which are preprocessed by your interpreter (compiled into the Apache engine), and out comes dynamic HTML. Great.
Mason takes this all one step further, though. You still have the advantages of the vast array of off-the-shelf Perl packages to choose from, persistent connections, and a Perl interpreter right in Apache with mod_perl. What you also have with Mason is the ability to encapsulate your code into components, allowing clean, structured programming from the start. When building a complex Web site with tens of thousands of lines of code, this really becomes a saving grace. It also provides caching, and expiration of individual components, all implemented as a Perl module. Pretty cool stuff.
What makes Mason even more intriguing is that it provides sophisticated previewing, as well as staging and production modes. This can optimize development, and speed things up on the production end.
Aquarium - Python
Not satisfied with Perl and PHP solutions, and looking for an alternative? The Python-based Aquarium developed by Shannon -jj Behrens may be for you. Here you'll find a modular Web application development system for building HTML-embedded scripts in Python.
Like Perl, Python has a robust array of packages to choose from, and a strong developer community, all making it another good bet for Web development.
Although not strictly open source itself, Java is a powerful language, within which you can build open source software. Because of this we included it in our book, Oracle & Open Source, and I'm also covering the various Java technologies here.
Above all else, Java is a language decision. This is coming from a consultant who has to (a) support technology decisions and (b) find people to do development in those technologies, and maintain them after the original developers have gone. I'll show my bias ahead of time and mention that I usually shy away from Java-based solutions. That said, let's see what's out there.
JavaServer Pages are much like the other embedded scripting solutions. You embed Java code into your HTML, and it is preprocessed by an interpreter. Knowing you're going for an open source solution, you'll probably be using Apache as your Web server, and you'll be happy to find that there is plenty of support for Java through the mod_jserv module.
Java servlets take the Web development paradigm to a new dimension. With the embedded scripting described in various incarnations above, you basically have a spin on the same old static HTML technology, but with the ability to use dynamic connections to databases to create varying content. With servlets, Java can allow you to expand the power on the server side, building much more robust applications than would otherwise be possible. With a Web server and client, you have a stateless interaction. Between each page request the server doesn't know anything about you, or have any sense of a session. You have to keep sending back who you are, and what you were doing, so the server knows what to do next. With servlets you can create lasting sessions to do more complex computing.
Though not just a Web-based solution, Turbine provides a powerful servlet framework for Java development.
Turbine's big advantage is that it tries to provide out of the box many of the components that Web developers end up writing over and over, thus saving time up front. Some of those include ParameterParsing, Database Connection Pools, Job Scheduling, and GlobalCaches.
Unlike the previous technologies which will all handle specific aspects of Oracle-based Web development, there is also a more complete open source solution available.
ArsDigita Community System
ArsDigita is a bit different than the other technologies we've discussed, which are really core technologies upon which you build what you want. The ArsDigita Community System (ACS) is an enterprise class solution that includes a content management system, a commerce solution, a collaborative solution, personalization, and a marketing and analysis component. This is really an end-to-end solution which may be more than many Web developers need, though you can use some pieces and not others if you choose.
The ArsDigita system uses TCL for templating, allowing you to create dynamic HTML much the way we described in the various scripting languages listed above. In addition, it is closely tied to Oracle, and makes use of advanced Oracle features and requires PL/SQL code writing. ACS is complex, and may lead you towards Oracle dependence, if that is a concern.
The open source world has plenty of options to offer the Oracle developer. If you are building an Oracle backed Web site, consider price versus performance, expandability, flexibility, and simplicity of administration. Comparing cost is a no-brainer, but you must also consider many other factors. Speed, flexibility, and scalability are also advantages you can gain from some of these open source solutions.
Sean Hull is an Oracle DBA and Web developer plying his trade as an independent consultant with his own firm, iHeavy Inc., in New York City. He focuses on integrating open source technologies with commercial technologies such as Oracle, and has serviced many successful Silicon Alley companies. His practice is growing steadily with an expanding network of associates offering a wide range of database, Web, and Internet-related services. He is the author of Karma, a Web-based, open source, Oracle monitoring tool, and a major contributor to the Orac DBA tool. He also contributes to the Oracle-L email list and the dbi-users email list. On his days off, you might find him practicing Capoeira, a Brazilian martial art. Sean is the coauthor of O'Reilly's recently released Oracle & Open Source. He resides in Manhattan, where he enjoys the fast pace, great restaurants, culture, and art. He can be reached at firstname.lastname@example.org.
O'Reilly & Associates recently released (April 2001) Oracle & Open Source.
Sample Chapter 1, Oracle Meets Open Source, is available free online.
For more information, or to order the book, click here.