2Design•We have discussed the specification and implementation of individual data abstraction•We have emphasized abstractions because they are the building blocks out of which programs are constructed. •Now, we discuss how to put them together to build good programs.
4DesignWe start a design with the requirements specification.Sometimes, it describe a single abstraction.Sometime, several that together make up the system. For example, the file system abstraction: the file and directory abstractionWe pick one of these abstractions to start work on. It becomes the initial target abstraction.
5Design Process•Select a target abstraction (eg. file or directory abstraction) whose implementation has not yet been studied.•Identify and inventing a number of helper abstractions that would be useful in implementing the target and that facilitate decomposition of the problem•Sketch how the helper will be used in implementing the target by providing a specification for each one •Iterate until the implementations of all abstractions have been studied.
7Search engine example (Requirements Specification)Allows the user to run queries against a collection of documentsDocuments are specified by a URL of a site containing the documentsUser should be able to search for a document with a particular titleUser should be able to search for a document with a query consisting of a keywordSome words (“the”,”is”) are uninteresting as keywords, the search engine knows about themA match of documents is ordered by the number of times a keyword occurs
9Document a DesignThe decision made during design must be recorded. The documentation should be kept in a design notebook.The design notebook contains:•a module dependency diagramshows code modules (classes & interfaces)