Software Engineering CS 20006 Lecture 13 FunctionOriented Design

  • Slides: 39
Download presentation
Software Engineering CS 20006 Lecture 13 Function-Oriented Design Approach (Structured Analysis)

Software Engineering CS 20006 Lecture 13 Function-Oriented Design Approach (Structured Analysis)

Function-Oriented Design Approaches 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Function-Oriented Design Approaches 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Lecture #13 • Function-oriented Design Approaches – Structured Analysis (SA) – Structured Design (SD)

Lecture #13 • Function-oriented Design Approaches – Structured Analysis (SA) – Structured Design (SD) • Structured Analysis vs. Structured Design • Structured Analysis Techniques – Data Flow Diagram (DFD) • Applications of DFDs in SA – Elementary problems – RMS Calculator – Payroll Manager 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

System Design Document (SDD) • SDD is the output in the Design phase •

System Design Document (SDD) • SDD is the output in the Design phase • High level design (software architecture part) – Identify modules – Relationship among modules – Interface among modules • (Data Flow Diagrams) • Detail design (module specification part) – Data structures • (ERDs, DDs) – Algorithms • (Structure charts) 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Function-Oriented Approach • Start with viewing a system as a black-box that performs a

Function-Oriented Approach • Start with viewing a system as a black-box that performs a set of high-level function • Top-down decomposition – The high-level functions are successively decomposed into more detailed functions • Functions at final level are mapped into corresponding modules (implementations) • Bottom-up integration 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Function-Oriented Design Approach • Two steps in the function-oriented design – Structured analysis •

Function-Oriented Design Approach • Two steps in the function-oriented design – Structured analysis • Very high level description of a system • What are the different functional components • How a function can be decomposed into sub-functions in the next level – Structured design • Low level compared to the structured analysis • Focus on the implementation (at a higher level) issue of a functional component derived in structured analysis Note: Structured analysis can be mapped to structured design 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

SA vs. SD • Functionality – SA: Functional decomposition of the system is achieved

SA vs. SD • Functionality – SA: Functional decomposition of the system is achieved – SD: All functions in SA are mapped to module structures • Purpose – SA: To capture the detailed structure of the system as perceived by the user – SD: To define the structure of the solution that is suitable for implementation in some programming language • Usage – SA: User can review the SA to ensure that it captures all the necessary requirement – SD: Detail specification to programmers for actual implementation 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Structured Analysis Technique 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Structured Analysis Technique 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Structured Analysis Technique • Structured analysis is based on the following principles: – Top-down

Structured Analysis Technique • Structured analysis is based on the following principles: – Top-down decomposition approach – Divide and conquer principle: each function is decomposed independently – Graphical representation of the analysis results 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Structured Analysis Technique Top-down decomposition approach 26 February, 2020 Software Engineering (CS 20006) DSamanta,

Structured Analysis Technique Top-down decomposition approach 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Structured Analysis Technique Divide and conquer 26 February, 2020 Software Engineering (CS 20006) DSamanta,

Structured Analysis Technique Divide and conquer 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

DFD Approach to Structured Analysis 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT

DFD Approach to Structured Analysis 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

