Title: ObjectOriented Design
1Object-Oriented Design
Review Goals and Principles of OOP and Recursion
and Investigate Inheritance and Polymorphism,
Templates, and Exceptions
2Object-Oriented Design
- Challenge for software engineers create software
- that is itself complex
- that appears conceptually simple
- that is easy to integrate with other applications
- that allows for future modifications
- that can be written by a large team of
programmers
3Object-Oriented Design
- This methodology has been developed to address
the challenge of achieving a balance with regard
to producing designs that are - conceptually simple enough to understand
- powerful enough to solve hard problems
efficiently
4Goals and Principles ( 2.1)
- The fundamental goal of dealing with the
complexity of building modern software gives rise
to several subgoals and principles - robustness
- adaptability
- reusability
- abstraction
- encapsulation
- modularity
5Object-Oriented Design Goals ( 2.1.1)
- Researchers and software engineers agree software
implementations should achieve - robustness
- adaptability
- reusability
6Robustness ( 2.1.1)
The property that a software application is
capable of handling unexpected inputs that are
not explicitly defined for its application. Examp
le If an application expects a positive input
from a user, but is instead given a negative
input, the program should be able to recover
gracefully from this error! In life-critical
applications, where errors can lead to injury or
loss of life, software that is not robust is
deadly! http//courses.cs.vt.edu/cs3604/lib/Thera
c_25/Therac_1.html
7Robustness ( 2.1.1)
Robustness involves more than just handling
unexpected inputs. For example, a program should
be able to store more elements in a data
structure than originally anticipated. If our
Datatel system allowed for a limited number of
student records, then that could become a serious
issue for the institution (considering we need to
store transcripts indefinitely).
8Adaptability ( 2.1.1)
Most software, like word processors, is expected
to last for many years. Therefore it needs to be
able to respond to changing conditions over time.
This concept is adaptability. Software should
also be portablerun on different platforms.
9Reusability ( 2.1.1)
- Code should be usable as a component of different
systems in various applications to save - time
- money
- But not at the expense of correctness!
10Object-Oriented Design Principles ( 2.1.2)
- Main principles
- abstraction
- encapsulation
- modularity
11Abstraction ( 2.1.2)
- Reduce a complicated system down to its most
fundamental parts, and describe these parts in
simple, precise language. - name the parts
- describe their functions
- Abstract Data Type (ADT)
- a model of a data structure that specifies the
type(s) of data stored, operations supported with
types of parameters - specifies an interface (the what but not the how)
- realized by a concrete data structurea class
12Abstraction Example ( 2.1.2)
- Most GUIs provide an abstraction of an edit menu
that offers several text-editing operations,
including - cutdelete selected text and graphics and place
in external storage buffer - pasteinsert contents of external storage buffer
in selected location - Thus the abstract functionality of an edit menu
and its cutting and pasting operations is
specified in a language precise enough to be
clear, but simple enough to abstract away
details regarding implementation.
13Encapsulation ( 2.1.2)
Also known as information hiding, encapsulation
is a principle of OOP that states that different
components of a software system should not reveal
the internal details of their respective
implementations. The edit menu is useful since we
can completely understand how to use it without
knowing exactly how implemented. Programmer must
maintain the abstract interface users see, but
free to modify specific implementation.
14Modularity ( 2.1.2)
- Modularity refers to an organizing structure in
which different components of a software system
are divided into separate functional units. - helps to enable software reusabilitywhen modules
written in an abstract way to solve general
problems, code can be reused when instances of
same general problem arise in different settings - often involves a hierarchical system, grouping
together common functionality at the most general
level, and viewing specialized behavior as an
extension of the general one