Linda, Since you are clearly familiar with so many patterns, what, in your opinion, are the 10 most frequently used patterns in Java? I suspect Singleton, Facade and Observer would make the list. But I'm guessing that there will probably be a few that I don't know on the list.
I bet Factory and Abstract Factory will be in the Top 10 too. -Mirko
[This message has been edited by Mirko Froehlich (edited January 31, 2001).]
Alan Shore
Ranch Hand
Joined: Apr 16, 1999
Posts: 147
posted
0
How about Mediator, Command, and Delegate?
Roseanne Zhang
Ranch Hand
Joined: Nov 14, 2000
Posts: 1953
posted
0
How about Composite, Proxy and Iterator, we used them long before the name of Design Pattern came into play.
Linda Rising
Author
Ranch Hand
Joined: Jan 21, 2001
Posts: 76
posted
0
Originally posted by Paul Wheaton: Linda, Since you are clearly familiar with so many patterns, what, in your opinion, are the 10 most frequently used patterns in Java? I suspect Singleton, Facade and Observer would make the list. But I'm guessing that there will probably be a few that I don't know on the list.
Hi Paul, One of the parts of the Alamanac that I am most happy about is the list of experience papers that follow each pattern. These are published reports of actual use of the pattern. I'm not sure how many of these papers were written by Java users but using the number of papers as an indicator of over-all use it's easy to see that the patterns in the GoF book lead the others. I don't think this is because they are better than the others -- only more well known. Here's the list of GoF patterns in order of use with the most used listed first and equal numbers of uses on the same line: Adapter Composite, Strategy Observer, State Command, Mediator, Singleton Abstract Factory, Factory Method, Facade Template Method, Visitor Builder, Prototype, Bridge, Proxy Decorator, Memento Iterator Flyweight, Interpeter had no experience reports I think we need more experienced users to tell about their experience. We all learn more when he hear how someone used a pattern to solve a real problem *and* when a detailed example in a particular domain is given. Thanks for an interesting question!
Linda Rising<br />Author of <a href="http://www.awprofessional.com/title/0201741571" target="_blank" rel="nofollow">Fearless Change</a>
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
I'd like to add the Acceptor/Connector pattern to this list. I think that it's very useful for client/server application in the telecom industry.
John Wetherbie
Rancher
Joined: Apr 05, 2000
Posts: 1441
posted
0
Is Acceptor/Connector something that Doug Schmidt came up with in connection with ACE or am I thinking of something else? John
The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
Tiger Scott
Ranch Hand
Joined: Mar 01, 2001
Posts: 223
posted
0
Top 10 patterns in my experience are: Abstract Factory, Factory Method Observer Mediator Singleton Facade Iterator Template State Composite Adapter My .02 HTH Sanjay
Huasong Yin
Greenhorn
Joined: Feb 08, 2001
Posts: 6
posted
0
Dont forget Strategy and Decorator! Decorator is heavily used in AWT and Swing. ScrollPane and JScrollPane are Decorators. The high-level Stream classes are also Decorators. The LayoutManagers are Strategies.
Jim Baiter
Ranch Hand
Joined: Jan 05, 2001
Posts: 532
posted
0
If you want an obscure one, I really like Transfer Vector which comes from the Shlaer-Mellor methodology way back when. This states to define your subsystems/components (they called these domains) in your system and derive a generic type that can be used for communication between the subsystems. The "wormhole" is the particular entry/exit point from the domain and the bridge is the transfer method. This was all conceived before GoF - it is interesting to examine.
Darpesh Patel
Greenhorn
Joined: Feb 08, 2001
Posts: 5
posted
0
Jim, it would be interesting if you would expand on Transfer Vector.
Darpesh Patel
Greenhorn
Joined: Feb 08, 2001
Posts: 5
posted
0
Jim, it would be interesting if you would expand on Transfer Vector.
David Roberts
Ranch Hand
Joined: Nov 03, 2000
Posts: 142
posted
0
1. TYPED MESSAGE may not be official yet but it's primary example is taken directly from the Java Event Handling model. 2. ITERATOR is directly supported by the Java2 API. (Look at Iterator Interface and ArrayLists) 3. DECORATOR is used in Swing. (Look at JScrollPane and any component that scrollable) 4. OBSERVER is used directly by the Java2 API. (Look at, Observer, Observable) 5. ADAPTER is an obvious one if you've use Anonymous inner classes, (see WindowAdapter) And much more, Im sure. Out of the orginal 23 GoF patterns, I'm guessing most of them or some variation is not only used in Java2 by developers but even directly implemented like the ones above. ------------------ David Roberts, SCJP2 [This message has been edited by David Roberts (edited March 14, 2001).] [This message has been edited by David Roberts (edited March 14, 2001).]