Hello
There is pretty simple pattern, which make encapsulation of algorithms
Class diagrams, from different points of view.
Class Diagram
There is pretty simple pattern, which make encapsulation of algorithms
Class diagrams, from different points of view.
Class Diagram
Fig 1:class diagram without associations
Fig 2: class diagram with client associations
Fig 3: class diagram with associations inside of Startegy pattern
Explanations of class diagrams from point of view of Associations:
Fig 1: Nothing to say
Fig 2: Client should know only Context class because of client instantiate it. Client should know about all implemented algorithms, because of client instantiate context with specific algorithm.
Fig 3: Inside of pattern implementation, only Context should know about IStrategy, because of Contexts instantiated with IStrategy interface.
Fig 1: Nothing to say
Fig 2: Client should know only Context class because of client instantiate it. Client should know about all implemented algorithms, because of client instantiate context with specific algorithm.
Fig 3: Inside of pattern implementation, only Context should know about IStrategy, because of Contexts instantiated with IStrategy interface.
Code is example of calculations algorithms:
Using (as UniTest):
That's all
No comments:
Post a Comment