Charles Engelke's Blog

July 8, 2003

Tutorial: Enterprise Java Development on a Budget

Filed under: OSCON 2003 — Charles Engelke @ 6:51 pm

This morning I’m going to learn about enterprise Java on a budget. I
hope they mean a small budget. I’ve already seen lots of options to
do it on a big budget, and I’m skeptical that those expensive ways of
doing things really return proportional value to us. This talk is being
presented by Christopher Judd and Brian Sam-Bodden. They’re both expectant
fathers, and they’ve told us that they would actually treat their wives
going into labor as a higher priority than this session!

We now see that most of the people here are already Java developers, but
not J2EE developers. Whereas I’ve written a “hello, world” program in Java,
and that’s about it. I’m not sure if I’ll get much out of this or not;
we’ll see.

Enterprise Development. What is it? Sun says this means it needs
to be secure, concurrent, distributed, and transactional. Sounds nice; nice
and vague. The speakers say it means “development and processes necessary
to develop applications for large organizations.” This includes deployment
issues, development processes and tools, maintenance, and so on, where Sun
focused on a moment in time while the application is already in place and in
use. We’re going to hear about issues in packaging and deployment, which
interests me a lot.

Sun has lots of Java APIs, and it can be confusing. Now Sun has
categorized the APIs as Standard (J2SE), Enterprise (J2EE),
and Micro (J2ME). Really, they are all part of enterprise computing.
What Java calls J2EE is just some of the pieces you need, the ones with the
greatest large deployment focus. [J2ME is the only version without all of
Java available.]

Java’s view of J2EE really focuses on the web container (JSP and servlets)
and the business logic engine (EJB container). The client tier is usually
called J2SE, though it’s the same kind of stuff.

Enterprise Software Requirements. They identify the
application server for about $25K/CPU, a database server for
about $40K, a web framework (no generally accepted commercial products
available), UML tools ($4K), and IDE ($3.5K), a build system, unit test
harness, and configuration management. For 10 developers and a production
environment with one DB and 2 application servers, you’re out $2 million for
commercial tools. Or, you can use open source for every component and be
out $0 for software. Probably neither extreme is actually the most
effective use of corporate resources (capital, expenses, plus people), but
somewhere in the middle is a good target. Leaning toward the $0 end is
really good for starting out with enterprise Java development, so you’ll
make your decisions on spending up to $10 million later based on experience.

Example case study. We will look at a technology conference
management system development effort to explore these issues. It needs a
web application for attendees, and a fat client for management. It should
support wireless clients (cell phones). Uses J2SE, J2EE, and J2ME. We will
look at each category of tool in this context.

Design Tools. ArgoUML
has UML 1.3 compliance, and supports XMI
(extensible metadata interchange) 1.0 and OCL (object contain language). It
generates code for plain old Java objects. It’s a lot less expensive (free) than
Rational Rose, but also less functional. Still, you can do most of what you
might need, and Rational Rose might not always be worth what it costs for
every project. We’re seeing a demo of the tool, and it looks pretty nice to
me. The use case diagram looks easy to use, and it seems to be a
sophisticated drawing tool.

Build Systems. Ant is really
popular here (by a show of hands). It’s also the presenter’s favorite
development tool. People call it a build tool, but it’s more than that. It
helps untangle you from your IDE and is cross platform, so different
developers can use different personal tools, but the group can use this as a
shared tool. “At this point in time, Ant is the de facto standard.”
The Ant demo is using Eclipse as the IDE. All the IDEs support Ant now,
and are well integrated with it. Ant supports continuous building and
deployment of your application, a must for agile methodologies.

IDEs and Editors. Eclipse and
Netbeans are open source IDEs. Each of these
are being used by companies as foundations of commercial development tools.
jEdit and Jext
are open source Java editors. The demo is going to be of Eclipse. The
learning curve is a bit different from other IDEs the presenter had used.
The IDE is not Java-specific (I’ve played with an experimental Perl
IDE in Eclipse). Different tasks (such as developing in different
technologies) use different perspectives. The Java perspective is
integrated with CVS for source control, and has an “explorer” for CVS
repositories. You can add any perspectives you like and create a custom
environment just for you. Eclipse has debugging built in, Ant support, file
and package explorers, code completion (even in Ant). Eclipse looks very
impressive to me, and the presenters feel it’s up to par with JBuilder and
Cafe. What about Websphere? It has more plug-ins (such as WYSIWYG HTML
editing), although there are things in Eclipse (like Ant integration) that
aren’t yet in Websphere. The presenters think that even existing users of
commercial tools should consider Eclipse (and Netbeans) when it’s time to
renew their commercial licenses. They are likely to want to switch to the
open source tools; they’re that good.

DB Clients. We discuss
SQuirreL SQL Client and
iSQL-Viewer. The demo is of
Squirrel SQL. It’s a quick GUI tool for browsing relational databases.

CVS Clients. Eclipse and Netbeans have CVS integrated with them.
jCVS is another open source client. They
use Eclipse for the demo. Eclipse continues to be impressive.