DFD Approach Graphical representation of the analysis results 26 February, 2020 Software Engineering (CS

DFD Approach Graphical representation of the analysis results 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

DFD Approach Graphical representation of the analysis results 26 February, 2020 Software Engineering (CS

DFD Approach Graphical representation of the analysis results 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Data Flow Diagram Approach of SA • DFD is a system modeling tool •

Data Flow Diagram Approach of SA • DFD is a system modeling tool • DFD is function-oriented – Functions are more important and complex than the data the system manipulates – Functions are of paramount importance • DFD allows us to picture a system as a network of functional processes connected to one another by “pipelines” and “holding tanks” of data • DFD is also alternatively termed as: – Bubble chart, Bubble diagram, Process model, Work flow diagram 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Data Flow Diagram Approach of SA • Usefulness of DFD 1. Freedom from committing

Data Flow Diagram Approach of SA • Usefulness of DFD 1. Freedom from committing to the technical implementation of the system too early 2. Further understanding of the interrelatedness of system and subsystems 3. Communicate current system knowledge to users through data flow diagrams 4. Analysis of proposed system to determine if the necessary data and processes have been defined 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Symbols used in DFD 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Symbols used in DFD 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

The Basic Building Blocks in DFD • Terminator – – It represents external entities

The Basic Building Blocks in DFD • Terminator – – It represents external entities with which the system communicates A terminator can be a person, a group of people It may also be an another system They are outside the control of the system that is being modeled • Data flow – It is used to describe the movement of data from one part of the system ton another part • Process (A bubble, a function or a transformation) – How inputs are changed or transformed into outputs • Data store – It is used to model a collection of data (files, memory, CD etc. ) – Data can move to (write, update, or delete) and from (read or access) 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

DFD Advantages • DFD is a very simple formalism • It is simple to

DFD Advantages • DFD is a very simple formalism • It is simple to understand use • A DFD model uses a very limited number of primitive symbols • A DFD model hierarchically represents a system • DFD follows very simple set of intuitive concepts and rules 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Example 1: DFD Modeling • • • System: Number Reader Requirement: Read a number

Example 1: DFD Modeling • • • System: Number Reader Requirement: Read a number from the keyboard Specification: Display the number on the screen 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Example 2: DFD Modeling • • • System: Max Calculator Requirement: Read two numbers

Example 2: DFD Modeling • • • System: Max Calculator Requirement: Read two numbers from the user Specification: Display the largest number on the screen 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Example 3: DFD Modeling • • • System: Graph Player Requirement: Read two numbers

Example 3: DFD Modeling • • • System: Graph Player Requirement: Read two numbers from two users Specification: Display the line (a=b), circle (a>b), square (a<b) 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Example 4: DFD Modeling • • • System: RMS Calculator Requirement: Three valid numbers

Example 4: DFD Modeling • • • System: RMS Calculator Requirement: Three valid numbers from user Specification: Display the root mean square of the numbers Level 0 DFD : Context Diagram 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

DFD Modeling: RMS Calculator Level 1 DFD : RMS Calculator 26 February, 2020 Software

DFD Modeling: RMS Calculator Level 1 DFD : RMS Calculator 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

DFD Modeling: RMS Calculator Level 2 DFD : Compute RMS 26 February, 2020 Software

DFD Modeling: RMS Calculator Level 2 DFD : Compute RMS 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

DFD Modeling: Payroll Manager Level 0 DFD : Context Diagram 26 February, 2020 Software

DFD Modeling: Payroll Manager Level 0 DFD : Context Diagram 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

DFD Modeling: Payroll Manager Level 1 DFD : Payroll Manager 26 February, 2020 Software

DFD Modeling: Payroll Manager Level 1 DFD : Payroll Manager 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Common mistakes in DFD • Data flows should not split into two or more

Common mistakes in DFD • Data flows should not split into two or more different data flows • All data flows must EITHER originates or terminate at a process • Process need to have at least one input data flow and one output data flow 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Common Mistakes in DFD • Context diagram should contains at most one bubble •

Common Mistakes in DFD • Context diagram should contains at most one bubble • All external entities appear only in the context diagram. The external entities should not appear at other levels of DFD • DFD should not represent any control information 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Leveled DFD • Organize the overall DFD in a series of levels so that

Leveled DFD • Organize the overall DFD in a series of levels so that each level provides successively more detail about a portion of the level above it – The top level DFD consists of only one bubble, representing the entire system; This is the context diagram. It shoes the interface between the system and external terminators – Immediately beneath the context diagram is the highest-level view of the major functions within the system, as well as the major interfaces between those functions – The numbers serve as a convenient way of relating a bubble to the next lower level DFD which should be numbered for convenient reference 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Leveled DFD 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Leveled DFD 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Leveled DFD • Some principles of leveled DFD – Child diagrams should be balanced

Leveled DFD • Some principles of leveled DFD – Child diagrams should be balanced – Too less or too many bubbles in a DFD is a bad practice. Only three to seven bubbles (and data stores) in a level is recommended. – The number of levels and partitions should be based on this principle – The number of levels is system dependent – Show a store at the highest level where it first serves as an interface between two or more bubbles; then show it again in every lowerlevel diagram that further detailed those bubbles 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Leveled DFD 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Leveled DFD 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Be Careful • Process Errors – Process that have no outputs (a black hole)

Be Careful • Process Errors – Process that have no outputs (a black hole) – Process that have no inputs (a miracle) – The label should be a verb phrase • Data Store Errors – Data stores that are never read and written to – The label should be a noun phrase • External Entity Errors – Disconnected external entities – Data cannot move directly from a entity to another entity – The label should be a noun phrase 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Be More Careful • Data Flow Errors – – – A data flow cannot

Be More Careful • Data Flow Errors – – – A data flow cannot be two direction of flow between symbols A data flow cannot go directly back to same process it leaves Having no source Having no destination The label should be a noun phrase • Connection Errors – Data cannot move directly from/to an external entity – Data cannot move directly from a data store to another data store Beware of unlabeled flows and unlabeled processes 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur

Problems to Ponder • Draw DFDs for ATM system • Draw DFDs for a

Problems to Ponder • Draw DFDs for ATM system • Draw DFDs for a Sorting system, which read a set of data from a file, sort them in ascending order and display the sorted list • Draw DFDs for the system under your project team 26 February, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur