0% found this document useful (0 votes)
139 views

Cpe 222: Software Design: Following Chapter 1 of Text (Koffmann and Wolfgang)

The document summarizes Chapter 1 of a textbook on software design. It discusses the software design challenge, the typical phases of the software life cycle including requirements specification and design. It covers techniques for managing complexity like abstraction, interfaces, and UML diagrams. It provides an example design of an array-based phone directory application to illustrate the concepts and tools discussed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
139 views

Cpe 222: Software Design: Following Chapter 1 of Text (Koffmann and Wolfgang)

The document summarizes Chapter 1 of a textbook on software design. It discusses the software design challenge, the typical phases of the software life cycle including requirements specification and design. It covers techniques for managing complexity like abstraction, interfaces, and UML diagrams. It provides an example design of an array-based phone directory application to illustrate the concepts and tools discussed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 29

CpE 222:

Software Design

Following Chapter 1 of text


(Koffmann and Wolfgang)
Outline

• The software challenge and the software life cycle


• Activities of each phase of the software life cycle
• Using top-down design and object-oriented design
• Managing complexity:
• Data abstraction
• Procedural abstraction
• Information hiding
• Class diagrams document interactions between classes

Chapter 1: Introduction to Software Design


2
Outline (2)

• Abstract data types:


• Role in modeling
• Implementing them with classes and interfaces
• Use cases:tool to document interaction with a user
• Software design process example:
• Design and implementation of an array-
based telephone directory
• Sequence diagrams:tool for documenting the interaction
between multiple classes used in a program

Chapter 1: Introduction to Software Design


3
The Software Challenge

• Software is ...
• Used for a long time
• Updated and maintained
• By people who did not write it
• Initial specification may be incomplete
• Specification clarified through extensive interaction
between user(s) and system analyst(s)
• Requirements specification needed at the beginning of
any software project
• Designers and users should both approve it!

Chapter 1: Introduction to Software Design


4
Things Change!

• Users’ needs and expectations change


• Use reveals limitations and flaws
• Desire for increased convenience, functionality
• Desire for increased performance
• Environment changes
• Hardware, OS, software packages (“software rot”)
• Need to interact with clients, parent org., etc.
• Law and regulations change
• Ways of doing business
• Style, “cool” factor
Chapter 1: Introduction to Software Design
5
The Software Life Cycle

• Software goes through stages as it moves from


initial concept to finished product
• The sequence of stages is called a life cycle
• Must design and document software:
• In an organized way for:
• Understanding and ...
• Maintenance (change) after the initial release
• The maintainer is not necessarily the author!
• ... and even authors forget
• ... and no one can keep all details in mind at once

Chapter 1: Introduction to Software Design


6
Software Life Cycle Models:
The Waterfall Model
• Simplest way to organizing activities in stages
• Activities are:
• Performed in sequence
• Result of one flows(falls) into the next
• The Waterfall Model is simple ... but unworkable
• Fundamental flaw: Assumption that each stage
can and must be completed before the next one
occurs
• Example: User may need to see finished product
to express true requirements!

Chapter 1: Introduction to Software Design


7
Waterfall Model

Chapter 1: Introduction to Software Design 8


Waterfall Model (2)

Chapter 1: Introduction to Software Design 9


Other Software Life Cycle Models

• Common theme among models:stages or cycles


• Unified Model:
• Cycles are called phases and iterations
• Activities are called workflows
• The four phases of the Unified Model:
• Inception
• Elaboration
• Construction
• Transition

Chapter 1: Introduction to Software Design


10
Other Software Life Cycle Models (2)

Chapter 1: Introduction to Software Design 11


Software Life Cycle Activities

Activities essential for successful development:


• Requirements specification
• Architectural, component, & detailed designs
• Implementation
• Unit, integration, and acceptance testing
• Installation and maintenance

Chapter 1: Introduction to Software Design


12
Software Life Cycle Activities Defined

Chapter 1: Introduction to Software Design 13


Software Life Cycle Activities (more)

• Requirements Specification
• System analyst works with users to clarify the
detailed system requirements
• Questions include format of input data, desired
form of any output screens, and data validation
• Analysis
• Make sure you completely understand the problem
before starting the design or program a solution
• Evaluate different approaches to the design

Chapter 1: Introduction to Software Design


14
Software Life Cycle Activities (continued)

• Design
• Top-down: break system into smaller subsystems
• Object-oriented: identify objects and their interactions
• UML diagrams:tool to show interactions between:
• Classes (inside the system)
• Classes and external entities

Chapter 1: Introduction to Software Design


15
Example of Top-Down: Stepwise Refinement

Chapter 1: Introduction to Software Design 16


Example of Object-Oriented: Class Diagram

Chapter 1: Introduction to Software Design 17


Using Abstraction to Manage Complexity

• An abstraction is a model of a physical entity or activity


• Models include relevant facts and details
• Models exclude matters irrelevant to system/task
• Abstraction helps programmers:
• Complex issues handled in manageable pieces
• Procedural abstraction: distinguishes ...
• What to achieve (by a procedure) ...
• From how to achieve it (implementation)
• Data abstraction: distinguishes ...
• Data objects for a problem and their operations ...
• From their representation in memory
Chapter 1: Introduction to Software Design
18
Using Abstraction to Manage Complexity (2)

• If another class uses an object only through its


methods, the other class will not be affected if the data
representation changes
• Information hiding: Concealing the details of a
class implementation from users of the class
• Enforces the discipline of data abstraction

Chapter 1: Introduction to Software Design


19
Abstract Data Types, Interfaces, and
Pre- and Post-conditions
• A major goal of software engineering:write reusable
code
• Abstract data type (ADT): data + methods
• A Java interface is a way to specify an ADT
• Names, parameters, return types of methods
• No indication of how achieved (procedural
abstraction)
• No representation (data abstraction)
• A class may implement an interface
• Must provide bodies for all methods of the interface

Chapter 1: Introduction to Software Design


20
Abstract Data Types, Interfaces, and
Pre- and Postconditions (2)

Chapter 1: Introduction to Software Design 21


Abstract Data Types, Interfaces, and PreA
and Postconditions (continued)
• You cannot instantiate (new) an interface
• But you can:
• Declare a variable that has an interface type
• Use it to reference an actual object, whose
class implements the interface
• A Java interface is a contract between
• The interface designer and ...
• The coder of a class that implements the interface
• Precondition: any assumption/constraint on the
method data before the method begins execution
• Postcondition: describes result of executing the method

Chapter 1: Introduction to Software Design


22
Requirements Analysis:
Use Cases, and Sequence Diagrams
• Analysis first step: study input and output requirements:
• Make sure they are understood and make sense
• Use case:
• User actions and system responses for a sub-problem
• In the order that they are likely to occur
• Sequence diagram:
• Shows objects involved across the horizontal axis
• Shows time along the vertical axis •

Chapter 1: Introduction to Software Design


23
Design of an Array-Based Phone
Directory

• Case studyshows:
• Design
• Implementation
• Testing of a software-based phone directory

• In UML class diagrams:


+ sign next to a method/attribute means it is public
- sign next to a method/attribute means it is
private
Chapter 1: Introduction to Software Design
24
Design of Array-Based Phone Directory

Classes/interfaces to design include:

•PDUserInterface: interface; later we consider:


• Console (command line) UI class
• Graphical (JOptionPane) UI class
• PDApplication: main / driving class
•PhoneDirectory: interface
•ArrayBasedPD: class implementing
PhoneDirectory
•DirectoryEntry: class, for one item in the directory

Chapter 1: Introduction to Software Design


25
Design of Array-Based Phone Directory (2)

Chapter 1: Introduction to Software Design 26


Design of Array-Based Phone Directory (3)

Chapter 1: Introduction to Software Design 27


Design of Directory Entry

• Simple class, similar to Person in Java


review: • Two private fields, for name and
number • Two-argument constructor
• Get methods for both fields
• Set method for number (only)

Chapter 1: Introduction to Software Design


28
Design of Array-Based Phone Directory
(4)Chapter 1: Introduction to Software Design

29

You might also like