Querying for persistent objects without a query language
This article describes an easy-to-maintain solution for the persistence of form-entry data within Web applications. All queries are compiler checked and implemented in a programmatically object-oriented way, without using a query language. Furthermore, the mapping between user interface and business logic is clearly decoupled from the mapping between business logic and data storage.
Gerald Bachlmayr, March 2006

Bridge the gap between Struts and Hibernate
Hibernate and Struts are currently among the most popular open source libraries on the market. Effectively, they are the default developer selections among competing libraries when building Java enterprise applications. Although they are often used in conjunction with one another, Hibernate was not primarily designed to be used with Struts, and Struts was released years before the birth of Hibernate. To put them to work together, some challenges remain. This article identifies some of the gaps between Struts and Hibernate, particularly related to object-oriented modeling. It also describes a solution for bridging these gaps that involves an extension to the Struts framework. All Web applications built upon Struts and Hibernate can derive benefit from this generic extension.
Ted He, March 2006

OO, XML, and GML: Are angle brackets a flexible modeling material?
Using XML in a Java environment can easily introduce questions like: Why should I use it at all? How do I use it? What is the best way to use XML? This article summarizes Milan Trninić's experience in trying to answer such questions that emerged many times during the implementation of different XML grammars in Java applications.
Milan Trninić, September 2005

Second-generation aspect-oriented programming
While aspect-oriented programming (AOP) offers a powerful means of modularizing programs, and a robust, feature-rich implementation for the Java platform is available in AspectJ, AOP is not yet in the average Java programmer's toolbox. AOP has remained an interesting curiosity at conferences and an item on everyone's to-do list to learn more about—until now. In the last year, a wave of interest in lightweight, transparent application servers has washed up a whole school of new AOP implementations, with features that allow developers to apply advice more dynamically and flexibly than before. In this report on the new generation of AOP frameworks, Dave Schweisguth contrasts the new with the old, explains where the new features fit in, and looks to the future of AOP on the Java platform.
Dave Schweisguth, July 2004

More on getters and setters
Allen Holub's past Java Toolbox column, " Why Getter and Setter Methods Are Evil," discussed the downside of the getter/setter idiom. That article presented a design-level solution. (By keeping your design in the problem domain as long as possible and using dynamic modeling techniques like CRC (classes, responsibilities, collaboration) modeling, the getter/setter methods tend not to show up at all.) This article expands on the previous article by providing one of several possible programmatic solutions to the get/set-elimination problem. In particular, Allen demonstrates how to use the Gang of Four Builder design pattern to construct both Web-based and client-side user interfaces without exposing your object's implementation to the entire program.
Allen Holub, January 2004

Create client-side user interfaces in HTML, Part 2
This "Create Client-Side User Interfaces in HTML" series continues by examining the HTMLPane sources. Part 2 offers examples of how to customize the JEditorPane to support custom tags and also provides an extended description of the Factory Method design pattern.
Allen Holub, November 2003

Create client-side user interfaces in HTML, Part 1
This article presents a variant on Swing's JEditorPane that makes it possible to specify an entire screen of your client-side user interface (UI) in HTML. JEditorPane is designed to let you put an HTML text component inside a dialog box, not to specify the entire contents of the dialog box in HTML. In practice, this class makes it vastly easier to create complex user interfaces than does Swing/Abstract Window Toolkit (AWT)'s standard containment-and-layout-manager architecture.
Allen Holub, October 2003

Why getter and setter methods are evil
The getter/setter idiom is a commonplace feature in many Java programs. Most of these accessor methods, however, are unnecessary and can severely impact your systems' maintainability. Using accessors violates the basic object-oriented (OO) principle of encapsulation, so you should avoid them. This article discusses getter/setter cons and offers an alternative design methodology.
Allen Holub, September 2003

Why extends is evil
Most good designers avoid implementation inheritance (the extends relationship) like the plague. As much as 80 percent of your code should be written entirely in terms of interfaces, not concrete base classes. The Gang of Four Design Patterns book, in fact, is largely about how to replace implementation inheritance with interface inheritance. This article describes why designers have such odd beliefs.
Allen Holub, August 2003

Make the Java-Oracle9i connection
This article provides Java programmers with techniques for utilizing Oracle9i's new object-oriented features such as inheritance, custom constructors, dynamic dispatch, array descriptors, and mapping strategies from a Java class hierarchy to an Oracle type hierarchy without using traditional object-relational (O/R) mapping strategies.
Terry Camerlengo and Carl Johnson, June 2003

Simply Singleton
Sometimes it's appropriate to have exactly one instance of a class: window managers, print spoolers, and filesystems are prototypical examples. Typically, those types of objects—known as singletons—are accessed by disparate objects throughout a software system, and therefore require a global point of access. Of course, just when you're certain you will never need more than one instance, it's a good bet you'll change your mind.
David Geary, April 2003

An inside view of Observer
The Observer pattern lets you build extensible software with pluggable objects by allowing communication between loosely coupled objects. In his latest Java Design Patterns column, David Geary explores the Observer pattern, how it's used throughout the Java 2 SDK, and how you can implement the pattern in your own code.
David Geary, March 2003

Add a JAC to your toolshed
JAC (Java Aspect Components) is an application server that offers an open source alternative (under GNU Lesser General Public License) to Java 2 Platform, Enterprise Edition (J2EE) environments for the development of Java, Web-based distributed applications. JAC includes a Unified Modeling Language (UML) IDE that models applications' business logic and automatically generates and compiles pure business logic Java classes. These classes, executed into JAC's container, can seamlessly benefit from a set of technical and/or business crosscutting services such as data persistence, authentication, profile management, access-right checking, presentation, and load balancing. Based on aspect-oriented programming technology (AOP), JAC separates these concerns from the application's core business logic. This article presents an overview of JAC's features and functionalities.
Renaud Pawlak, March 2003

Repair invalid cached services in the Service Locator pattern
The Service Locator pattern locates J2EE (Java 2 Platform, Enterprise Edition) services for clients and thus abstracts the complexity of network operation and J2EE service lookup as EJB (Enterprise JavaBean) Home and JMS (Java Message Service) component factories. The Service Locator hides the lookup process's implementation details and complexity from clients. To improve application performance, Service Locator caches service objects to eliminate unnecessary JNDI (Java Naming and Directory Interface) activity that occurs in a lookup operation.
Paulo Caroli, July 2002

Is WSDL the indispensable API?
Many developers consider Web Services Description Language (WSDL) the new software design view. WSDL offers a verbose, ASCII, standard, and language-agnostic view of services offered to clients. WSDL also provides noninvasive future-proofing for existing applications and services and allows interoperability across the various programming paradigms, including CORBA, J2EE (Java 2 Platform, Enterprise Edition), and .Net. In this article, Eoin Lane shows a service's WSDL view, then explains how you can generate client and service implementations for the various programming languages. Eoin finishes by discussing possible sources for initial WSDL view generation.
Eoin Lane, May 2002

All

Wizard API updated!
Tim Boudreau has released a new version of the Swing Wizard library (version 0.997) that fixes the WizardException bug reported in JavaWorld's recent Open Source Java Project profile. The article's examples have been reworked to test out the new, improved WizardException. Thanks, Tim, for this helpful fix!
Open Source Java Projects: The Wizard API

Newsletter sign-up

Sign up for our technology specific newsletters.

Enterprise Java
View all newsletters

Email Address: