|Lesson 3||General rules for working with patterns|
|Objective|| Explore how to use a Pattern|
How To Apply Design Patterns when Designing Software
Once you have identified a design pattern that helps solve your problem, this Slideshow illustrates the steps to take to use the pattern effectively:
- The first thing you should do is study the pattern so that you are sure you understand it
- Map the generic pattern into your specific problem
- Adopting a pattern often requires you to add, remove and reorganize the classes and objects in your system
- You will need to implement the pattern in code. This is often the easiest part of programming with patterns.
If the Slide Show does not load properly, here is a General Rules for Working with Patterns .
In the analysis phase, a vague understanding of the problem is transformed into a precise description of the tasks that the software system needs to carry out.
The result of the analysis phase is a detailed textual description, commonly called a functional specification
, that has the following characteristics:
- It completely defines the tasks to be performed.
- It is free from internal contradictions.
- It is readable both by experts in the problem domain and by software developers.
- It is reviewable by diverse interested parties.
- It can be tested against reality.
Consider the task of writing a word-processing program.
The analysis phase must define terms, such as fonts, footnotes, multiple columns, and document sections, and the interaction of those features, such as how footnotes in multiple-column text should look on the screen and the printed page.
The user interface must be documented, explaining, for example, how the user is to enter and move a footnote or specify the font for footnote numbers. One possible format for an analysis document is a user manual, very precisely worded to remove as much ambiguity as possible.
Another common format for describing the behavior of a system is a set of use cases.
A use case is a description of a sequence of actions that yields a benefit for a user of a system.
At least in principle, it should be possible to enumerate all benefits that a system can confer upon its users and supply use cases that show how they can be obtained. The analysis phase concerns itself with the description of what needs to be done, not how it should be done. The selection of specific algorithms, such as those that insert page breaks or sort the index, will be handled in the implementation phase.
It is possible to use object-oriented techniques in the analysis phase as well as the design phase.
An advantage of that approach is that the object model of the analysis phase can be carried forward to the design phase.
A potential pitfall is that customers of a software product are generally not familiar with the terminology of object orientation.
Clients may not find it easy to tell whether the analysis will lead to a product that satisfies their needs.
Using Design Patterns - Quiz