Unformatted text preview:

Using Patterns to Document FrameworksDesignDesign DocumentationUsing Patterns for DocumentationHotDraw: A Framework for Graphics EditorsOverview of Derivation of HotDrawModel-View-ControllerCompositeStateSlide 10Slide 11EditorSlide 13What is a Pattern?Slide 15ObserverCollect DamageSlide 18Update at User SpeedSlide 20Slide 21DecoratorSlide 23Summary of Derivation of HotDrawUsing Patterns to Document FrameworksFrameworks contain patternsPatterns are design decisionsDesignDesign is a set of choices.Choices made one at a time.Ideally, all choices are correct.Each choice based on current information.Design DocumentationNeed to learn a bit at a time.Need to know why a decision was made.Know when to change it.Know how to adapt to it.Using Patterns for DocumentationPatterns can describe how to use a system.Documenting Frameworks Using PatternsPatterns can describe the design of a system. A sequence of patterns, one for each design decision.Patterns Generate ArchitecturesHotDraw: A Framework for Graphics EditorsOverview of Derivation of HotDrawModel-View-Controller user interfaceComposite Design PatternsState Design PatternsEditor (to operate on drawing)Observer Design PatternsCollect Damage user interfaceUpdate at User Speed user interfaceEditor (to operate on figure)Decorator Design PatternsModel-View-ControllerDrawingDrawingDrawingViewDrawingViewDrawingControllerDrawingControllerCompositeDrawing contains many figures. Make Drawing be a composite figure.FigureFigureDisplayDisplayDrawingDrawingDrawingDrawingEllipseFigureEllipseFigureStateAllow an object to alter its behavior when its internal state changes. The object will appear to change classes.Make a class hierarchy that models the different kinds of states that client could be in.Client points to its "current state". Client delegates all state-dependent behavior to current state.Tools are the "current state" of the DrawingController; it delegates operations to the current state.FigureDisplayDrawingDrawingControllerToolDrawingcurrent toolEditorWho creates the tools that the DrawingController will use as states?Different drawings will need different Tools. Make Drawing responsible for knowing Tools that can operate on it.FigureDisplayDrawingDrawingController ToolDrawingcurrent toolDefault toolsWhat is a Pattern?Is Editor a pattern, or a combination of patterns?Con: same as using Factory Method to produce an Adapter.Pro: Editor has a unique intent; to provide a common interface to a heterogenous collection of objects.What is a Pattern?Are two patterns with the same solution the same pattern?Are combinations of patterns also patterns?ObserverEach Figure knows its dependents, and notifies them when it changes state.Dependents of a figure include its Drawing, so the Drawing can redisplay itself if a figure changes.Collect DamageHow do you display as little as possible?Have the graphics system keep track of the part of the image that has changed, a “damaged region”. Every time a part of the image changes, add its area to the damaged region. Redisplay the changed region when possible.FigureFigureDisplayDisplayDrawingDrawingDrawingViewDrawingViewToolToolDrawingDrawingcurrent toolcurrent toolDefault toolsDefault toolsDrawingControllerDrawingControllerDamaged regionDamaged regiondependent modeldependent modelUpdate at User SpeedUpdate too fast, and all the time is spent doing graphics.Update too slow, and animation is jerky.Update the drawing at the same speed that the user makes gestures. Redisplay the drawing once for each user event.EditorHow to operate on Figures?Ask Figures for their handles and then operate on the handles.FigureFigureDisplayDisplayDrawingDrawingDrawingViewDrawingViewToolToolDrawingDrawingcurrent toolcurrent toolDefault toolsDefault toolsDrawingControllerDrawingControllerDamaged regionDamaged regiondependentdependentmodelmodelHandlesHandlesDecoratorShould handles go in the Drawing? No - 2 views of a drawing. In the View? This makes views complex.Make a Drawing Decorator class (SelectionDrawing) to hide and show sets of handles.FigureFigureDisplayDisplayDrawingDrawingDrawingViewDrawingViewToolToolDrawingDrawingcurrent toolcurrent toolDefault toolsDefault toolsDrawingControllerDrawingControllerDamaged regionDamaged regiondependentdependentHandlesHandlesSelectionD.SelectionD.HandlesHandlesmodelmodelSummary of Derivation of HotDrawHow I wish I had done it.Rational design.Describes "why" of a feature, not just how it is implemented.Lots of different kinds of patterns are


View Full Document

UIUC CS 497 - Using Patterns to Document Frameworks

Download Using Patterns to Document Frameworks
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Using Patterns to Document Frameworks and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Using Patterns to Document Frameworks 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?