Meaningless Drivel is fun!*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Best way to the pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Best way to the pattern" Watch "Best way to the pattern" New topic
Author

Best way to the pattern

Zhongwu Lin
Greenhorn

Joined: Mar 06, 2001
Posts: 11
Hi Alan,
Forgive me that I have not read your book yet. I am a java developer coming from C++.
But I have a generic question.
What is the best way to learn Pattern? and How?

I have read GOF's book and "Core J2EE Design pattern". (I don't like the latter too much)
I am reading some topics in refactoring and like it very much. I feel like I could gain more understanding of the patterns througn refactoring.
My struggle in learning Pattern is how to master all patterns and their relations since I only got to use a few of them in my projects.
Thank you
Mark Herschberg
Sheriff

Joined: Dec 04, 2000
Posts: 6037
I've found the best way to learn design patterns (and many other things) is to form a reading group. What was done at my last company, and what I do now at my current company is as follows.
Each week, we hold a 1 hour educational meeting, at a regular time. I ask for volunteers to present. Attendence is optional. How formal or informal the presentation is, is up to the presenter, could be powerpoint, could be a whiteboard. That's all it takes.

For design patterns, it's especially easy. Get a volunteer to present a pattern. Assuming your comapny has a copy of some design pattern book, photocopy the pages on the pattern choosen for the week (I think this is legal, but check with a lawyer), so people can read through it ahead of time. They only need to go through it and get a general sense, they don't need to understand every detail.
The presenter, on the other hand, puts in the extra time to really understand it. This way the presenter can answer questions from the others. In adidtion to covering what was in the chapter, the presenter should try to find some real world examples. Ideally, places in the company's source code where the design pattern either has been, or could be, used.
It allows people to learn design patterns with a minimal of effort on their part. It's also a great way to prevent misundertandings of the patterns.
--Mark
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Mark,
What if you can't get a group together. How would you go about it then.
Mark Herschberg
Sheriff

Joined: Dec 04, 2000
Posts: 6037
Hmm, good question.
Try contacting you local JUG (Java Users Group) and see if you can form a reading group outside your company. You could also try other trade groups, companies in your office complex, etc.
Assuming that you are on your own, I guess I would try the following.
Every week or two, assign yourself a new pattern. Read through it thoroughly. Summarize the results. (Maybe create a webiste for new pattern users.) I'd consider posting your summary (or URL to it) at JavaRanch, and asking for others to give you feedback to see if you got it right. If you're working on a project, see if you can apply it (again, you can tryng asking on JavaRanch, to see if you're applying it correctly). (Hey, maybe O'Reily needs a "design patterns in a nutshell" book :- )
Maybe try using 2 books at once. Well, first, check the books in the store, and make sure you can follow it. Different people respond well to different writing styles, so don't buy a book you can't easily follow. Even with an author you like, you may not get everything the first time through. By having a second book, you can re-read the information, but from a different perspective. (Of course, this is not always practical, given the cost of books.)
You may also wnat to check out this link: http://www.industriallogic.com/papers/learning.html
It's a learning guide for patterns.
Anyone else got ideas?

--Mark
Alan Shalloway
Ranch Hand

Joined: Sep 26, 2001
Posts: 60
Originally posted by Zhongwu Lin:
Hi Alan,
Forgive me that I have not read your book yet. I am a java developer coming from C++.
But I have a generic question.
What is the best way to learn Pattern? and How?

Boy, how can I answer this question without sounding self serving? Well here goes.
Ideally, the best way to learn patterns is to work in a group where they know patterns and pair program or at least ask people why they did it the way they did. Short of getting it on the job, study groups can work, but they can also be a waste of time. I have seen many study groups be very inefficient. If you've got someone who knows patterns then they can steer it along a little. (hey I got a javaranch term in there
Our course is another vehicle, but it's pretty expensive if you're not in our area.
Trying to use patterns on an actual problem is a good idea. After doing the pattern, see if you followed the implementation like they suggested. My first few times I didn't. I saw what was different and discovered I had serious misunderstandings about the pattern. However, after doing this a couple of times, I really learned how to code and design better.
We wrote out book to help people learn patterns when they couldn't get the knowledge elsewhere. Ongoing discussion groups like ours at www.netobjectives.com/dpexplained can help. You can ask questions and get answers about patterns.
We're considering writing a CD-ROM based patterns course that would walk you through implementation of several patterns but this project keeps getting put back
------------------
Alan Shalloway,
Look for Jim Trott and my book: Design Patterns Explained
Visit our site Net Objectives.
Visit our on-line companion to the book


Alan Shalloway.<BR>Look for Jim Trott and my book: <A HREF="http://www.amazon.com/exec/obidos/ASIN/0201715945/ref=ase_electricporkchop/103-0514572-3811868" TARGET=_blank rel="nofollow">Design Patterns Explained</A><BR>Visit our site <A HREF="http://www.netobjectives.com" TARGET=_blank rel="nofollow">Net Objectives</A>.<BR>Visit our <A HREF="http://www.netobjectives.com/dpexplained/index.html" TARGET=_blank rel="nofollow">Design Patterns Explained Community of Practice</A><BR>Check out our <A HREF="http://www.netobjectives.com/xml/xml_cdrom_info.htm" TARGET=_blank rel="nofollow">CDROM based audio training in XML</A>
ruilin yang
Ranch Hand

Joined: Feb 25, 2001
Posts: 334
Alan,
I feel that it is more important to know how to implement a pattern in real coding than the concept. The concept of each pattern is simple because we know the intention of the pattern. How to implement it make people lost.
Therefore, I always feel that a good pattern book should teach how to implement and make patterns tangible. For example what are various ways to implement a singleton pattern, etc.
Therefore, I image the best way to learn pattern is to work out various ways to implement a pattern in real design and coding.
please comments
Ruilin

[This message has been edited by ruilin yang (edited October 04, 2001).]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Best way to the pattern
 
Similar Threads
Design Patterm Doubt
Greetings - J2EE Design Patterns Applied
refactoring to pattern - howto choose pattern ?
Strengths/weaknesses of books on Design Patterns?
Comaprision...