Chapter 03
Chapter 03
One approach to help make the design process easier is the object-
oriented approach. This allows for the description of concepts in
the problem and solution spaces as objects—objects are a notion
that can be understood by both users and developers, because
object-oriented thinking applies to many fields. This shared
knowledge makes it possible for users and developers to discuss
elements of complex problems. Object-oriented programming with
object-oriented languages is therefore a popular means for solving
complex problems.
A good design does not just jump from a concept within the
problem space to dealing with it in the solution space. Object-
oriented design is no exception. As reviewed in Module 1, object-
oriented design consists of:
Object-Oriented Design | 21
These design activities happen iteratively and continuously.
Object-Oriented Design | 22
Evolution of Programming Languages
Object-Oriented Design | 23
Below is a table summarizing major programming paradigms in the history of programming languages.
Programming Time Solutions afforded Unresolved issues
Language period by Programming Language of Programming Language
COBOL and Fortran followed an imperative paradigm that broke up large If changes are made to the data,
COBOL 1960s
programs into smaller programs called subroutines. then subroutines might run into
Fortran cases where the global data is not
As computer processing time was costly, it was important to maximize what was expected. Better data
processing performance. To solve this problem, global data was used so management is needed to avoid
that data was located all in one place in the computer’s memory and these problems.
accessible anywhere for a program. This meant that subroutines only had to
go to one place to access variables.
Subprogram
B
Subprogram Subprogram
A C
Global
Data
Object-Oriented Design | 24
Programming Time Solutions afforded Unresolved issues
Language period by Programming Language of Programming Language
Algol 68 Early In the 1960s, global data was used. However, any changes to the data may Towards the mid-1970s, computer
result in issues for the subroutines. processing time became less
Pascal 1970s
expensive. At the same time, human
The solution introduced the idea of scopes and local variables – subroutines labour was more expensive and
or procedures could each have their own variables. became the more time-consuming
factor in software development. The
advances in computer processing
Procedure allowed more complex problems to
Procedure C
B be asked of computers. But it also
Nested Procedure
meant that software was quickly
Procedure Local Data growing, and having one file to
A maintain programs was difficult to
maintain.
Global
Data
These languages supported the use of abstract data type, which is defined
by the programmer and not built into the language. This is a grouping of
related information that is denoted with a type. This allows information to be
organized in a meaningful way.
By having data bundled and passed into different procedures through the
use of data types, this means that a procedure can be the only one that
modifies a piece of data. There no longer needs to be a worry that data will
be altered by another procedure.
Object-Oriented Design | 25
Programming Time Solutions afforded Unresolved issues
Language period by Programming Language of Programming Language
C Mid- By the mid-1970s computers were faster and able to tackle more complex It is not easy for an abstract data
problems. However, this meant that the programs of the past were quickly type to inherit from another in these
Modula-2 1970s
becoming too big to maintain. This led to new languages, that provided a languages. This means that
means to organize programs into separate files, and allow developers to although as many data types as
more easily create multiple, but unique, copies of abstract data types. wanted can be created, one type
cannot be declared an extension of
another.
Data Data
Procedure Procedure
A B Procedure C
Modules
For example, in the programming language C, each file contained all the
associated data and functions that manipulated it, and declared what could
be accessed through a separate file called a header file.
Object-Oriented Design | 26
Programming Time Solutions afforded Unresolved issues
Language period by Programming Language of Programming Language
Object- 1980s Although programs were become easier to manage through abstract data Object oriented programming is the
types, there was still no way to for data types to inherit from each other. The predominant programming
Oriented to
concepts of object-oriented design became popular during this time period paradigm now.
Programming present as a solution to these problems.
(Java, C++,
C#, etc.) Object-oriented design seeks to:
• make an abstract data type easier to write
• structure a system around abstract data types called classes
• introduce the ability for an abstract data type to extend another
through a concept known as inheritance
Data Data
Procedure Procedure
A B Procedure C
Classes
Object-Oriented Design | 27
Programming Time Solutions afforded Unresolved issues
Language period by Programming Language of Programming Language
Under this paradigm, software systems can be built of entirely abstract data
types. This allows the system to mimic the structure of the problem—in other
words, the system can represent real-world objects or ideas more accurately.
Object-Oriented Design | 28
Four Design Principles
Abstraction
Object-Oriented Design | 29
Context or a specific perspective is critical when forming an
abstraction. This is because context might change the essential
characteristics of a concept. For example, consider the essential
characteristics of the concept of a person. This can be hard to
understand without context, as this concept is vague and the
person’s purpose is unknown. But, in a gaming app, the essential
characteristics of a person would be in the context of a gamer. In a
running exercise app on the other hand, the essential characteristics
of a person would be in the context of an athlete. It is up to the
designer to choose the abstraction that is most appropriate to the
context of the software development, and the context must be
understood before creating an abstraction.
Object-Oriented Design | 30