This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Design Patteren implemented in String? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Design Patteren implemented in String?" Watch "Design Patteren implemented in String?" New topic
Author

Design Patteren implemented in String?

par dhar
Greenhorn

Joined: Nov 16, 2006
Posts: 11
Hi All,

Can anybody please let me know what design patteren is implemented in String class of JDK?

Regards
Parag
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

"Design patterns," generally, are a way of describing the relationships between classes. It makes little sense to ask what design pattern a single class implements, just as it makes little sense to ask what sound a single hand makes in clapping.

If you explain to us where you got the idea to ask this question, maybe we could help you to figure out the answer.


[Jess in Action][AskingGoodQuestions]
par dhar
Greenhorn

Joined: Nov 16, 2006
Posts: 11
I got this question from one intelligent(?!) developer...
Any way before asking this question I myself was not sure about this question.But I wanted to reconfirm my doubt.

But can you pls really confirm that String as a class does not implement any design patteren?
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
I think you can have a design pattern in a single class. The most common, though not necessarily good, example would be Singleton; this design pattern is often found in a single class.

I wonder if the "intelligent developer" was thinking of immutability. That is a particular implementation pattern, which solves certain problems, such as thread-safety. String is immutable (unless certain black arts are applied).


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I wonder if it also does Flyweight with the string pool.


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
Murali Mohan
Ranch Hand

Joined: Jan 09, 2006
Posts: 66
Can somebody please suggest some good reading materials on design patterns. Preferably names of some good books having some good examples.


Thanks,<br />Murali...
Sanjeev Singh
Ranch Hand

Joined: Nov 01, 2006
Posts: 381
Go for Head First design patterns.


~Sanjeev Singh<br />SCJP 1.5
sachin yadav
Ranch Hand

Joined: Nov 24, 2005
Posts: 156
I think spring heavily use Factory Design patteren apart from other patterens like Singleton.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Originally posted by Murali Mohan:
Can somebody please suggest some good reading materials on design patterns. Preferably names of some good books having some good examples.


Murali Mohan, please don't hijack someone else's topic to ask your question. We have a forum for general questions about patterns. Have a read through the topics in there, you should get some answers to go on.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Design Patteren implemented in String?
 
Similar Threads
Synchronized token patteren in J2EE
Spring and Singleton patteren
SCWCD Exam Question patteren
gof patteren reply Dave Vick
Can .NET applications use Dependency Injection?