Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Single pattern

 
rex tony
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Single pattern with simple example code in java
 
Jan Cumps
Bartender
Posts: 2586
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rex,
can you give a little more information. Your post is not clear to me.

Regards, Jan
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean Singleton?
 
rex tony
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the steps to implement Singleton Design pattern in our java class
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
rex tony
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks james i got some idea from your concepts.Can you tell me what are the pros and cons.
 
rex tony
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James,
Can you tell me all the design pattern procedure like this with pros and cons
 
rex tony
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James,
Can you tell me all the design pattern procedure like this with pros and cons
 
Kevin Smither
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2968
6
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic