0% found this document useful (0 votes)
89 views32 pages

Introduction To Software Design

This chapter introduces software design and the software life cycle. It discusses how software moves through requirements, analysis, design, implementation, testing, and maintenance phases. It covers topics like the waterfall model, UML diagrams, object-oriented design principles like abstraction and interfaces, and provides an example of designing an array-based phone directory application to illustrate concepts.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views32 pages

Introduction To Software Design

This chapter introduces software design and the software life cycle. It discusses how software moves through requirements, analysis, design, implementation, testing, and maintenance phases. It covers topics like the waterfall model, UML diagrams, object-oriented design principles like abstraction and interfaces, and provides an example of designing an array-based phone directory application to illustrate concepts.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 32

Introduction to Software Design

Chapter 1
Chapter Objectives

• To become familiar with the software challenge and the


software life cycle
• To understand what activities take place in each phase
of the software life cycle
• To learn how to use top-down design and object-oriented
design
• To learn to use data abstraction, procedural abstraction,
and information hiding to manage complexity
• To learn how to draw class diagrams to document the
interaction between classes

Chapter 1: Introduction to Software Design 2


Chapter Objectives (continued)

• To learn the role of abstract data types in building


models of computer systems and how to implement
them using classes and interfaces
• To become familiar with use cases as a tool to document
a system’s interaction with the user
• To understand the software design process by following
the design and implementation of an array-based
telephone directory
• To become familiar with sequence diagrams as a tool for
documenting the interaction between multiple classes
used in a program

Chapter 1: Introduction to Software Design 3


The Software Challenge

• In industry, a software product is expected to be used for


an extended period of time by someone who did not
write the program and who is not intimately familiar with
its internal design
• Initial specification for a software product may be
incomplete
• Specification is clarified through extensive interaction
between users of the software and the system analyst
• A requirements specification should be generated at the
beginning of any software project
• Designers and users should both approve the document
Chapter 1: Introduction to Software Design 4
The Software Life Cycle

• Software products go through several stages as they


mature from initial concept to finished product
• The sequence of stages is called a life cycle
• It is important to design and document software in an
organized way so that it can be easily understood and
maintained after the initial release
• The person who maintains the software is not
necessarily the person who writes it

Chapter 1: Introduction to Software Design 5


Software Life Cycle Models

• Waterfall model: simplest way of organizing activities that


transform software from one stage to another
• Activities are performed in sequence and the results of
one flows into the next
• Waterfall model is simple but unworkable
• Fundamental flaw is assumption that each stage can
and must be completed before the next one occurs
• Sometimes, it is not until the product is finished that the
user can fully express his or her requirements

Chapter 1: Introduction to Software Design 6


Waterfall Model

Chapter 1: Introduction to Software Design 7


Waterfall Model (continued)

Chapter 1: Introduction to Software Design 8


Software Life Cycle Models (continued)

• Common themes among alternative models is to develop


software product in stages or cycles
• Unified Model: the cycles are called phases and
iterations and the activities are called workflows
• Four phases
• Inception
• Elaboration
• Construction
• Transition

Chapter 1: Introduction to Software Design 9


Software Life Cycle Models (continued)

Chapter 1: Introduction to Software Design 10


Software Life Cycle Activities (continued)

• Certain activities are essential for software development


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

Chapter 1: Introduction to Software Design 11


Software Life Cycle Activities

Chapter 1: Introduction to Software Design 12


Software Life Cycle Activities (continued)

• Requirements Specification
• System analyst works with software 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 13


Software Life Cycle Activities (continued)

• Design
• Top-down approach: breaking a system into a set of
smaller subsystems
• Object-oriented approach: identification of a set of
objects and specification of their interactions
• UML diagrams are a design tool to illustrate the
interactions between
• Classes
• Classes and external entities

Chapter 1: Introduction to Software Design 14


Software Life Cycle Activities (continued)

Chapter 1: Introduction to Software Design 15


Software Life Cycle Activities (continued)

Chapter 1: Introduction to Software Design 16


Using Abstraction to Manage Complexity

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


• Abstraction helps programmers deal with complex issues
in a piecemeal fashion
• Procedural abstraction: distinguish what is to be
achieved by a procedure from its implementation
• Data abstraction: specify the data objects for a problem
and the operations to be performed on them without
concern for their representation in memory

Chapter 1: Introduction to Software Design 17


Using Abstraction to Manage Complexity
(continued)
• If a higher-level class references a data object only
through its methods, the higher-level class will not have
to be rewritten, even if the data representation changes
• Information hiding: Concealing the details of a class
implementation from users of the class

Chapter 1: Introduction to Software Design 18


Abstract Data Types, Interfaces, and Pre-
and Postconditions
• A major goal of software engineering is to write reusable
code
• Abstract data type (ADT): The combination of data
together with its methods
• A Java interface is a way to specify an ADT
• The interface specifies the names, parameters, and
return values of the ADT methods without specifying
how the methods perform their operations and without
specifying how the data is internally represented
• Each class that implements an interface must provide
the definitions of all methods declared in the interface
Chapter 1: Introduction to Software Design 19
Abstract Data Types, Interfaces, and Pre-
and Postconditions (continued)

Chapter 1: Introduction to Software Design 20


Abstract Data Types, Interfaces, and Pre-
and Postconditions (continued)
• You cannot instantiate an interface
• You can declare a variable that has an interface type
and use it to reference an actual object
• A Java interface is a contract between the interface
designer and the programmer who codes a class that
implements the interface
• Precondition: a statement of any assumptions or
constraints on the method data before the method
begins execution
• Postcondition: a statement that describes the result of
executing a method
Chapter 1: Introduction to Software Design 21
Requirements Analysis, Use Cases, and
Sequence Diagrams
• First step in analysis is to study the problem of input and
output requirements carefully to make sure they are
understood and make sense
• Use case: list of the user actions and system responses
for a particular sub-problem in the order that they are
likely to occur
• Sequence diagram: shows all the objects involved in this
use case across the horizontal axis, time is shown along
the vertical axis

Chapter 1: Introduction to Software Design 22


Design of an Array-Based Phone Directory

• Case study deals with design, implementation, and


testing of the software-based phone directory
• In UML class diagrams
• + sign next to a method or attribute means it is public
• - sign next to a method or attribute means it is private
• Classes to design include:
• PDUserInterface
• PDApplication
• PhoneDirectory
• ArrayBasedPD
• DirectoryEntry

Chapter 1: Introduction to Software Design 23


Design of an Array-Based Phone Directory
(continued)

Chapter 1: Introduction to Software Design 24


Design of an Array-Based Phone Directory
(continued)

Chapter 1: Introduction to Software Design 25


Design of an Array-Based Phone Directory
(continued)

Chapter 1: Introduction to Software Design 26


Design of an Array-Based Phone Directory
(continued)

Chapter 1: Introduction to Software Design 27


Design of an Array-Based Phone Directory
(continued)

Chapter 1: Introduction to Software Design 28


Implementing and Testing the Array-Based
Phone Directory

Chapter 1: Introduction to Software Design 29


Implementing and Testing the Array-Based
Phone Directory (continued)
• Note that some code in this application is controversial
• Combination of assignment with the evaluation of a
condition
• Break statement allows exiting of the while loop
without storing an entry

Chapter 1: Introduction to Software Design 30


Chapter Review

• Inheritance and class hierarchies mean that one class


can be a refinement or extension of another
• Encapsulation and inheritance impose structure on
object abstractions
• Polymorphism captures the idea that methods may take
on a variety of forms to suit different purposes
• The keyword interface defines an interface
• A class that realizes (implements) an interface defines
the methods that the interface declares

Chapter 1: Introduction to Software Design 31


Chapter Review (continued)

• The keyword abstract defines an abstract class or


method
• Delegation gains some of the advantages of multiple
inheritance
• Visibility is influenced by the package in which a class is
declared

Chapter 1: Introduction to Software Design 32

You might also like