Design Patterns navigation (Design Pattern learning sequence)

Source: Internet
Author: User

Ref http://industriallogic.com/papers/learning.html#STUDY

Design Patterns navigation

LFactory method
Session 1

BeginFactory method. This pattern is used by a number of patterns in the book and throughout the patterns literature.

UStrategy
Session 2

StrategyIs used frequently throughout the book, and an early knowledge of it helps in understanding other patterns.

NDecorator
Session 3

For an early dose of elegance, nothing is better thanDecorator. The discussion of "skin" vs. "guts" is a great way to differentiate decorator from the previous pattern, strategy.

NComposite
Session 4

TheCompositePattern appears everywhere and is often used with iterator, chain of responsibility, interpreter, and visitor patterns.

UIterator
Session 5

Reenforce the reader's understanding of composite by studyingIterator.

UTemplate Method
Session 6

The author's footnote to iterator explains that a method called "traverse" in the iterator example code is an example ofTemplate Method. This pattern also reenforces strategy and factory method.

LAbstract Factory
Session 7

The reader now returns to the second-Easiest creational pattern,Abstract Factory. This pattern also helps reenforce factory method.

LBuilder
Session 8

The reader now may compare another creational pattern,Builder, With the abstract factory.

LSingleton
Session 9

SingletonIs often used to model abstract factories, as the "related patterns" section of Singleton describes.

NProxy
Session 10

The reader now has a chance to learn howProxyIs used to control access to an object. This pattern leads directly into the next pattern, adapter.

NAdapter
Session 11

TheAdapterPattern may be compared with what the reader understands about decorator, proxy, and later, Bridge.

NBridge
Session 12

Finally, the reader learns howBridgePattern differs from both the adapter and proxy patterns.

UMediator
Session 13

Now the reader learnsMediatorPattern, in preparation for understanding observer and the Model-View-controller design.

UObserver
Session 14

Discover how the mediator is used byObserverTo implement the classic Model-View-controller design.

UChain of responsibility
Session 15

After reading ing how messages are passed using the observer and mediator patterns, the reader now may contrast how messages are handled byChain of responsibilityPattern.

UMemento
Session 16

The reader now moves onMemento. This pattern leads directly into a discussion of Undo and redo, which is related to the next pattern, command.

UCommand
Session 17

TheCommandPattern is used in a number of ways, one of which relates to the previous pattern, mediator.

LPrototype
Session 18

Perhaps the most complex creational pattern,PrototypeIs often used with the Command pattern.

UState
Session 19

The reader may now studyStateTo understand another way an object's behavior changes.

UVisitor
Session 20

VisitorIs often combined with the composite and/or iterator patterns.

NFlyweight
Session 21

TheFlyweightPattern is one of the more complex patterns. An examples use of this pattern is described in the next pattern, interpreter.

UInterpreter
Session 22

TheInterpreterPattern is complex. It makes reference to and helps reenforce one's understanding of Flyweight and visitor.

NFacade
Session 23

The final pattern to read isFacade. Facade is relatively straightforward and follows nicely after interpreter since the example code is similar in theme to example code in the interpreter.

Factory method (Session 1)

How doesFactory methodPromote loosely coupled code?

Strategy (Session 2)

Part 1: What happens when a system has an explosion of strategy objects? Is there some way to better manage these strategies?

Part 2: In the implementation section of this pattern, the authors describe two ways in which a strategy can get the information it needs to do its job. one way describes how a strategy object cocould get passed a reference to the context object, thereby giving it access to context data. but is it possible that the data required by the Strategy will not be available from the context's interface? How cocould you remedy this potential problem?

Decorator (SESsion 3)

In the implementation section of the decorator pattern, the authors write:A decorator object's interface must conform to the interface of the component it decorates.

Now consider an object A, that is decorated with an object B. since object B "decorates" Object A, object B shares an interface with object. if some client is then passed an instance of this decorated object, and that method attempts to call a method in B that is not part of a's interface, does this mean that the object is no longer a decorator, in the strict sense of the pattern? Furthermore, why is it important that a decorator object's interface conforms to the interface of the component. It decorates?

Composite (Session 4)

Part 1: How does the composite pattern help to define lidate system-wide conditional logic?

Part 2: wocould you use the composite pattern if you did not have a part-whole hierarchy? In other words, if only a few objects have children and almost everything else in your collection is a leaf (a leaf can have no children ), wocould you still use the composite pattern to model these objects?

Iterator (Session 5)

Consider a composite that contains loan objects. the loan object interface contains a method called "amountofloan ()", which returns the current market value of a loan. given a requirement to extract all loans above, below or in between a certain amount, wocould you write or use an iterator to do this?

Template Method (Session 6)

The template method relies on inheritance. wocould it be possible to get the same functionality of a template method, using object composition? What wocould some of the tradeoffs be?

Abstract Factory (Session 7)

In the implementation section of this pattern, the authors discuss the ideaDefining extensible factories. Since an abstract factory is composed of factory methods, and each factory method has only one signature, does this mean that the factory method can only create an object in one way?

Consider the mazefactory example. the mazefactory contains a method called makeroom, which takes as a parameter one integer, representing a room number. what happens if you wowould also like to specify the room's color & size? Wowould this mean that you wowould need to create a new factory method for your mazefactory, allowing you to pass in room number, color and size to a second makeroom method?

Ofcourse, nothing wowould prevent you from setting the color and size of the room objectAfterIs has been instantiated, but this cocould also clutter your code, especially if you are creating and refreshing objects. how cocould you retain the mazefactory and keep only one makeroom method but also accomodate different numbers of parameters used by makeroom to both create and configure room objects?

Builder (Session 8)

Like the abstract factory pattern, the builder pattern requires that you define an interface, which will be used by clients to create complex objects in pieces. in the mazebuilder example, there are buildmaze (), buildroom () and builddoor () methods, along with a getmaze () method. how does the builder pattern allow one to add new methods to the builder's interface, without having to change each and E Very sub-class of the builder?

Singleton (Session 9)

The Singleton pattern is often seconds red with the abstract factory pattern. What other creational or non-creational patterns wocould you use with the Singleton pattern?

Proxy (Session 10)

If a proxy is used to instantiate an object only when it is absolutely needed, does the proxy simplify code?

Adapter (Session 11)

Wocould you ever create an adapter that has the same interface as the object which it adapts? Wocould your adapter then be a proxy?

Bridge (Session 12)

How does a bridge differ from a strategy and a strategy's context?

Mediator (Session 13)

Since a mediator becomes a repository for logic, can the code that implements this logic begin to get overly complex, possible resembling speggheti code? How cocould this potential problem be solved?

Observer (Session 14)

Part 1: the classic Model-View-controller design is explained in implementation Note #8:Encapsulating complex update semantics.Wocould it ever make sense for an observer (or view) to talk directly to the subject (or model )?

Part 2: What are the properties of a system that uses the objserver pattern extensively? How wocould you approach the task of debugging code in such a system?

Part 3: is it clear to you how you wowould handle concurrency problems with is pattern? Consider an unregister () message being sent to a subject, just before the subject sends a handle Y () message to the changemanager (or controller ).

Chain of responsibility (Session 15)

Part 1: How doesChain of responsibilityPattern differ from the decorator pattern or from a linked list ?.

Part 2: is it helpful to look at patterns from a structural perspective? In other words, if you see how a set of patterns are the same in terms of how they are programmed, does that help you to understand when to apply them to a design?

Memento (Session 16)

The authors write that the "caretaker" participantNever operates on or examines the contents of a memento. Can you consider a case where a caretakerWocouldInfact need to know the identity of a memento and thus need the ability to examine or query the contents of that memento? Wocould this break something in the pattern?

Command (Session 17)

In the motivation section of the Command pattern, an application's menu system is described. an application has a menu, which in turn has menuitems, which in turn execute commands when they are clicked. what happens if the Command needs some information about the application in order to do its job? How wocould the command have access to such information such that new comamnds cocould easily be written that wocould also have access to the information they need?

Prototype (Session 18)

Part 1: When shocould this creational pattern be used over the other creational patterns?

Part 2: explain the difference between deep vs. Shallow copy.

State (Session 19)

If something has only two to three States, is it overkill to use the state pattern?

Visitor (Session 20)

One issue with the visitor pattern involves into icality. When you add a new visitor, you must make changes to existing code. How wocould you work around this possible problem?

Flyweight (Session 21)

Part 1: What is a non-Gui example of a flyweight?

Part 2: What is the minimum configuration for using flyweight? Do you need to be working with thousands of objects, hundreds, tens?

Interpreter (Session 22)

As the note says in known uses, interpreter is most often used "in compilers implemented in object-oriented languages... ". what are other uses of interpreter and how do they differ from simply reading in a stream of data and creating some structure to represent that data?

Facade (Session 23)

Part 1: How complex must a sub-system be in order to justify using a facade?

Part 2: What are the additional uses of a facade with respect to an organization of designers and developers with varying abilities? What are the political ramifications?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.