It's not a secret anymore!
The moose likes OO, Patterns, UML and Refactoring and the fly likes Single pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Reply Bookmark "Single pattern" Watch "Single pattern" New topic
Author

Single pattern

rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
Single pattern with simple example code in java
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2343

Rex,
can you give a little more information. Your post is not clear to me.

Regards, Jan


OCUP UML fundamental
ITIL foundation
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35256
    
    7
Do you mean Singleton?


Android appsImageJ pluginsJava web charts
rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
What are the steps to implement Singleton Design pattern in our java class
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
The most common implementations use the following ingredients:

* Private constructor - prevents any other class from making an instance

* Static getInstance() method - gives clients a way to get the one instance

* Static variable - holds the one instance

Can you picture how those would work together? See if you can code something up and share what you make. It will be a lot more memorable than just copying an answer we give you.


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
rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
Thanks james i got some idea from your concepts.Can you tell me what are the pros and cons.
rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
James,
Can you tell me all the design pattern procedure like this with pros and cons
rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
James,
Can you tell me all the design pattern procedure like this with pros and cons
Kevin Smither
Ranch Hand

Joined: Oct 22, 2007
Posts: 30
gosh just google it, i'm sure you'll get 123456789 hits! sorry to be blunt but there is oodles of information out there on this pattern.
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
See OO, Patterns, UML and Refactoring FAQ: Singleton Pattern.


"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Single pattern
 
Similar Threads
Single Servlet vs. Multiple Servlet approach
Database connection
Question concerning the use of patterns
want to make only three objects of class
Difference Between Design Pattern and Architecture