File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Java Design patterns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Java Design patterns" Watch "Java Design patterns" New topic

Java Design patterns

rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
Good evening to all
Any one can explain the java design pattern very simply, With example
Marcus Green
arch rival

Joined: Sep 14, 1999
Posts: 2813
Design patterns are not on the SCJP book, and even if they were it is a subject far to big for a single post. Why not see if you can find an appropriate forum and then ask a more specific question.

SCWCD: Online Course, 50,000+ words and 200+ questions
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3381

Moreover, Design Pattern is not a single and simple thing to be explained in a single post.

Design Pattern is an abstract term for a proven solution which solves the common problem in an efficient manner. There are many problems faced, many solutions as well thereby you get many Design Patterns.

You may please refer this link for a good start. Perhaps, a Google Search would also help!

Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3381

As this post has nothing to do with SCJP forum, moderators would move it to the appropriate forum.
Henrique Ordine
Ranch Hand

Joined: Sep 03, 2004
Posts: 127
An example of one of the simplest design patterns (in my opinion):

The Singleton

Problem: you need to restrict instantiation of a class to one object.

Exampe implementation:

public class MyClass {
/*Private constructor suppresses generation of a (public) default constructor*/
private MyClass() {}

* instance is loaded on the first execution of Singleton.getInstance()

private static MyClass instance;

public static MyClass getInstance()
if (instance == null)
instance = new MyClass();
return instance;

All client code would have access to the same object by calling:

J2EE Architect/Developer
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Bruce Eckell has a patterns book using Java. SeeThinking In Patterns.

It's good to have a good overview knowledge of these things so you can recognize problems that have pattern solutions. If you have a pretty good idea of what each one is for, you can find it and dig out the details when you really need it. After a while you'll learn to spot things in your code that resemble some pattern or other, and maybe bend your design in that direction to make it easier for future readers to spot.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: Java Design patterns
It's not a secret anymore!