Current area: HOME -> Java -> Design Patterns Articles
Design Patterns
An Introduction to Antipatterns in Java Applications
Just as design patterns provide a way to communicate concisely about desired software practices, antipatterns provide the equivalent advantages for communicating undesirable practices and here's a set of common antipatterns to get you started.
Applying MVC to Web-Based Applications with Generic Views
In this article, I'll show how to use MVC in a Web-based
project. My controller will rely on Reflection API to
dynamically call action methods, redirect to proper views, and
coordinate data flow between presentation and model layers.
Become a programming Picasso with JHotDraw
Design patterns and frameworks have a mutually beneficial relationship. A well-known example of this is JHotDraw, a highly customizable GUI framework that simplifies developing drawing applications. This article explains the JHotDraw framework and general framework principles in terms of several important design patterns. You'll develop a class diagram editor that demonstrates JHotDraw's usage and capabilities.
Creating Dynamic Swing Views with Reflection by Extending MVC
In this article Ill show how to extend MVC architectural
pattern to build a Swing GUI program by using Reflection to
dynamically generate Views. The Controller will read a property
file, generate Views, and corresponding Models, and execute
simple business logic. Developers working on Views and
following this design will only need to update properties file
and their new class instances will automatically be added to
the main project, without the need to modify Controller or any
other part of the project. Reflection will be used to
instantiate new objects and call required methods.
Design Patterns for Building Flexible and Maintainable J2EE Applications
With the proliferation of Java 2 Enterprise Edition (J2EE) as a platform of choice for server-side applications, it is crucial for developers to share their experiences and designs. This article introduces some reusable designs you can use to build flexible and easily maintainable J2EE applications. This article does not explain the patterns with their formal template or UML diagrams. The J2EE BluePrints Program is the place to find these details, along with code samples. This article explains some problem domains that affect the flexibility and maintainability of J2EE applications, and the recommended solutions.
Design Patterns in Java AWT
In this paper we tried to study the design of Java AWT focusing in interesting object collaboration structures (trying to use the Role Modeling approach) and finding the correspondence to [Gamma95]s design patterns. In no means is the result exhaustive.
Designing Fields and Methods
This installment of the Design Techniques column shows how some
fundamental software design techniques, like avoiding special
data values and minimizing method coupling, apply to Java.
Double-checked locking and the Singleton pattern
All programming languages have their share of idioms. Many are useful to know and use, and programmers spend valuable time creating, learning, and implementing them. The problem is that some idioms are later proven not to be all that they were purported, or to simply not work as described. The Java programming language contains several useful programming idioms. It also contains some that further study has shown should not be used. Double-checked locking is one such idiom that should never be used. In this article, Peter Haggar examines the roots of the double-checked locking idiom, why it was developed, and why it doesn't work.
Dynamic Web Data Analysis
Learn about an adaptable approach which separates programming tasks from Web page design tasks. This strong conceptual model encourages good design, enables re-use of data definitions, and is well-suited to the construction of dynamic user interfaces. The authors also illustrate the particular challenges you might encounter when you dynamically change the analysis performed by Web pages.
Event Generator Idiom
In this installment of the Design Techniques column, I propose
the "event generator" as a Java idiom. The article provides a
background on the concepts of patterns and idioms, describes
the observer pattern, and demonstrates the idiomatic way to
implement the observer pattern in Java.
How to decouple the Observer/Observable object model
By using a decoupling technique, you can optimize the performance of the Observable by isolating, or decoupling, it from the dissemination of information to the Observers.
Introduction to Design Techniques
This article introduces the Design Techniques column and
discusses the larger issues involved in designing Java
programs. In addition, it examines the software development
process in general, describes the role of design within that
process, and looks at the various and competing goals of a
"good" software design.
Java Modeling: Holonic software development
Granville Miller temporarily abandons the topic of requirements gathering for one more compelling: holonic software development. Find out how this method complements and extends the tenets of the agile...
Java Singleton Design Pattern
The Singleton Pattern is one of the commonly used design templates when there needs to be a control on how an object can be created. This design pattern proposes that at any time there can only be one instance of a singleton (object) created by the JVM. The Singleton classs default constructor is made private, which prevents the direct instantiation of the object by others (Other Classes).
Learning Polymorphism and Object Serialization
While most textbooks teach polymorphism by drawing UML diagrams, the Brainy Draw project encourages you to draw. While others make up hypothetical objects to use as examples for object serialization, we'll discuss the real need to persist your objects. The Brainy Draw project in this article is a fun way to learn polymorphism and object serialization.
Simply Singleton
The Singleton pattern is one of the simplest design patterns, but for Java developers, it's full of pitfalls. In this month's column, David Geary explores the Singleton pattern and how to deal with its pitfalls while discussing multithreading, classloaders, and serialization.
Oracle Magazine contains technology-strategy articles, sample code, tips, Oracle and partner news, an all-new Oracle Developer section for Java developers, and more.
subscribe now