wood burning stoves*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Design Patterns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Design Patterns" Watch "Design Patterns" New topic
Author

Design Patterns

HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Bob,
How would you introduce Design Patterns into any book or course teaching an OO language ?
Has GoF becomme less relevant as other languages replace C/C++ ?
Anti-Patterns also seem to have their place.

Here's an approach:
1: Try/Discover the Anti-Pattern first (occurs naturally, so it isn't that difficult to find)
2: Talk about the faults/risks.
3: Introduce the correct Design Patterns.

Would you agree ?
regards
[ September 11, 2003: Message edited by: HS Thomas ]
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Gof is still relevant today. The concepts are used in most of the J2EE patterns.


Groovy
Robert Martin
Author
Ranch Hand

Joined: Jul 02, 2003
Posts: 76
Originally posted by HS Thomas:
Bob,
How would you introduce Design Patterns into any book or course teaching an OO language ?


By example. Set up a design problem and then show how different patterns resolve the problem in different ways.
GOF is a relevant book, but not a tutorial. I've tried to take a more tutorial stance in "Agile Software Development: Principles, Patterns, and Practices" (http://www.objectmentor.com/PPP).


---<br />Uncle Bob.
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
I see you can move from Anti-Pattern to Pattern to Anti-Pattern as your problem evolves. And back to Pattern again.
Thanks.
And that there is not just a single Design Pattern for a problem.
I think there is an effort to list Design Patterns by problem.
Motivation, Consequences, Pattern. People tend to find the motivation that fits the problem and call that Design.
Would you agree to disagree with that approach .
Thanks
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
What you should realise is that most solutions are best implemented by having several patterns work together.
That is, unless you're talking about an extremely small very finegrained approach instead of taking a highlevel overview of a module.
You might have a factory implemented as a singleton for example.


42
Robert Martin
Author
Ranch Hand

Joined: Jul 02, 2003
Posts: 76
We don't *use* patterns. We don't face design problems and then look through a book to find the pattern that solves the problem. Rather, we work towards the solution of the problem until that solution begins to look like one of the patterns. When we are convinced that the correspondence is close enough, we change the names of the classes and variables to conform to the pattern. This helps others who read the code to recognize what is going on.
If you see a class named ClockObserver, you can be reasonably sure that is is part of the Observer pattern. If you see ModemDecorator or ParseNodeVisitor, you know what to expect. This is the true power of patterns. Patterns are more for the reader, than for the designer.
The designer finds that he is approaching a pattern, so to help the readers of his code, he makes that code conform to the pattern.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
That is what a good designer does, but many will decide first what pattern to use then religiously use them whether that choice was correct or no.
And most design books teach us to work that way, by placing the pattern central in the design and the actual code as being somehow relegated to a mere inconvenience obscuring the pattern from its glory.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

I think that applying both of them parallely would be better.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Design Patterns
 
Similar Threads
TDD starting OO
Tame Wild EJBs? (chapter 13)
what is anti pattern ?
Learning new technologies
Is the book best for beginning user?