Real life, non-programming 'implementations' of design patterns
I am having a hard time trying to understand some of the design patterns, particularly the differences between some of them, such as proxy, delegate and adapter. Since design patterns are supposed to be discovered, I am trying to discover their 'implementations' in the non-programming world.
Should an ATM be considered a facade for a bank or rather an adapter? Is a member of parliament (in an ideal world) an example of a delegate 开发者_StackOverflowpattern or a proxy? Is bureaucracy an example of chain of responsibility? Is the stock market an example of the observer pattern? What would be an example of the strategy pattern?
Could you please share the analogies you have found for some specific patterns? I am looking for examples which would be as unambiguous as possible.
My intent is to find, if possible, examples to mainstream patterns, in a form that would help in their understanding and application in software development.
Design patterns in software have their origins in architecture; specifically, the book "A Pattern Language" by Christopher Alexander. While not directly analogous to the patterns described in the GOF "Design Patterns" book, Alexander describes patterns specific to design in the real-world in the same spirit.
Interesting question. Following is what I could think of:
Template Method: Certain rituals that we follow would be example of Template.
Factory: This would apply to any manufacturing arm. It produces goods and encapsulates the logic of producing.
Chain of responsibility: Almost anything that needs approval in office falls under COR.
Strategy: Airline booking policies are a real world example of strategy. It varies from season to season.
Singleton: Me as a person is only one in the universe :-). So I would be singleton.
精彩评论