• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

To AUTHOR: Compound Patterns

 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What are Compound patterns? I did not find this mentioned in GoF book?

Thanks
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, as far as I understand, compound patterns are made up by combinding other patterns and the patterns contained can be seen from the outside and being used for their proposed purpose. Because compound patterns contains several other patterns, they can usually be divided into several divisions right away.

But I can't think of the real implimentation of this pattern.
 
Mike Farnham
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know about being able to see all of the patterns from the outside, but I have seen the Command pattern combined with the Composite pattern. Basically, you say object.do() and it will do what needs to be done and tell all of its components, as well to do what needs to be done.

Also, I've combined the Singleton with a Factory method to return only one instance of many different possible DataSources. The Singleton just holds a list within itself. This is the ServiceLocator pattern from the J2EE Design Patterns book. But, the Factory is not obvious from the outside.
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mike Farnham:
I don't know about being able to see all of the patterns from the outside, but I have seen the Command pattern combined with the Composite pattern. Basically, you say object.do() and it will do what needs to be done and tell all of its components, as well to do what needs to be done.

Also, I've combined the Singleton with a Factory method to return only one instance of many different possible DataSources. The Singleton just holds a list within itself. This is the ServiceLocator pattern from the J2EE Design Patterns book. But, the Factory is not obvious from the outside.


I guess ServiceLocator pattern from the J2EE Design Patterns book works different way and if the Factory is not obvious from the outside, then it can't be corporated into compound pattern...
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See also http://wwwipd.ira.uka.de/~tichy/patterns/compound.html for a short explanation and two examples.
 
Elisabeth Robson
author
Ranch Hand
Posts: 173
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Model View Controller pattern is an example of a compound pattern - its composed of the Observer, Strategy and Composite patterns.

A true compound pattern is a combination of patterns that becomes a pattern itself - that is, it provides a general solution to a common problem. Just putting a bunch of patterns together in your code isn't a compound pattern.

Elisabeth
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic