Object-oriented design is focused on identifying objects and operations.
Here's a high-level view of the process:
I personally start by parsing the statement of the problem (from its
original form as a paragraph of English) into nouns and verbs,
eliminating redundancies, and creating a mapping between nouns and
data structures and verbs and transformations of data structures.
- Paul Fisher (ap-compsci, 8/98)
Identifying Objects (and Classes)
- Identify the nouns (objects) in the problem description.
- Identify more objects in your developing problem solution.
(Design is incremental and iterative! --
- From these objects, determine what new types (classes) you need.
Example: BlackJack Program
- a deck
- a dealer
Sample Design Questions:
- Do different cards represent different types? Or are suit and rank attributes of a single card type?
- Are the dealer and player instances of the same class? I.e., objects of the same type?
- Should there be a separate Hand class?