• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Design Patteren implemented in String?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wonder if it also does Flyweight with the string pool.
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go for Head First design patterns.
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think spring heavily use Factory Design patteren apart from other patterens like Singleton.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic