Object-Oriented Design
Key Ideas
Object-Oriented Design is based on the position that the more
closely a program models the real world problem it represents,
the better the program will be. In many cases, the data
definitions on a project are more stable than the functionality
is, so building a design based on the data, as object-oriented
design does, is a more stable approach. Object-oriented design
uses several ideas that are important to modern programming.
The Four Object-Oriented Design Principles
- Abstraction
-ignore irrelevent details
-concentrate on what is relevent to the current process
- Encapsulation
-want to bind code and
data together
-done via classes
- Inheritance
-classes can inherit
properties and methods of
-100% encapsulated, hence safe code re-use
- Polymorphism
-use single interface for multiple
functions will come back to this later
Steps in Object-Oriented Design
- Identify the objects and their attributes, which are
probably data.
- Determine what can be done to each object.
- Determine what each object can do with other object.
- Determine the parts of each object that will be visible
to other objects, which part will be public and which
should be private.
- Define each object's public interface.
Examples of Bad and Good Programs in JAVA
Examples of Bad and Good
Programs in C++
Copyright 2000
Department of Computer Science, University of Regina.
[CS Dept Home Page]