ONJava.com -- The Independent Source for Enterprise Java
oreilly.comO'Reilly NetworkXML.comONLamp.comONJava.comOpenP2P.com
 Newsletters | Events | Jobs | API Map | Daily Recipe | OS Java Directory | java.net
  

 Topics

  J2EE/CORBA
  JSP and Servlets
  EJB Components
  JDO/JDBC/SQLJ
  Java/XML/JAX
  Web Services
  Peer-to-Peer
  Open Source
  J2ME/Wireless
  Best Practices
  Java Security
  J2SE/JFC/JVM
  Java IDE Tools
  Java SysAdmin



 Content

  Feature Articles
  Java API Map
  Web Logs
  Book Excerpts
  Events
  OS Java Directory

 Resources

GGZ-Java  May. 12, 2006

JTrac  May. 8, 2006

Dao-zero: implement your DAO intefaces  Apr. 28, 2006

DualRpc easy bidirectional RPC for GUI client to server  Apr. 25, 2006

ColoradoFTP - The Open Source FTP Server  Apr. 19, 2006

More Resources

 Java API Map



  Books

Java Enterprise in a Nutshell, Third Edition

Head First Design Patterns Poster

Eclipse IDE Pocket Guide

JBoss: A Developer's Notebook

Maven: A Developer's Notebook

Swing Hacks

Killer Game Programming in Java

Learning Java, Third Edition

Ant: The Definitive Guide, Second Edition

Spring: A Developer's Notebook

Java in a Nutshell, Fifth Edition

Jakarta Struts Cookbook

Head First Java, Second Edition

QuickTime for Java: A Developer's Notebook

AspectJ Cookbook

More Java Books

 Affiliates

   Servlets.com
  jdom.org


Best Practices

Java best practices includes all aspects of Java software design, performance, and optimization. Any of these use Java threads, design patterns and more.

Reshaping IT Project Delivery Through Extreme Prototyping
By Satya Komatineni
Why should the benefits of short iterations and a tight feedback loop be limited to the agile methodologies like Extreme Programming? In this article, Satya Komatineni explores the idea of Extreme Prototyping--the staged, ongoing development of a web app prototype that emerges into a final product. He shows how it can eliminate common design and project management errors. Nov. 15, 2006

Implementing Mutual Exclusion for AJAX
By Bruce Wallace
AJAX programmers who come from the Java world can, or at least should, be concerned with JavaScript's non-support for safely managing data structures in a concurrent fashion. If one thread is changing the DOM while another is reading it, problems are likely. Java developers can attack this with tools from the synchronized keyword and the old Object wait()/release() to the modern java.util.concurrent package introduced in J2SE 5.0. Bruce Wallace addresses the problem by introducing protection for critical blocks of JavaScript code. Apr. 5, 2006

An Exception Handling Framework for J2EE Applications
By ShriKant Vashishtha
One common hassle in J2EE development is exception handling: many apps devolve into a mess of inconsistent and unreliable handling of errors. In this article, ShriKant Vashishtha introduces a strategy for predictably collecting your exception handling in one place. Jan. 11, 2006

Taking JUnit Out of the Box
By Amir Shevat
JUnit is practically ubiquitous among Java developers as a way to test code, but it's somewhat limited by the fact that it's only meant to run in one JVM on one box, hampering its usefulness when developing distributed applications. In this article, Amir Shevat shows how the open source JUnit extension Pisces helps JUnit overcome this limitation. Jul. 13, 2005

An Ant Modular Build Environment for Enterprise Applications
By Les A. Hazlewood
Most Java developers already use Ant for their builds, but are you getting everything you could out of this tool? With a complex enterprise application, in which classes may be used in several tiers, it's important to control where the code lives and how it gets built, so you can build .jars with just the code needed for each tier. Les Hazlewood shows how this approach leads to faster builds and downloads, and even catches errant dependencies. Jun. 22, 2005

Constructing Services with J2EE
By Debu Panda
Web services are a popular means of deploying service-oriented applications, and the standards in J2EE 1.4 make it easier to develop services that are portable and interoperable. Debu Panda shows you how, and takes a look at how things will get easier in J2EE 5.0. May. 25, 2005

Java Component Development: A Conceptual Framework
By Palash Ghosh
In general terms, a component is one or more classes with an external API that satisfy some requirement. But how do you build components that are really practical--that handle configuration changes or third-party integration well? Palash Ghosh has some ideas about the concepts behind components. Mar. 23, 2005

Mock Objects in Unit Tests
By Lu Jian
Unit testing your code against a service or process that's either too expensive (commercial databases) or just not done yet is something you can deal with by simulating the other piece with a mock object. EasyMock can suffice in some cases, but it can only create mock objects for interfaces. Mocquer, based on the Dunamis project, can create mocks for classes, too. Lu Jian shows how it works. Jan. 12, 2005

Towards Bug-Free Code
By Ashwin Jayaprakash
Test-driven development sometimes sounds better than it turns out to be. Early decisions to tightly couple functional parts of your system can make it a lot less amenable to testing than it ought to be. As Ashwin Jayaprakash shows, J2SE 5.0's generics make working with abstract classes and interfaces easier than it used to be, which encourages loose coupling and facilitates testing. Dec. 22, 2004

The Singleton as a Network Management Pattern
By Stephen B. Morris
Patterns aren't for the local memory space any more. As Stephen B. Morris points out, patterns are also useful for network management problems. In this installment, he shows how the Singleton pattern can be used to manage access to functionality in a networked system. Oct. 27, 2004

Using the ASM Toolkit for Bytecode Manipulation
By Eugene Kuleshov
ASM is making inroads in the Java bytecode manipulation community--it's used by Groovy, AspectWerkz, BeanShell, and others--because of its light weight and good performance. Eugene Kuleshov shows how to get started with ASM. Oct. 6, 2004

Unit Test Your Struts Application
By Lu Jian
Consistent unit testing is an essential part of development, but web applications aren't necessarily well-suited to unit testing--how to you validate the "correctness" of a returned stream of text or HTML? Lu Jian has an answer in the form of StrutsUT, a Cactus-based library for unit testing Struts web apps. Sep. 22, 2004

Understanding the Interplay Between Utility Classes and Static Initialization
By Satya Komatineni
Using static initializers is a common practice for setting up fields that need to be accessed from distantly related classes. However, without a firm understanding of how statics work with relation to subclassing, and a careful establishment of initialization expectations, difficult problems can arise. Satya Komatineni offers a new pattern that can reduce these problems. Sep. 15, 2004

Java Patterns and Network Management
By Stephen B. Morris
Patterns are often used to solve common problems in software developments, but this approach is also applicable to deploying and managing networks. Stephen B. Morris shows how this approach can help solve problems in this complex field. Aug. 25, 2004

Designing J2EE Applications for Real-Life Clustered Environments
By Anil Sharma
What works on a single server can crash and burn in a cluster. In this article, the authors draw from their practical experience to list and discuss some critical considerations when building J2EE applications so that they can be deployed in a clustered environment without requiring any code changes. Jul. 14, 2004

Better, Faster, Lighter Programming in .NET and Java
By Justin Gehtland
In Better, Faster, Lighter Java, authors Bruce Tate and Justin Gehtland lay out five basic principles to combat the "bloat" that has built up over time in modern Java programming. In this article, Justin shows how programmers developing .NET apps can apply the same principles, and along the way, cultivate still more ideas that make programming more simple and fun again. Jul. 14, 2004

Code Improvement Through Cyclomatic Complexity
By Andrew Glover
Overly complex code is dangerous, hard to maintain if not already buggy. But what do we mean by "complex"? The metric of cyclomatic complexity helps show where the most complex code is. As Andrew Glover illustrates, finding the complex code is also the first step to refactoring it. Jun. 16, 2004

Nested Classes, Part 1
By Robert Simmons, Jr.
One aspect of the Java language that is not widely understood is the concept of nested classes. But because you're bound to encounter one or more of them in other people's code, it's important to understand how they work. Chapter six of Hardcore Java covers the various nested classes. In this first excerpt in a three-part series of excerpts from the chapter, author Robert Simmons covers the first of the three basic categories of nested classes: inner classes.  May. 12, 2004

Seven Low-Cost Ways to Improve Legacy Code
By Robert Simmons, Jr.
Robert Simmons, Jr. presents seven techniques developed and used in his consulting work that are designed to improve legacy code, without a major investment in man hours or cash. Robert is the author of the recently released Hardcore JavaApr. 28, 2004

Do As They Need, Not As They Say
By Jeff Lowery
Replacing an existing system with a new and improved one should make end users happy, but that's often not the case. What goes wrong? Jeff Lowery calls on his experience to look at the process of developing new systems and why developers need to be advocates for the end users. Apr. 28, 2004

Migrating to Velocity
By Jason R. Briggs
Velocity offers a compelling way to develop web applications, but converting an existing JSP-based project is no simple task. Jason Briggs shows how he used Velocity servlets to ease the transition. Apr. 14, 2004

Lazy Loading with Aspects
By Russell Miles
AspectJ allows the Java community to apply modular crosscutting concerns, or aspects, to their applications. Lazy loading is one such crosscutting concern that can benefit from an Aspect-Oriented, rather than traditional Object-Oriented, implementation approach. This article presents an implementation of lazy loading using AspectJ. Mar. 17, 2004

Managing Your Dependencies with JDepend
By Glen Wilcox
Attributes like scalability and maintainability are qualitative in nature and hard to quantify, even hard to know until your code fails. But by analyzing dependencies between packages, JDepend gives you a way to measure how well-architected your code is. Jan. 21, 2004

Top 15 Ant Best Practices
By Eric M. Burke
Nearly every open source Java project now uses Ant. The widespread use of Ant in these projects has naturally led to an increased need for a set of well-established best practices. Eric M. Burke, coauthor of Java Extreme Programming Cookbook and Ant: The Definitive Guide, offers his 15 best practices for using Ant and for writing well-crafted Ant buildfiles. These tips were inspired by his own mistakes on previous projects, or from horror stories relayed to him from other developers. Dec. 17, 2003

Best Practices for Exception Handling
By Gunjan Doshi
Java's concept of exceptions and how they're used has led to controversy and, in some cases, bad programming practices. Gunjan Doshi seeks to lay down some best practices for using exceptions in Java. Nov. 19, 2003

Developing with Maven
By Rob Herbst
By knowing what developers want in a build tool, Maven hopes to unseat Ant as the favorite build tool of Java developers. Rob Herbst looks at Maven's most compelling features. Oct. 22, 2003

Managing Complexity: Keeping a Large Java Project on Track
By Tom Copeland
Delivering a software project successfully requires much more than just writing good code. Issue tracking, bug fixing, packaging, deployment, and testing all help solve your customer's actual problem. Tom Copeland explains Dashboard, the continual integration infrastructure behind DARPA's UltraLog, a large Java project distributed among several vendors. Sep. 10, 2003

Memoization in Java Using Dynamic Proxy Classes
By Tom White
Memoization, or caching previously computed values of functions, can speed up certain classes of problems. Java 1.3's dynamic proxy classes make it possible to write generic memoization routines. Tom White explores this technique and explains when and how it can improve your performance. Aug. 20, 2003

A Java Programmer Looks at C# Delegates
By Steven M. Lewis
While C# has taken many features from Java, it's added other interesting ideas. One is delegation; C# treats methods as first-class objects. Steven Lewis and Wilhelm Fitzpatrick explain delegates and provide a working Java implementation. May. 21, 2003

Black Box Web Testing with HttpUnit
By Giora Katz-Lichtenstein
No matter how much unit testing you do, how do you know your web site meets your customers' real needs? Giora Katz-Lichtenstein introduces HttpUnit, a Java framework for Black Box web testing, and demonstrates how it can improve your sites. May. 7, 2003

Surviving Abrupt Shutdown
By Budi Kurniawan
Sometimes letting users save their data isn't enough--you want to make prevent data loss. Java provides an elegant way for programmers to execute code in the middle of the shutdown process, thus making sure your clean-up code is always executed. In this article, Budi Kurniawan shows how to use a shutdown hook to guarantee that clean-up code is always run, regardless of how the user terminates the application. Mar. 26, 2003

Java Swing: Menus and Toolbars, Part 7
By Brian Cole, Robert Eckstein, James Elliott, Marc Loy, Dave Wood
In the final excerpt from Java Swing, learn how to use toolbars. Mar. 19, 2003

Java Swing: Menus and Toolbars, Part 6
By Brian Cole, Robert Eckstein, James Elliott, Marc Loy, Dave Wood
In this sixth excerpt from Java Swing, learn how to use complex menu items like radio buttons and checkbox menus. Mar. 12, 2003

Advanced Text Indexing with Lucene
By Otis Gospodnetic
Lucene is a free text-indexing and -searching API written in Java. In the second of a series of articles, Otis Gospodnetic explains the structure of Lucene indices and introduces several advanced techniques to improve the performance of text-indexing applications. Mar. 5, 2003

Java Swing: Menus and Toolbars, Part 5
By Brian Cole, Robert Eckstein, James Elliott, Marc Loy, Dave Wood
In this fifth excerpt from Java Swing, learn how to attach menus to menu bars with the JMenu class. Feb. 19, 2003

Java Swing: Menus and Toolbars, Part 4
By Brian Cole, Robert Eckstein, James Elliott, Marc Loy, Dave Wood
In the fourth excerpt from Java Swing, learn how to create context-sensitive menus with the JPopupMenu class. Feb. 12, 2003

Static Analysis with PMD
By Tom Copeland
Code review is good, but who has time to run through every line of a large project every night? If only that were automatable. Thankfully, there's PMD. Tom Copeland demonstrates how to analyze your Java code for deleterious constructs and how to add rules to catch more. Feb. 12, 2003

Java Swing: Menus and Toolbars, Part 3
By Brian Cole, Robert Eckstein, James Elliott, Marc Loy, Dave Wood
In this third excerpt from Java Swing, learn how to add strings and icons to menus with the JMenuItem class. Jan. 29, 2003

Java Swing: Menus and Toolbars, Part 2
By Brian Cole, Robert Eckstein, James Elliott, Marc Loy, Dave Wood
In this excerpt from Java Swing, 2nd Edition, learn about menu selections and the JMenuBar class. Jan. 22, 2003

Java Swing: Menus and Toolbars, Part 1
By Brian Cole, Robert Eckstein, James Elliott, Marc Loy, Dave Wood
In this excerpt from Java Swing, 2nd Edition, learn how to use Swing menus. Jan. 15, 2003

Servlet Best Practices, Part 3
By The O'Reilly Java Authors
In this final excerpt on servlets from Java Enterprise Best Practices, we present how to effectively send files for download. Getting it right across Web browsers takes a bit of work, but with this tip you'll have it right in no time. Jan. 8, 2003

Servlet Best Practices, Part 2
By Jason Hunter
In part two of three in this series of book excerpts on servlet best practices from Java Enterprise Best Practices, learn about caching with servlets. Dec. 23, 2002

Servlet Best Practices, Part 1
By The O'Reilly Java Authors
Servlets have dominated the recent server-side Java landscape and have become the standard way to interface Java to the Web. This chapter, the first of three book excerpts from Java Enterprise Best Practices, discusses effective servlet-based development and deployment.  Dec. 18, 2002

Enhance Collection Performance with this Treasure Trove
By Dion Almaer
Trove is an open source Collection implementations. You can use these instead of the standard collections to get increased performance. Jun. 12, 2002

J2EE Design Patterns: CMP-to-BMP Pattern
By Dion Almaer
In EJB 2.0, Sun delivered a revamped container-based persistence model. This article explains how to write a CMP in EJB 2.0 and how to go from CMP to BMP when needed. Apr. 10, 2002

Micro-Tuning Step-by-Step
By Jack Shirazi
Java Performance Tuning author Jack Shirazi offers a step-by-step guide for micro-tuning your Java methods. Mar. 20, 2002

Business Logic, Part 2
By Brett McLaughlin
In Part 2 of our excerpt from Chapter 8 of Building Java Enterprise Applications, Vol I: Architecture, Brett McLaughlin builds a UserManager component, and illustrates why managers are a good thing.  Mar. 6, 2002

The Java Platform
By David Flanagan
In this excerpt from O'Reilly & Associates' Java in a Nutshell, 4th Edition, David Flanagan shows you a number of the Java 2SE platform packages, using examples of the most useful classes in these packages. Feb. 27, 2002

Java Programming with Oracle JDBC: Performance
By Donald Bales
When it comes to JDBC performance issues, there are two major factors to consider: performance of the database structure and the SQL statements used against it and relative efficiency of the different ways you can use the JDBC interfaces to manipulate a database. This excerpt from Java Programming with Oracle JDBC explores these.  Feb. 13, 2002

Expiring Data with Hashbelts
By William Grosso
The final installment in this series on automatic data expiration shows that hashbelts are a new data structure that satisfies all of the requirements for data expiration. Feb. 13, 2002

spacer

  Resources
Multithreaded Swing Applications  Sep. 18, 2001

J2EE Component Patterns Tutorial  Sep. 7, 2001

Java Reflection Tutorial  Apr. 28, 2001

EJB Observer Pattern  Mar. 17, 2001

J2EE Design Patterns Repository  Feb. 12, 2001


More Resources


  Events
More Events

spacer
Contact UsMedia KitPrivacy PolicyPress NewsJobs @ O'Reilly
Copyright © 2000-2006 O’Reilly Media, Inc. All Rights Reserved.
All trademarks and registered trademarks appearing on the O'Reilly Network are the property of their respective owners.
For problems or assistance with this site, email