Development Tools. We’ve got a lot of categories here. First
look at obfuscators to make it harder for others to read your code.
However, they have another purpose: reducing the size of an application by
replacing nice long names with very short ones. That helps for things like
cell phones. It’s not radical: the presenter went from 115K to 86K.
However, since the device had a 100K limit, this was very important. They
mention ProGuard and
RetroGuard.

Logging. The Apache
Jakarta
project has a good pluggable logging framework. You can plug in
Log4j, JDK 1.4, or the Avalong Logkit, or you can plug your own in.
Log4j is
faster than JDK 1.4.

Commons: extend the java.lang package using
Jakarta commons.
Do the same for lots of other areas (JDK introspection, java.utils, java.io).

XML Tools. There’s the
Xerces DOM/SAX parser, the
Xalan XSLT processor and the
FOP formatting objects processor.
These are all top notch tools of their kinds.

I had to answer a phone call, so I missed a bit of the session before the
break. I see they were discussing non-Java development tools, including
CVS for version control and
Bugzilla for bug tracking.

By the way, this topic will be in a book being written by the authors.
They will open source the book, too, and already have a
web site for the project. There’s little there
now, but I’ll keep checking.

Testing tools. JUnit is a
unit testing framework that integrates with Ant, Eclipse, and Netbeans. It
can help with continuous integration, but only if processes force the
developers to check in their code every day, before there’s time for it to
diverge from the rest. The presenters say that full daily builds are a
minimum. There’s an open source project called Cruise Control
that does continous bills, building as code gets checked in. Other tools
discussed include Cactus,
for in-container testing, JUnitEE,
an HTML test runner and servlet, and
JMeter for load testing.

The Business Tier – Application Servers and Code Generators. The
most prominent (“and controversial”) application server out there is
JBoss. They have a dispute with Sun
over licensing, but it’s great for developers and oriented to them.
It’s an EJB and Web
container, clustered, and has JMX support (whatever that is). JBoss
provides the full stack of J2EE services, out of the box. JBoss bundled
with Tomcat has become “the reference application for the web container.”
Initial installation is easy, unlike many application servers. (Oh,
and JMX is a way to manage resources. Since it’s an open standard, there
are countless JMX console managers for JBoss.) A fair number of attendees
here are using JBoss in production.

We have two approaches to generating EJB: from UML models, or from a
database. Generating EJBs is labor intensive, you really need automation.
AndroMDA (formally called UML2EJB)
generates EJBs from UML. The “MDA” is “model driven architecture”. It’s a
good direction to go, but not mature yet.
Middlegen generates EJBs
from a database schema (which you can generate from UML models). Note that
though these are tools to generate EJBs, “most applications don’t need
EJBs”. There are other more appropriate ways to build most applications
(including struts, which I’m going to learn about this afternoon).

Web Tier. If you just need JSP and servlets, you can use a web
container. Choices include
Jetty, which is the default
web container in JBoss, and
Tomcat, the “reference
implementation of JSP and servlets”, and an option for the JBoss web
container. The presenters feel that Tomcat is more straightforward and easy
to understand, but that Jetty is much faster.

For MVC (model-view-controller), they strongly recommend using
Struts which combines
servlets, JSP, and JavaBeans. Another option is
Cocoon, which is XML/XSLT based so
it can render differently for different clients. There’s a bit of a
learning curve for Struts, but if you take the time to do it, you’ll end up
much happier than with other approaches.

For the client tier (that is, fat client code), they recommend Eclipse
and Netbeans. Eclipse has native widgets (SWT?), so client applications
look like other applications on their platform, and Netbeans is Swing based,
so applications look about the same regardless of platform. My experience
is that developers an application to be the same on every platform, while users
much (much) prefer all their different applications on a particular
platform to look the same as each other. So the Eclipse approach sounds
better to me.

Mobile Tier – Emulators. If you’re targeting small devices,
you’ll really need an emulator. Sun has a
wireless toolkit, which isn’t open
source, but is “free and necessary”. It’s an IDE that includes lots of
phone emulators. Palm has offered a free
emulator for a very
long time. And to target PocketPC, you can use
ME4SE. To build the applications you can
use Antenna which uses Ant,
and ProGuard or RetroGuard. J2ME is better than things like WAP, because it
runs even without a signal. Web services tools include
kXML and
kSOAP, with versions available at
www.kobjects.org.

And now, the Integration Tier. Object persistence can be provided
by tools called Hibernate (you might not use it, but be inspired it), Castor
and Apache Torque. Non-relational data storage is available via XIndice (a
native XML database) and ObjectStyle Cayenne’s object database. Good old
relational databases are still around. For a 100% Java open source
database, you can use HSQL.
And there’s the widely used MySQL and
PostgreSQL which has a
JDBC driver available separately.

We’re running out of time, so the presenters are recapping quickly. From
what I’ve seen, Ant is something to really look at. Eclipse and CVS are
clearly excellent options, too. For other purposes, there are more choices
and subtle gradations of functionality and maturity to consider.

EJBsolutions offers a CD with
lots of these tools all configured to work together, with a nice installer.
That seems like a good place to start.

Advertisements

Create a free website or blog at WordPress.com.

%d bloggers like this: