aspose file tools*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Singleton in McGraw.Hill.SCEA StudyGuide Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Singleton in McGraw.Hill.SCEA StudyGuide" Watch "Singleton in McGraw.Hill.SCEA StudyGuide" New topic
Author

Singleton in McGraw.Hill.SCEA StudyGuide

Ethan Zhang
Ranch Hand

Joined: Mar 19, 2008
Posts: 46
When I read Singleton in McGraw.Hill.SCEA StudyGuide(P283), they are saying

Singleton Benefits:
1. controls access to a single instance of the class
2. Reduces name space usage
3. Permits refinement of operations and representation.
4. Permits a variable number of instances
5. Is more flexible than class methods (operations)


Comments:
1. easy to understand
2. OK, if you think it's a benefit.
3. I don't get it. Are they talking about it's better to use a specific method to get an instance than use new method??
4. As far as I know, Singleton means one instance, only one. Number of instances?? What are they talking about?
5. Again, I don't understand what kind of class methods(operations)?

Generally, although I had read Head First Design Pattern, I found it's a little bit hard for me to understand the benefits (P282~284). I knew a lot of people here recommended this book. When you read this part, did you have the same feeling like me?

I heard the new SCEA test is based on scenario question. If the real testing questions like this, I think it will not be easy for me to pass it.

Could anyone give me some suggestions?

Thanks in advance.

The Devil Wears Cartier Trinity
J J Wright
Ranch Hand

Joined: Jul 02, 2008
Posts: 254
I knew a lot of people here recommended this book


When it comes to design patterns I see no point in using this book. The points you list are lifted verbatim from the original GoF text on the Singleton pattern. I'd strongly recommend getting hold of a copy.

Permits refinement of operations and representation


You can subclass a Singleton and easily configure an applicate to use it in place of its parent.

As far as I know, Singleton means one instance, only one. Number of instances?? What are they talking about?


They're talking about the fact you can easily modify Singleton to permit the existence of more than instance. For example, a Singleton could maintain a pool of itself and control access to that pool through the same getInstance() method; clients would be none the wiser (although technically it would no longer be a Singleton).

Is more flexible than class methods (operations)


You can't override static methods

What this all boils down to is the fact it's better to use an object as opposed to static methods with regards to the kinds of problems Singleton addresses.


SCJP, SCWCD, SCBCD, SCEA 5
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Singleton in McGraw.Hill.SCEA StudyGuide