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 pattern

 
anita dhar
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
i am new to design patterns .can any one tell me in what way i can use the design patterns . can any one give me example for it

Thnaks
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you first tell us which other online resources have you read about design patterns. For example, the Wikipedia page or this tutorial?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way, Joshua Kerievsky from Industrial Logic has written a learning guide for design patterns based on the "Gang of Four" book, which many consider to be the bible of design patterns literature. There are other books available, however, that may be more to your liking if you're more into Java than C++.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Patterns are common solutions to common problems. It's good to be familiar enough with them to recognize when you have one of those problems. Then you can consult the pattern and see if the solution fits. Some times it happens the other way. You don't recognize the problem but you recognize your code is starting to look like one of the solutions. Then you might consult the pattern and see if there is anything you haven't thought of yet. If the pattern looks appropriate, you might rename and restructure your code to look more like the pattern. That will help future readers spot it and identify what you're doing at a higher level. There's even a whole book called Refactoring to Patterns that might be a great read right now.

When I first became aware of the Gang of Four book, one of my colleagues breathlessly told me he had built reference implementations of all of them. This turned out to be quite useless except for making him read the book carefully. You almost never apply the solutions exactly as they are in the book, and they'll almost always require some customization and translation into whatever problem and language you have.

The last thing you want to do is get excited about the latest pattern you read and go hunting for a place to apply it. It's common to try to hammer a pattern into a hole where it doesn't fit. I'm probably guilty of having a few favorites I use too often; I try to keep that in mind and stop before I abuse something.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joshua Kerievsky's Refactoring to Patterns
Addison-Wesley Professional
amazon US

isn't targeted towards an audience that is new to design patterns. A good understanding of the patterns he references and the process of Refactoring is assumed.

Often people dive head long into patterns before developing a good understanding of The Principles of OOD on which Patterns are ultimately based on. Mastery of the principles of OOD is far more beneficial then memorizing a number of patterns. However patterns are very useful as a communication tool as they allow the more efficient (higher level of) exchange of ideas in the spoken or written word.
Other than that Apply Patterns Gently.
[ July 18, 2007: Message edited by: Peer Reynders ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic