(2/3/05) Discuss
or
from JBuilder and
Model-Code-Deploy from VP-UML.
(3/27/06) Incorporate Agile Modeling? See Scott Ambler's Web site.
Use as a text for permanent version of course?
(3/29/06)
Incorporate
Bruegge & Dutoit's UMLs of (1) Software
Engineering Concepts and (2) S.E.
development activities?
(10/22/04) Incorporate Chap 1 from O.O. S'ware Engineering, by
Bruegge & Dutoit, esp. Fig.1-2.
(3/28/04) Use as exercise: Critique of Designing
with Objects.
RUP, Ten Essentials: http://www.rational.com/products/whitepapers/413.jsp#1;
PDF
version.
Italics
indicates material that needs to be modified or rewritten.
Last
Major Updated: 10/11/03;
3/27/06
Under Development; still only a draft/prototype



LEARNING MODULE VIII
OVERVIEW OF
OBJECT ORIENTED SOFTWARE
DEVELOPMENT
(OOSD)
Throughout
the preceding learning modules we have been learning how to implement
the
OOSD constructs using Java,
and to a lesser extent, C++.
This really implies that we already
know
how to develop OO software, and, indeed,
the
prerequisites to this course is a knowledge of OOSD using C++ Java.
However,
too often,
students learn to develop OO software in a 'bottom-up"
strategy,
i.e. they learn how to implement the details of algorithms and OO models
before really considering the development of software architectures
consisting
of related classes. Therefore, in this LM, having covered all the
OOSD constructs and their implementation in Java, we attempt to
synthesize
and generalize all of the OOSD techniques we have been using up to
now.
To start, we should review the basic ideas of OOSD.
Software development in an
object
oriented environment is more complicated that the traditional
structured
program development strategies because OOSD is a super set of
structured
program development, i.e. the
"programming" is relegated to defining the operations that specify the
behavior of each class. Before defining behaviors, one must
create
"templates" for each abstract objects that have these behaviors.
Therefore, one has to first create a software architecture of
encapsulation
constructs (
(1a),
(1b), and
(1c)) and define the relationships (
(2a),
(2b),
(2c),
(2d),
(2e), and
(2f)) between these constructs before defining the
operations
that specify the object's behaviors. Thus, from the simplest
viewpoint,
one can say that OOSD involves designing a
____ (3a)
of
____ (3b),
then
(3c) these constructs, and
(3d) associated with these constructs. To do this
in a, standard language-independent way, one should:
- use the UML to
develop the architecture
of your software (Note that the UML does NOT include strategy for
software
development - on purpose; it was designed to be applicable to any
strategy.
However, there is a Rational
Unified Process (RUP), designed by Ivar Jacobson that
specifies
a strategy for OOSD that complements the UML.) and
- use structured
algorithm
development
techniques, e.g. SACs, flowcharts, pseudocode, etc.) to
develop
the operations that define object behaviors
OOSD includes all of the ideas
of structured programming plus new OO facilities for
(4a),
(4b),
(4c), and
(4d); review the Introduction
of LM I. LM VIII is a summary of OOSD as part of
system
development with an emphasis on the new features of OOSD that have
been added to those of traditional (structured) program development.
If
you are an independent learner (not enrolled in the current class COSC
390 at FSU), then, before proceeding, consult the study
guide for this module.
The
objectives of this learning module are:
- Summarize
the overall strategy of system development, of which software
development
is a part
- Survey
the fundamental concepts of OOSD
- Introduce
the Rational
Unified
Process (RUP), the OOSD complement to the UML
TPQ
1: Rewrite the preceding objectives in terms of personal
accomplishments
to be attained after finishing the study of this learning module.
The
sequence of presentations in this learning module is as follows.
You can click on any link to jump directly to that section.
- THE
SYSTEM DEVELOPMENT LIFE CYCLE INCLUDES SOFTWARE DEVELOPMENT
- FUNDAMENTAL
CONCEPTS OF OOSD
- SOFTWARE
DEVELOPMENT CYCLE
- OBJECT
ORIENTED ANALYSIS AND DESIGN
- GENERIC
PHASES OF SOFTWARE DEVELOPMENT
- GUIDELINES
FOR DEVELOPING AND RELATING CLASSES
1.
THE
SYSTEM DEVELOPMENT LIFE CYCLE INCLUDES SOFTWARE DEVELOPMENT.
- Software
development
is a part
of the System Development Life Cycle.
- When produced
in-house, initial software
development occurs in the Systems Development Phase of the
system
development life cycle.
- Software
development,
in practice,
does not end with the completion of the Systems Development Phase but
is
an unending cycle occurring within the Systems Maintenance Phase; see
section 2, below.
2.
FUNDAMENTAL
CONCEPTS OF OOSD:
- The practical goals of OOP are:
- to maximize developer efficiency via
the reuse
of code.
- to maximize robustness via access
control and information
hiding.
- to facilitate portability via encapsulation.
- to encourage generality in programs
via polymorphism,
etc.
- The most fundamental tasks of OOSD are the
decisions:
- what classes to use, i.e. identifying
the
objects
that must be modelled with class constructs,
- what to include within each class (
(5) of
(6) and
(7)) in order to implement
a software architecture of highly
(8)
classes. (In Java this is extended
to
considering what classes should be
(9)
within
what packages.)
- what protection (visibility) to associate
with
each property
(
(10)),
- and how to relate classes ( according to
__________, __________
,or
(11)) while implementing a
(12)
collection of classes and packages
- In developing relationships between
classes,
there
is a fundamental OOA/OOD choice between (1) inheritance and (2) "incorporation"
(Tony's word used to include association/aggregation/composition, and
dependency).This
is complicated by the fact that:
- there are, at least, two ways that
inheritance is manifasted
-
(13) ., i.e. defining a
class-superclass
relationship (using one heading with inheritance specifiers)
-
(14), i.e. inheriting the responsibility to
define
members declared in abstract classes or interfaces.
- there are at least five ways a class can incorporate
another class (complicated by the difference between
aggregation/composition
and dependency!), as:
- an attribute, i.e. a class is used
to
declare the
(15) of an attribute,
- an argument, i.e. a class is used
to
declare the
(15) of a method argument,
- a return type, i.e. a class is
used to
declare the
(15) of the quantity returned by a functional
method,
- a local variable, i.e. a class is
used
to declare
the
(15) of a local instance (within a class method),
and
- the address of a pointer (not in
Java
because java
uses declaration by reference as a default).
TPQ:
Is-A point a circle with zero radius, or Is-A circle a point with a
finite
radius, or Is-A circle a 2D objects that Has-A radius?
SAQ:
Associate each of the syntax categories in section C with a class
relationship.
3.
SOFTWARE DEVELOPMENT CYCLE:
3.1 PHASES OF SOFTWARE
DEVELOPMENT:
- Regardless of
whether
software
is developed commercially or as part of the systems development life
cycle
the strategy involves the following generic phases
- Analysis
of
the task
Note:
some versions call this stage "specification" and combine analysis with
design, but the terms used here are more common conform to the Ration
Rose
diagrams shown in Figures OOSD-2 and OOSD-3.
)
- Design of
the
Model that represents the task execution.
- Implemention
of the design
in code (construct the software)
- Testing
(debugging the
software, its architecture, and its implementation)
- Documention
- Deployment (Evaluation
and Maintainence)
- The Objectory,
designed
by one of UML's three amigos, Ivar Jacobson and sponsored by Rational
Rose,
has basically the same ideas (called "workflows") that sequenced in four
phases, inception, elaboration, and construction.
- The objectory is
based on three
key ideas. It is:
- use-case
driven,
- architecture-centric,
and
- systematically
tested.
THE
RATIONAL
UNIFIED PROCESS SOFTWARE DEVELOPMENT LIFECYCLE
Distribution
of
Workflows (Vertical) In Relation to Phases (Horizontal)
|
 |
| from The
Unified Modeling Language, by Booch, Rumbaugh, and
Jacobson,
Addison Wesley, p34. |
- The
Objectory
takes new requirements as input, and produces artifacts in the UML
as
output. The work to produce a new release is divided into
four
phases:
- Inception
establishes core architecture, identifies and reduces critical risks,
and assures feasibility.
- Elaboration
establishes mainline architecture, identifies and reduces signiicant
risks,
and plans and estimates the construction phase.
- Construction
builds product in a series of iterations, resulting in increments or
builds.
- Transition
moves the product into the hands of users.
- Within
each phase, architects and developers carry iterations through a set of
workflows.
- Modeling
- Requirements
capture based on use cases (producing,
primarily, UML use case diagrams)
- Analysis
and design, including an architecture (producing,
primarily, UML class diagrams)
- Implementation
- Testing and
debugging
- Deployment
- For an
introductory summary
to RUP (from which the preceeding discussion comes), see the
handout, Objectory
Is the Unified Process, by Ivar Jacobson, Object
Magazine,
april, 1998, p. 72.
- Note that modern
strategies
for software development are NOT linear, i.e. the preceding phasess
(both generic and Objectory) are not performed in a strict sequence,
like
the "waterfall method" (See the top illustration in Fig.
OOSD-1.). Instead they are part of an iterative
process (involving nested, repetitive subphases containing some or
all
of the
preceding phases) conducted on each independent part of a software
application.
(See the bottom illustration in Fig.
OOSD-1.)
However, these phases are all essential to software development and are
performed, usually in an iterative manner, in all states of software
development.
3.2
STRUCTURED PROGRAMMING PHASES (These still apply to
Operation/Method
development in OOSD!):
- In the structured
programming
approach to the phases of software development the developer must:
- Analyze
the
Task and specify its
Input/Output requirements.
- Specify the
required input
data and its mechanism, e.g. CLI, GUI, files, etc. (In
operations/methods
these would be arguments.)
- Specify the output
information
and how it is to be presented
- Specify the operations
that process the input into output (Note that this
functional/procedural
approach is fundamentally
different than an object oriented approach)
- Design the
Logic, using
a top-down strategy (using SACs, flowcharts, pseudocode, etc.;
see
section 3.2.B, below.).
- Define first
level module
(the program)
- Refine the
design, stepwise,
by modulariation (organizing self-contained logic in highly
cohesive
procedures and functions).
- Deskcheck
(trace) and
debug the various possible program threads
- Implement the
logic,
top-down, in code using a computer language.
- Code the program and its modules
(procedures and functions) using "stubs"
for untested modules
- Test and debug with each newly
coded module
- Test and debug
- Document (This
important
phase is often omitted, as in the illustrations below, but should not
be
ignored by the software developer!)
- Evaluate and
Maintain
- This
"programming" is
based on algorithm development in the analysis and design phases.
This is illustrated in the most basic of computer algogrithms, the Input-Proces-Output
sequence, presented by the following flowchart.
INPUT-PROCESS-OUTPUT ALGORITHM
in Flowchart form
|
|
|
The programming cycle is, conceptually, separated
into
a language independent phase (analysis/design) and a language
dependent phase (implementation and testing/debuging). (This
separation
is irrelevant to the Documentation phase.)
3.3 OO PHASES OF SOFTWARE DEVELOPMENT:
(
Compare
the specifices of the following phases with those of section
3.2, above and Figure
OOSD-2.)
- Analyze the
Task and specify its
abstract objects and their interrelationships (Compare with the
Analysis subcycle
of Figure
OOSD-2A.)
- Identify the conceptual objects
(distinct, highly-cohesive components) that represent the task
domain
and the roles of each object. (Utilize the uses case diagrams of
the
UML)
- Identify the conceptual
object elements
that specify its state (UML attributes) and behavior (UML
operations)
- Identify the relationships
between conceptual objects that facilitate a loosely coupled
architecture of classes.
- Design the
Software
Architecture, using the UML using a top-down strategy.
(Compare with the Design subcycle of Figure
OOSD-2B.)
- Develop a
model that
implements the specifications from the Analyze/Specify phase.
- Define first
level
- classifiers
(modules, i.e. classes, interfaces, and
packages.)
- relationships
between classifiers
- Specify
classifier details
- declare
attributes
- define
methods (UML operations)
that represent behavior
- declare
relationships
that minimize redundancy (efficiently reuse classes and their
elements),
e.g. inheritance.
- Refine,
stepwise, the
architecture by repeating the first level activities for other classes
and packages.
- Deskcheck
(trace) and
Debug
- Implement
the
architecture,
top-down, in a computer language.
- Code classifiers using "stubs" for
untested classifiers and/or methods
- Test and debug with each newly
coded classifiers
- Test and debug
- Document
- Deployment (Evaluation
and Maintainence)
This linear sequence of
phases
(waterfall process, Fig. OOSD-1, top
illustration)
would only apply in the simplest of tasks; normally they would be
nested
within iterative modules (Iterative Development Lifecycle, Fig.
OOSD-1, bottom illustration). These separate activities
are
discussed in more detail in the following sections:
3.4 DIFFERENCES BETWEEN STRUCTURED AND
OO SOFTWARE DEVELOPMENT:
- The phases in development of OO
software
are a superset
of the phases of structured programming, in which analysis and
designed
are focused on objects rather than operations. The traditional
sequential
("waterfall") approach to writing programs has been largely replaced by
an iterative modules for analysis/design followed by implementation.
See Fig.
OOSD-1.
- The life cycle still (conceptually) separates
into
a language
independent phase (analysis/design of a model) and a language
dependent
phase (implementation/testing/debugging). See .
- The analysis/design strategy is
illustrated in
- The language-independent tools used
in
this course
include:
- The Unified Modeling Language (UML)
is
used to develop
software architectures of
(16) classes that are
(17) via inter-relationships.
- Structured Algorithm Charts (SAC)
are
used, by Tony's
protégés to develop the structured algorithms of methods.
SAQ:
What is the difference between the UML and SAC?
4.
OBJECT
ORIENTED ANALYSIS AND DESIGN:
4.1 The Analysis/Specification
Phase:
- Identify the task
and
decide
whether or not a computer approach is required.
- If a task is to
be
carried out
only a few times the time and effort of developing a program probably
is
not warranted.
- Tasks that are
to be
repeated
many times with different data or conditions are ideal candidates for
computerization.
- If a computer
approach
is to
be chosen, software specifications must be made, i.e.
- use cases
- {continue}
4.2 The Design Phase: Defining
the
details of the Software Architecture:
- Before writing
a
code one
must develop the step by step logical process that will accomplish
the specified tasks.
- A common mistake
of novice
programmers is beginning to code (write the program instructions in
a programming language) before they completely understand the task and
the method of accomplishing it.
- The design
should NOT be
done using the programming language. In fact, unless one is using
computerized
software design tools, e.g Rational Rose or an IDE like JBuilder, one
should
design the software architecture away from the computer in order to
resist
the temptation to code parts of a program before the design is complete
and debugged.
- Modern
programmers
used structured
techniques (See section
3,
below.) and object oriented programming (OOP) techniques
(See
the Learning Module, Programming
Languages.)
to construct modular software components by using only:
- structured
logic constructs
of sequence, selection, and repetition and
- modular
constructs:
In structured programming, procedures (in which data is passed
to
the main program via "parameters") and functions (in which data
is returned via the function name) are used to modularize the program
design.
In the more modern OT, classes (in which data and operations
are
"encapsulated" together) are designed; these become "templates" for the
actual objects used in a program.
- Program
design
tools
are usually utilized to help the designer to think through the
algorithm.
The following are presented in more detail in following sections.
- Structured
programming tools
include structure charts, flowcharts, and pseudocode.
- OOP tools are
still evolving;
one such tools is the Unified Modeling Language or UML. (See section
5.D, below.)
- Rather than
developing applications
"from the ground up" using the basic constructs of traditional
programming
languages, many standard applications can be created quickly using
special
purpose facilities such as VHLL, CASE, application generators,
etc.
When planning to use one of these facilities, one can assume a wider
range of more sophisticated constructs from which to create an
application
thus avoiding many logic details.
- Debugging
can be facilitated several ways:
- Utilizing
use
- Tracing
of method algorithms means working through all the paths of the
logic
using pencil and paper and the simplest set of complete test values
for
attributes and method arguments. Debugging means correcting
each
logic fault that is discovered.
It
is a common failing of novice programmers to rush to the coding phase
before
thoroughly checking the structure (highly cohesive and loosely coupled)
of their architecture model and the logic of the operation algorithms.
5.
GENERIC PHASES OF SOFTWARE DEVELOPMENT:
Analysis and design
are fundamentally different in sturcutred programming and OOSD.
However
the subsequent phases, __________(),
__________(),
and __________(), are not
different
enough to warrent describing in separate sections. In fact their
similarities outweigh their differences so they are presented in
generic
forms below.
5.1 The Coding Phase:
- Coding is
implementing the
architecture model in an object oriented programming language.
When using the UML, this involves two distinct tasks:
- implementing
the
class diagrams
in code. This can be done automatically by software such as
Rational
Rose.
- implementing
the
operation
algorithms in code. When using schematic algorithm representations
(like SACs or flowcharts) this can be a routine task that could even
done
by a computer. Typically the actual coding of the algorithm
instructions
in a programming language is accomplished by using the development
tools, associated with the language, e.g. the IDE of Borland's
JBuilder.
The choice of language
in which
to code a UML model is very important because different languages
have
different capabilities; one should try to choose a language which
will
make implementation as efficient as possible while satisfying other
constraints
such as availability, your programmer's familiarity with it, etc.
- Coding
should be done top-down, i.e. starting with the main method of
the
user interface class (or the init method of an applet or C++'s main
function),
followed sequentially by each class that is instantiated in the main
method.
As mentioned in the previous section, if the architecture model is
efficiently
and correctly designed coding the classes and their attributes
is
very straightforward that it can be generated by software like Rational
Rose. In fact, if the user interface with the software is a GUI,
it can be generated by virtually all modern IDEs (Integrated
Development
Environments) However
implementing the behavior of the various classes, i.e. defining their
methods
requires more "hands on" coding by the developer. In the
time-honored
strategy of structured programs this should be using a "divide and
conquer"
approach where each method is develped and debugged in isolation using
"stubs" for each untested class or method. Testing/debugging should be
done at each stage.
- "Stubs"
are trivial components that consist only of the class constructor
name
or method name with simple output statements indicating
(1)
that the class or method has been called and (2) when a response is
generated.
It is usually helpful to output the values of the important
attributes,
method arguments, and local variables with each output statement,
so
that logic errors can be pinpointed when the software is executed.
- It
is critical that the whole program should be tested and debugged
when
each component is implemented, i.e. when each stub is converted
into
a fully operational procedure or function. Because this is being done
on
the computer, more sophisticated test data can be used than
during
the tracing/debugging of the deskchecking (tracing) phase of the Design
phase.
- The following conventions
are used to standardize many of the features of a program:
- structured
constructs
in the logic of a program (universally required),
- naming
conventions,
- documentation
(comment)
standards, etc.
- As mentioned
above,
the following application
generators automate many of the tedious tasks of coding and thus
greatly increase
programmer productivity in applications that have standardized
characteristics.
- a. VHLL
(Very High
Level languages), including 4GLS (Fourth Generation
Languages),
are special purpose programming languages that facilitate efficient
implementation
in a particular (limited) domain of applications (e.g. 4GLs are very
efficient
to implementing database applications but would be cumbersome, if not
incapable,
in writing graphics applications, for example).
- CASE (Computer
Assisted
Software Engineering) which generate program code directly from
specifications
thus allowing the developer to avoid worrying about the details of
the program logic.
- Other
facilities that
increase the efficiency of application development include:
- Reusable
code: Very
often a procedure or function can be used in more than one program. In
such cases they are placed in code libraries from which they
can
be "cut and pasted" into various applications. Many standard
libraries are
supplied with programming languages and public domain libraries can
be freely copied. In OOP code reuse is greatly facilitated with "inheritance"
by which classes can share the data and operations defined in
"parent
classes". (See section
4.1,
below.)
- Data
dictionaries
(particularly associated with DBMS): These carry a complete
specification
of the data processed by a program; this can be accessed by programmers
to help them in application development. Active (on-line) data
dictionaries
will give error messages if data is improperly used in a program.
- Quality assurance
is
maintained
by structured walkthroughs, i.e. a detailed peer critique of
program.
This team approach encourages egoless software development.
5.2 The Testing and Debugging
Phase:
- Debugging
should
actually
take place continuously during the development cycle. In
particular
it should be done in both the:
- design phase:
This involves
detecting and removing logical errors. It is accomplished by
"tracing"
the algorithm (penciling through each step); this is also called
performing
a "walkthrough"
- Coding phase:
This involves
removing syntax errors which are mistakes in the spelling and
grammar
of the particular programming language.
- After coding,
testing and
debugging is needed to catch faults that might have slipped through.
- Testing
involves using simple
but complete test data specifically chosen to expose possible
errors
("bugs");
- Debugging
is the process
of removing these errors.
5.3 The Documentation Phase:
- Program
documentation are
explanations that will help a user, operator, or programmer to
understand
the program or that will help someone to later .
- User
documentation
consists of general manuals on how to use the application.
- Operator
documentation
consists of technical manuals to help operators to modify or customize
the application.
- It often
becomes
necessary
to modify or update the program itself. Programmer documentation facilitates
such "program maintenance". This includes design
specifications,
logic description (flowcharts, pseudocode, etc.; See below.), the
program
listing, and I/O specifications.
- Types of
Documentation:
- External
documentation describe
overall purpose and design of the program and its components.
- Internal
documentation are
comments, inserted directly into the code, that explain the specific
parts
(components) of the program as well as obscure sections of the code.
5.4 The Maintenance Phase:
- Programs should
grow with
the user's needs. If an application is designed so that it can be
updated
to accommodate changes, then it is "maintainable".
Most companies have "maintenance
programmers" whose primary job is to keep the company's
applications
up to date.
6.
GUIDELINES FOR DEVELOPING AND RELATING CLASSES:
- When should one use classes? Use classes . .
.
- to represent real-world concepts.
This
usually occurs
in simulation or modeling.
- to encapsulate design decisions that are
likely to change.
Having these localized in a class makes it easier to control their
effects
on the rest of the system.
- to hide complexity.
- to provide data structures that can
be
used in more
than one application.
- to supply a user-friendly,
object-oriented
interface
to an existing application.
- to give access to data via various APIs
(application programming interfaces). In fact,one
should
plan for the future and use classes even if the immediate application
only
requires a single instance. This may make your program easier to
generalize
later.g. containing only static members to eliminate global variables.
- There are two ways to develop a class
hierarchy
that
strategically different (although they produce the same interclass
relationship):
- by specialization (top-down) in which
one
begins with
an existing class and uses it as a base class for new, more specialized
derived classes.
- by generalization (bottom-up) in
which
one begins
with two or more related classes, recognizes that they have common
properties,
and designs a base class to embody them. The related classes (which
become
derived classes of the new base class) then share the implementation of
these common features by means of inheritance from the new base class.
- Guidelines for organizing and
relating
classes:
- If a group of classes...
- has one or more attributes in common
consider creating
a base class containing one declaration of those attributes.
- share a complex algorithm, consider
creating a base
class with a method that implements the algorithm.
- are special cases of a more general
concept,
consider
creating a super class to represent the general concept.
- If a class represents a general concept,
consider
implementing special cases of that general concept as derived classes.
- If a derived class inherits unnecessary
properties from
a base class, perhaps the derived class should contain the base
class
instead.
- Write every class to allow for addition
of
derived classes
in the future.
- Guidelines for designating access
control specifiers:
In general . . .
- declare as public only those members
(attributes and
methods) which are to be accessed by __________. This is an application
of a fundamental security rule called the Principle of Least
Privilege.
- declare as protected all:
- methods that should be called only by
derived
classes.
- constructors of abstract classes.
- all members of a class that might be later
used
as a super
class. This still preserves access control except where access is
explicitly
declared using inheritance.
- declare as private all:
- methods that client programs can misuse
or
have no need
for.
- constructors of private classes.
- inherited methods that a class disables.
- In Java, declare package...
| FIGURE
OOSD-1:
COMPARISON OF SOFTWARE DEVELOPMENT LIFECYCLES |
 |
| From the pamphlet, "The Rational Approach" |
FIGURE OOSD-2 THE OOSD LIFE
CYCLES
|
FIGURE OOSD-2A: OOSD
Integrated with
Language Implementation
|
FIGURE OOSD-2B: OOSD
Subcycles for
Analysis and Design
|
 |
 |
|
|
|
FIGURE OOSD-3: OOSD LIFE
CYCLE IN
THE JAVA ENVIRONMENT
|
|
| Diagram from the Rational Rose/Java Early
-Access
Kit. |