File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Singleton in McGraw.Hill.SCEA StudyGuide" Watch "Singleton in McGraw.Hill.SCEA StudyGuide" New topic

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)

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.

I agree. Here's the link:
subject: Singleton in McGraw.Hill.SCEA StudyGuide
It's not a secret anymore!