Ralph E. Johnson, ``Documenting Frameworks using Patterns,'' in OOPSLA '92 (Vancouver), pp. 63-76. ftp://st.cs.uiuc.edu/pub/patterns/papers/documenting-frameworks.ps (PostScript) One of the earliest papers on patterns and pattern languages. The HotDraw framework itself was ``invented'' (in the words of RalphJohnson) by KentBeck and WardCunningham. (Does this make Ralph a MercenaryAnalyst?-) Each pattern starts with a motivation, a description of what's going on, and a prescription for the next design and coding activity. The patterns (really, the prescriptions at the end of each pattern) are: '''Semantic Graphic Editors:''' To design a drawing editor using HotDraw, first list the atomic elements of the diagram. Each one will be a subclass of Figure. Decide whether the drawing needs to be animated. List the tools that will be in the palette and make a subclass of Drawing Editor with a "tools" method that returns an array of the tools making up the palette. '''Defining Drawing Elements:''' Each drawing element in a HotDraw application is a subclass of Figure, and must implement "displayOn:", "origin", "extent", and "translateBy:". In addition, a subclass of Figure can implement any method needed by the application. '''Changing drawing element attributes:''' List the attributes of the drawing element that you want to edit. For each attribute, decide whether to edit it with a handle, an operation from the menu, or a tool, and update the "handles" method, the "menu" method, or the list of tools in the drawing editor. '''Complex Figures:''' Complex Figures should be a subclass of Composite Figure, and figures that display one of its aspects should be a component of it. '''Constraints:''' Each constraint in a drawing should be represented by a constraint object. '''Making new kinds of handles:''' A handle that changes only an aspect of its figure when it is dragged is an instance of Track Handle. A handle that changes an aspect of all the selection figures when it is dragged is an instance of Selection Track Handle. A handle that creates a line from its figure to another figure is a Connection Handle. Handles that perform other functions will need to be new subclasses of Handle. '''Embedding a drawing in another program:''' Make a drawing part of a complex application by making a Drawing View be a subview of the application's view and giving the Drawing View a model that responds to Drawing Editor protocol, i.e., that implements the "currentTool", "menu", "drawing", and "drawing:" methods. '''Tools:''' The "tools" method of the Drawing Editor defines the tools that will be on the palette by returning an ordered collection of tools, which are instances of subclasses of Tool. '''Animated drawings:''' Animate a drawing by making a subclass for it that defines the "step" method to perform the next step in the animation. '''Adding lines:''' The user should create lines that connect figures by pressing a Connection Handle on one of the figures. Connection Handles can be parameterized so that connecting two figures with a line can perform some other action on them as well as adding a constraint or testing whether a connection is allowed. ----- [CategoryFramework]