This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Design Patteren implemented in String?

 
par dhar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
par dhar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wonder if it also does Flyweight with the string pool.
 
Murali Mohan
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can somebody please suggest some good reading materials on design patterns. Preferably names of some good books having some good examples.
 
Sanjeev Singh
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go for Head First design patterns.
 
sachin yadav
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think spring heavily use Factory Design patteren apart from other patterens like Singleton.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic