SlideShare a Scribd company logo
Function-Oriented Design Module 3 Sangeetha Jose Lecturer in IT,  Govt. Engg. College Idukki
Design A process to design (verb) Result of the design process (noun)
Different levels… System design or top-level design (modular level) Detailed design (Internal design of the module)
Design methodology … .is a systematic approach to create a design by applying of a set of techniques and guidelines Input – specifications of the system to be designed Output – system design
Object Oriented Design   vs  Function Oriented Design Object - oriented : modules in the design represent data abstraction Function - oriented : consists of  module definitions, with each module supporting a functional abstraction Function-oriented design views a system as a set of modules with clearly defined behavior that interact with each other in a clearly defined manner to meet the system's requirements.
Design Objectives The goal of software design is to find the  best possible design  that meets your needs  You may have to explore different designs  Unfortunately, evaluation criteria for a design are often subjective and non-quantifiable
Major criteria to evaluate a design Correctness  A software design is correct if a system built precisely according to the requirements of the system  A design should be  verifiable  (does an implementation match the design),  complete  (does the design address its specified requirements) and  traceable  (all design elements can be traced back to specific requirements)  Efficiency Does the design efficiently make use of scarce resources: such as memory on a wireless sensor  Maintainability  and Simplicity  How easy is it for the design of a system to be understood?  Simpler designs make it easy for a developer to understand and then maintain the system  Cost  Does the design help to reduce costs in later phases of software development?  Can one design achieve the same quality as another design while reducing costs?
Problem analysis Vs Design Principles   Constructing a model of problem domain Model depends on the system Model is used to understand the problem Constructing a model of solution domain System depends on the model Model is used for optimization
Design Principles Problem Partitioning and Hierarchy  Abstraction  Modularity  Top-Down and Bottom-Up Strategies
Problem Partitioning and Hierarchy Divide and Conquer  Decompose system into smaller and smaller pieces  Ideally, each piece can be solved separately  Ideally, each piece can be modified independent of other pieces  Reality: each piece must communicate with other pieces  This communication implies a certain cost  At some point the cost is more than the benefit provided by the individual pieces  At this point, the decomposition process can stop
Abstraction Abstraction is a powerful concept used in all engineering disciplines It is a tool that permits a developer to consider a component in terms of the services (behaviors) it provides without worrying about the details of its implementation
Contd… Abstraction is an excellent tool for creating a hierarchical understanding of a system's functionality  In design contexts, you might see references to two “types” of abstraction  functional abstraction: a module is specified by the functions it performs  data abstraction: a data structure is manipulated in terms of pre-defined operations; the implementation of the data structure is hidden from its users (only operations are visible)  The former is primarily used in functional design, the latter is used primarily in object-oriented design
Modularity A system is considered modular if it consists of discreet components so that each component can be implemented separately, and a change to one component has minimal impact on other components  Helps in system repair and in system building Each component needs to support a well-defined abstraction and have a specific interface that other modules use to interact with it  As Jalote says “Modularity is where abstraction and partitioning come together”.
Top-Down vs Bottom-Up Design A system consists of a set of components, which have subcomponents of their own  The highest level component is the system itself, a concept we have seen when discussing context diagrams  We can design such a hierarchy using either a top-down approach or a bottom-up approach  In reality, we use both approaches and meet in the middle  A top-down approach starts with the system as a whole, and using  stepwise refinement , decomposes it into sub-components that exist at lower levels of abstraction
Contd… A bottom-up approach starts with primitive components that provide foundational services and using  layers of abstraction  builds the functionality the system needs until the entire system has been realized  A top-down approach is typically more useful in situations only if the specifications of the system are clearly known and  application is being built from scratch (water fall model)  A bottom-up approach is thus more useful in situations in which a new application is being created from an existing (legacy) system (Iterative enhancement model)
Module It is a logically separable part of a program It is a program unit that is discreet and identifiable with respect to compiling and loading Can be a function, a procedure, a process or a package
Module-Level Concepts Coupling Cohesion
Coupling “ how strongly” different modules are interconnected By definition, “ Coupling  between modules is the strength of interconnections between modules or a measure of interdependence among modules” An abstract concept and is not easily quantifiable Highly coupled – strong interconnections loosely coupled – weak interconnections
Contd… Factors influencing coupling are :   type of connection between modules   the complexity of the interface   the type of information flow between modules Minimize the number of interfaces per module and the complexity of each interface Depends up on the type of information flow, coupling varies Data Flow – Minimal Hybrid – Maximum (data and control)
Factors affecting coupling
Cohesion Cohesion is the concept that tries to capture intra-module bonds Shows how closely the elements of a module are related to each other. Shows how tightly bound the internal elements of the module are to one another Usually, greater the cohesion of each module in the system, the lower the coupling between module is. cohesion: how focused is an object (or module, or function, or package, etc.) on a particular task or concern  a highly cohesive object has attributes and behavior that relate only to one task or concern
Levels of cohesion Coincidental  Low Logical Temporal Procedural Communicational Sequential Functional High
Details… Coincidental Cohesion occurs when there is no meaningful relationship among the elements of a module. Logical Cohesion: if there is some logical relationship between the elements of a module (input and output modules) Temporal cohesion: same as logical cohesion, except that the elements are also related in time and are executed together (initialization, clean-up, termination) Procedurally cohesive module contains elements that belong to a common procedural unit (loop or a sequence of decision statements)
Contd… Communicational cohesion has elements that are related by a reference to the same input or output data (may perform more than one function) Sequential cohesion occurs when output of one forms the input to another. In functional cohesion all the elements of the module are related to performing a single function (single function or single goal – “compute square root” or “sort the array”)
How does one determine the cohesion level of a module? Compound sentence : sequential or communicational cohesion “ first”, “next”, “when”, “after” : sequential or temporal “ edit all data” : logical cohesion “ initialize” or “cleanup” : temporal cohesion
We aim to create systems out of highly cohesive, loosely coupled components…
Design Notations Structure charts UML
Structure Charts A structure chart is a graphical representation of a system's structure; in particular, its modules and their interconnections  Each module is represented by a box  If A uses B, then an arrow is drawn from A to B  B is called the  subordinate  of A  A is called the  superordinate  of B An arrow is labeled with the parameters received by B as input and the parameters returned by B as output  Arrows indicate the direction in which parameters flow  Parameters can be data (shown as unfilled circles at the tail of a label) or control information (filled circles at the tail)
The structure chart of the sort program
Supports Iteration and Branching
Types of Modules  Input : A module that only produces information that is passed to its superordinate Output : A module that only receives information from its superordinate for output to a device Transform : A module that converts data from one format into another format, possibly generating entirely new information.  Coordinator : A module that manages the flow of data to and from different subordinates Composite : Modules that combine one or more of the above styles are composite modules
Different types…
Design specification  A designer must also create a textual specification for each module that appears in the system's structure Design specification contains 1. Problem Specification 2. Major Data Structures 3. Modules and their Specifications 4. Design Decisions
Structured Design Methodology   The structured design methodology (SDM)  views a system as a transformation function  that transforms specified inputs into specified outputs.
Factoring A key concept of SDM is factoring Factoring is the process of decomposing a module so that the bulk of its work is done by its subordinates SDM attempts to achieve a structure that is close to being completely factored
SDM Strategy The overall strategy of SDM is to identify the  input and output  streams of the system and the  primary transformations  that have to be performed to produce the output High-level modules are then created to perform these major activities, which are later refined (factored) There are  four major steps  in applying this strategy  Restate the problem as a data flow diagram Identify the input and output data elements Perform first-level factoring Perform additional factoring on input, output and transform branches created in the previous step
Step 1: Restate the problem as a data flow diagram DFD represents how the data will flow in the system when it is built. Data flow diagrams during design are focused on the solution domain  What are the inputs and outputs of our system (as opposed to the inputs and outputs of the problem domain)? What are the central transformations?
Example 1: DFD for an ATM   Back
Example 2: DFD for a word-counting program Back
Step 2: Identify the input and output data elements What we are looking for is the most abstract input elements (MAI) and the most abstract output elements (MAO) The MAI elements are found by going as far as possible from physical inputs without losing the incoming nature of the data element The MAO elements are found by identifying the data elements most removed from the physical outputs without losing the outgoing nature of the data element  Figure1 Figure2
Step 3: First-Level Factoring First-level factoring is the first step towards converting the DFD into a structure chart You start by creating a module that represents the software system (the main module)  The main module acts as a coordinator module For each MAI data element, specify a subordinate input module that delivers these items to the main module For each MAO data element, specify an output module For each central transform, specify a subordinate transform module  The inputs and outputs of these transform modules are specified in the DFD
Example 1: First-Level Factoring of word-counting example
Example 2: First-Level Factoring of ATM example
Step 4: Perform Additional Factoring Now stepwise refinement is used to specify the sub-modules required to realize the functionality of the modules created in the previous step For each input module:  assume that it is in the main module add input modules that takes its MAI data element closer to the raw input add transform modules in order to transform the raw input into the desired MAI data element
Example: additional factoring of the word count program
Contd… Output modules are treated in a similar fashion, this time working from MAO data elements to the raw output of the system Central transforms are also factored in a stepwise manner until you have specified atomic modules that can be implemented directly
Example: additional factoring of the word count program
SDM Wrap-Up Each new module produced in step 4 can then be examined to see if additional factoring is necessary
Design Heuristics The strategy requires the designer to exercise sound judgment and common sense Cohesion and coupling should be the primary guiding factors A very high fan-out is not very desirable (control and coordinate more modules) Fan-in should be maximized Scope of effect of a decision should be subset of the scope of control.
Verification Designs should be checked for internal consistency and for completeness with respect to the SRS If a formal design notation is used, then tools may be able to perform some of these checks ( Automated Cross Checking) Otherwise,  design reviews  (as part of your inspection process) are required to ensure that the finished design is of high quality
Design Reviews To ensure “quality” of the design Aim of design reviews – detecting errors in design Review team – a member of both the system design team and the detailed design team, the author of the requirements document, the author responsible for maintaining the design document, and an independent software quality engineer.
Metrics To provide quantitative data to the management process Cost and schedule metrics are needed for tracking the progress of the project Size is always a product metric of interest Size: Number of Modules x Average LOC expected per module  Or you can generate LOC estimates for each individual module
Metrics Quality metrics Simplicity – most important design quality attribute Complexity  metrics  Network Metrics Stability Metrics Information Flow Metrics
Network Metrics Network metrics focus on the structure chart of a system They attempt to define how “good” the structure or network is in an effort to quantify the complexity of the call graph The simplest structure occurs if the call graph is a tree.  As a result, the graph impurity (deviation of the tree) is defined as  nodes - edges - 1 In the case of a tree, this metric produces the result zero since there is always one more node in a tree than edges This metric is designed to make you examine nodes that have high coupling and see if there are ways to reduce this coupling
Stability Metrics Stability of a design is a metric that tries to quantify the  resistance of a design to the potential ripple effects  that are caused by changes in modules The creators of this metric argue that the higher the stability of a design, the easier it is to maintain the resulting system This provides a stability value for each particular module In essence, the lower the amount of coupling between modules, the higher the stability of the overall system
Information Flow Metrics Information flow metrics attempt to define the complexity of a system in terms of the  total amount of information flowing  through its modules Jalote discusses two information flow metrics and how they can be used to classify modules
Approach 1  A module's complexity depends on its intramodule complexity and its intermodule complexity intramodule complexity is approximated by the (estimated) size of the module in lines of code intermodule complexity is determined by the total amount of information (abstract data elements) flowing into a module (inflow) and the total amount of information flowing out of a module (outflow) The module design complexity Dc is defined as  Dc = size * (inflow*outflow) 2 The term  (inflow*outflow) 2  refers to the total number of input and output combinations, and this number is squared since the  interconnections between modules are considered more important  to determining the complexity of a module than its code size
Approach 2 Approach 1 depends largely on the amount of information flowing in and out of the module Approach 2 is a variant that also considers the number of modules connected to a particular module; in addition, the code size of a module is considered insignificant with respect to a module's complexity The module design complexity Dc is defined as  Dc = (fan_in * fan_out) + (inflow*outflow) fan_in above refers to the number of modules that call this module, fan_out is the number of modules called by this module
Classification Neither of these metrics is any good, unless they can tell us when to consider a module “too complex” To this end, an approach was developed to compare a module's complexity against the complexity of the other modules in its system avg_complexity  is defined as the average complexity of the modules in the current design std_deviation  is defined as the standard deviation in the design complexity of the modules in the current design A module can be classified as  error prone ,  complex , or  normal  using the following conditions  Dc is the complexity of a particular module A module is error prone if Dc > avg_complexity + std_deviation A module is complex if avg_complexity < Dc < avg_complexity +  std_deviation Otherwise a module is considered normal

More Related Content

PPTX
Query processing and optimization (updated)
PPT
Function Oriented Design
PPTX
Replication Techniques for Distributed Database Design
PPTX
Database architecture
PPTX
Distributed Query Processing
PPTX
Relational model
PPT
Analysis modeling & scenario based modeling
PPTX
unit testing and debugging
Query processing and optimization (updated)
Function Oriented Design
Replication Techniques for Distributed Database Design
Database architecture
Distributed Query Processing
Relational model
Analysis modeling & scenario based modeling
unit testing and debugging

What's hot (20)

PPTX
object oriented methodologies
PPTX
Server system architecture
PPTX
Functional dependency
PPTX
Fragmentation and types of fragmentation in Distributed Database
PPTX
2.2. language evaluation criteria
PPT
Architecture design in software engineering
PPTX
Distributed file system
PPTX
Evolving role of Software
PPTX
Cohesion and coupling
PPTX
Design Concepts in Software Engineering-1.pptx
PPTX
Congestion control
PPSX
Functional dependency
PDF
Dbms 3: 3 Schema Architecture
PPTX
Physical design of io t
PPTX
Deductive databases
PPT
Introduction and architecture of expert system
PDF
Software Designing - Software Engineering
PPTX
Decomposition methods in DBMS
PPT
Distributed Transaction
PPTX
Introduction to DBMS(For College Seminars)
object oriented methodologies
Server system architecture
Functional dependency
Fragmentation and types of fragmentation in Distributed Database
2.2. language evaluation criteria
Architecture design in software engineering
Distributed file system
Evolving role of Software
Cohesion and coupling
Design Concepts in Software Engineering-1.pptx
Congestion control
Functional dependency
Dbms 3: 3 Schema Architecture
Physical design of io t
Deductive databases
Introduction and architecture of expert system
Software Designing - Software Engineering
Decomposition methods in DBMS
Distributed Transaction
Introduction to DBMS(For College Seminars)
Ad

Similar to Function oriented design (20)

PPT
6&8-Design.ppt
PPT
SE-4 software engineering nekdnhjnrindnj
PPT
5.Software Design.ppt it is for software eng students
PPT
"Design Phase: A Deep Dive into Software Design and Development"
PPT
Software Design lovely professional university
PPTX
Software Eng S3 ( Software Design ).pptx
PPTX
effective modular design.pptx
PPT
chapter 5.ppt
PPT
5.Software Design.ppt
PPTX
SOFTWARE DESIGN_Module_1_Module_2_3.pptx
ODP
Software design
PPTX
Unit3 Software engineering UPTU
PDF
software _Desing_Methodology-partI.pptx.pdf
PPTX
Software Engineering Unit 3 PPT Software Design
PPT
Software Design (Lectu. re 4).ppt
PPTX
CHAPTER 3.pptx
DOCX
Unit 3 Software engineering deataled notes .docx
PDF
Design1
PPTX
System software design1
6&8-Design.ppt
SE-4 software engineering nekdnhjnrindnj
5.Software Design.ppt it is for software eng students
"Design Phase: A Deep Dive into Software Design and Development"
Software Design lovely professional university
Software Eng S3 ( Software Design ).pptx
effective modular design.pptx
chapter 5.ppt
5.Software Design.ppt
SOFTWARE DESIGN_Module_1_Module_2_3.pptx
Software design
Unit3 Software engineering UPTU
software _Desing_Methodology-partI.pptx.pdf
Software Engineering Unit 3 PPT Software Design
Software Design (Lectu. re 4).ppt
CHAPTER 3.pptx
Unit 3 Software engineering deataled notes .docx
Design1
System software design1
Ad

Recently uploaded (20)

PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Big Data Technologies - Introduction.pptx
PPTX
A Presentation on Artificial Intelligence
PPT
Teaching material agriculture food technology
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Big Data Technologies - Introduction.pptx
A Presentation on Artificial Intelligence
Teaching material agriculture food technology
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Encapsulation_ Review paper, used for researhc scholars
Spectral efficient network and resource selection model in 5G networks
Building Integrated photovoltaic BIPV_UPV.pdf
Approach and Philosophy of On baking technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
MYSQL Presentation for SQL database connectivity
20250228 LYD VKU AI Blended-Learning.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Diabetes mellitus diagnosis method based random forest with bat algorithm
“AI and Expert System Decision Support & Business Intelligence Systems”
NewMind AI Monthly Chronicles - July 2025
Mobile App Security Testing_ A Comprehensive Guide.pdf

Function oriented design

  • 1. Function-Oriented Design Module 3 Sangeetha Jose Lecturer in IT, Govt. Engg. College Idukki
  • 2. Design A process to design (verb) Result of the design process (noun)
  • 3. Different levels… System design or top-level design (modular level) Detailed design (Internal design of the module)
  • 4. Design methodology … .is a systematic approach to create a design by applying of a set of techniques and guidelines Input – specifications of the system to be designed Output – system design
  • 5. Object Oriented Design vs Function Oriented Design Object - oriented : modules in the design represent data abstraction Function - oriented : consists of module definitions, with each module supporting a functional abstraction Function-oriented design views a system as a set of modules with clearly defined behavior that interact with each other in a clearly defined manner to meet the system's requirements.
  • 6. Design Objectives The goal of software design is to find the best possible design that meets your needs You may have to explore different designs Unfortunately, evaluation criteria for a design are often subjective and non-quantifiable
  • 7. Major criteria to evaluate a design Correctness A software design is correct if a system built precisely according to the requirements of the system A design should be verifiable (does an implementation match the design), complete (does the design address its specified requirements) and traceable (all design elements can be traced back to specific requirements) Efficiency Does the design efficiently make use of scarce resources: such as memory on a wireless sensor Maintainability and Simplicity How easy is it for the design of a system to be understood? Simpler designs make it easy for a developer to understand and then maintain the system Cost Does the design help to reduce costs in later phases of software development? Can one design achieve the same quality as another design while reducing costs?
  • 8. Problem analysis Vs Design Principles Constructing a model of problem domain Model depends on the system Model is used to understand the problem Constructing a model of solution domain System depends on the model Model is used for optimization
  • 9. Design Principles Problem Partitioning and Hierarchy Abstraction Modularity Top-Down and Bottom-Up Strategies
  • 10. Problem Partitioning and Hierarchy Divide and Conquer Decompose system into smaller and smaller pieces Ideally, each piece can be solved separately Ideally, each piece can be modified independent of other pieces Reality: each piece must communicate with other pieces This communication implies a certain cost At some point the cost is more than the benefit provided by the individual pieces At this point, the decomposition process can stop
  • 11. Abstraction Abstraction is a powerful concept used in all engineering disciplines It is a tool that permits a developer to consider a component in terms of the services (behaviors) it provides without worrying about the details of its implementation
  • 12. Contd… Abstraction is an excellent tool for creating a hierarchical understanding of a system's functionality In design contexts, you might see references to two “types” of abstraction functional abstraction: a module is specified by the functions it performs data abstraction: a data structure is manipulated in terms of pre-defined operations; the implementation of the data structure is hidden from its users (only operations are visible) The former is primarily used in functional design, the latter is used primarily in object-oriented design
  • 13. Modularity A system is considered modular if it consists of discreet components so that each component can be implemented separately, and a change to one component has minimal impact on other components Helps in system repair and in system building Each component needs to support a well-defined abstraction and have a specific interface that other modules use to interact with it As Jalote says “Modularity is where abstraction and partitioning come together”.
  • 14. Top-Down vs Bottom-Up Design A system consists of a set of components, which have subcomponents of their own The highest level component is the system itself, a concept we have seen when discussing context diagrams We can design such a hierarchy using either a top-down approach or a bottom-up approach In reality, we use both approaches and meet in the middle A top-down approach starts with the system as a whole, and using stepwise refinement , decomposes it into sub-components that exist at lower levels of abstraction
  • 15. Contd… A bottom-up approach starts with primitive components that provide foundational services and using layers of abstraction builds the functionality the system needs until the entire system has been realized A top-down approach is typically more useful in situations only if the specifications of the system are clearly known and application is being built from scratch (water fall model) A bottom-up approach is thus more useful in situations in which a new application is being created from an existing (legacy) system (Iterative enhancement model)
  • 16. Module It is a logically separable part of a program It is a program unit that is discreet and identifiable with respect to compiling and loading Can be a function, a procedure, a process or a package
  • 18. Coupling “ how strongly” different modules are interconnected By definition, “ Coupling between modules is the strength of interconnections between modules or a measure of interdependence among modules” An abstract concept and is not easily quantifiable Highly coupled – strong interconnections loosely coupled – weak interconnections
  • 19. Contd… Factors influencing coupling are : type of connection between modules the complexity of the interface the type of information flow between modules Minimize the number of interfaces per module and the complexity of each interface Depends up on the type of information flow, coupling varies Data Flow – Minimal Hybrid – Maximum (data and control)
  • 21. Cohesion Cohesion is the concept that tries to capture intra-module bonds Shows how closely the elements of a module are related to each other. Shows how tightly bound the internal elements of the module are to one another Usually, greater the cohesion of each module in the system, the lower the coupling between module is. cohesion: how focused is an object (or module, or function, or package, etc.) on a particular task or concern a highly cohesive object has attributes and behavior that relate only to one task or concern
  • 22. Levels of cohesion Coincidental Low Logical Temporal Procedural Communicational Sequential Functional High
  • 23. Details… Coincidental Cohesion occurs when there is no meaningful relationship among the elements of a module. Logical Cohesion: if there is some logical relationship between the elements of a module (input and output modules) Temporal cohesion: same as logical cohesion, except that the elements are also related in time and are executed together (initialization, clean-up, termination) Procedurally cohesive module contains elements that belong to a common procedural unit (loop or a sequence of decision statements)
  • 24. Contd… Communicational cohesion has elements that are related by a reference to the same input or output data (may perform more than one function) Sequential cohesion occurs when output of one forms the input to another. In functional cohesion all the elements of the module are related to performing a single function (single function or single goal – “compute square root” or “sort the array”)
  • 25. How does one determine the cohesion level of a module? Compound sentence : sequential or communicational cohesion “ first”, “next”, “when”, “after” : sequential or temporal “ edit all data” : logical cohesion “ initialize” or “cleanup” : temporal cohesion
  • 26. We aim to create systems out of highly cohesive, loosely coupled components…
  • 28. Structure Charts A structure chart is a graphical representation of a system's structure; in particular, its modules and their interconnections Each module is represented by a box If A uses B, then an arrow is drawn from A to B B is called the subordinate of A A is called the superordinate of B An arrow is labeled with the parameters received by B as input and the parameters returned by B as output Arrows indicate the direction in which parameters flow Parameters can be data (shown as unfilled circles at the tail of a label) or control information (filled circles at the tail)
  • 29. The structure chart of the sort program
  • 31. Types of Modules Input : A module that only produces information that is passed to its superordinate Output : A module that only receives information from its superordinate for output to a device Transform : A module that converts data from one format into another format, possibly generating entirely new information. Coordinator : A module that manages the flow of data to and from different subordinates Composite : Modules that combine one or more of the above styles are composite modules
  • 33. Design specification A designer must also create a textual specification for each module that appears in the system's structure Design specification contains 1. Problem Specification 2. Major Data Structures 3. Modules and their Specifications 4. Design Decisions
  • 34. Structured Design Methodology The structured design methodology (SDM) views a system as a transformation function that transforms specified inputs into specified outputs.
  • 35. Factoring A key concept of SDM is factoring Factoring is the process of decomposing a module so that the bulk of its work is done by its subordinates SDM attempts to achieve a structure that is close to being completely factored
  • 36. SDM Strategy The overall strategy of SDM is to identify the input and output streams of the system and the primary transformations that have to be performed to produce the output High-level modules are then created to perform these major activities, which are later refined (factored) There are four major steps in applying this strategy Restate the problem as a data flow diagram Identify the input and output data elements Perform first-level factoring Perform additional factoring on input, output and transform branches created in the previous step
  • 37. Step 1: Restate the problem as a data flow diagram DFD represents how the data will flow in the system when it is built. Data flow diagrams during design are focused on the solution domain What are the inputs and outputs of our system (as opposed to the inputs and outputs of the problem domain)? What are the central transformations?
  • 38. Example 1: DFD for an ATM Back
  • 39. Example 2: DFD for a word-counting program Back
  • 40. Step 2: Identify the input and output data elements What we are looking for is the most abstract input elements (MAI) and the most abstract output elements (MAO) The MAI elements are found by going as far as possible from physical inputs without losing the incoming nature of the data element The MAO elements are found by identifying the data elements most removed from the physical outputs without losing the outgoing nature of the data element Figure1 Figure2
  • 41. Step 3: First-Level Factoring First-level factoring is the first step towards converting the DFD into a structure chart You start by creating a module that represents the software system (the main module) The main module acts as a coordinator module For each MAI data element, specify a subordinate input module that delivers these items to the main module For each MAO data element, specify an output module For each central transform, specify a subordinate transform module The inputs and outputs of these transform modules are specified in the DFD
  • 42. Example 1: First-Level Factoring of word-counting example
  • 43. Example 2: First-Level Factoring of ATM example
  • 44. Step 4: Perform Additional Factoring Now stepwise refinement is used to specify the sub-modules required to realize the functionality of the modules created in the previous step For each input module: assume that it is in the main module add input modules that takes its MAI data element closer to the raw input add transform modules in order to transform the raw input into the desired MAI data element
  • 45. Example: additional factoring of the word count program
  • 46. Contd… Output modules are treated in a similar fashion, this time working from MAO data elements to the raw output of the system Central transforms are also factored in a stepwise manner until you have specified atomic modules that can be implemented directly
  • 47. Example: additional factoring of the word count program
  • 48. SDM Wrap-Up Each new module produced in step 4 can then be examined to see if additional factoring is necessary
  • 49. Design Heuristics The strategy requires the designer to exercise sound judgment and common sense Cohesion and coupling should be the primary guiding factors A very high fan-out is not very desirable (control and coordinate more modules) Fan-in should be maximized Scope of effect of a decision should be subset of the scope of control.
  • 50. Verification Designs should be checked for internal consistency and for completeness with respect to the SRS If a formal design notation is used, then tools may be able to perform some of these checks ( Automated Cross Checking) Otherwise, design reviews (as part of your inspection process) are required to ensure that the finished design is of high quality
  • 51. Design Reviews To ensure “quality” of the design Aim of design reviews – detecting errors in design Review team – a member of both the system design team and the detailed design team, the author of the requirements document, the author responsible for maintaining the design document, and an independent software quality engineer.
  • 52. Metrics To provide quantitative data to the management process Cost and schedule metrics are needed for tracking the progress of the project Size is always a product metric of interest Size: Number of Modules x Average LOC expected per module Or you can generate LOC estimates for each individual module
  • 53. Metrics Quality metrics Simplicity – most important design quality attribute Complexity metrics Network Metrics Stability Metrics Information Flow Metrics
  • 54. Network Metrics Network metrics focus on the structure chart of a system They attempt to define how “good” the structure or network is in an effort to quantify the complexity of the call graph The simplest structure occurs if the call graph is a tree. As a result, the graph impurity (deviation of the tree) is defined as nodes - edges - 1 In the case of a tree, this metric produces the result zero since there is always one more node in a tree than edges This metric is designed to make you examine nodes that have high coupling and see if there are ways to reduce this coupling
  • 55. Stability Metrics Stability of a design is a metric that tries to quantify the resistance of a design to the potential ripple effects that are caused by changes in modules The creators of this metric argue that the higher the stability of a design, the easier it is to maintain the resulting system This provides a stability value for each particular module In essence, the lower the amount of coupling between modules, the higher the stability of the overall system
  • 56. Information Flow Metrics Information flow metrics attempt to define the complexity of a system in terms of the total amount of information flowing through its modules Jalote discusses two information flow metrics and how they can be used to classify modules
  • 57. Approach 1 A module's complexity depends on its intramodule complexity and its intermodule complexity intramodule complexity is approximated by the (estimated) size of the module in lines of code intermodule complexity is determined by the total amount of information (abstract data elements) flowing into a module (inflow) and the total amount of information flowing out of a module (outflow) The module design complexity Dc is defined as Dc = size * (inflow*outflow) 2 The term (inflow*outflow) 2 refers to the total number of input and output combinations, and this number is squared since the interconnections between modules are considered more important to determining the complexity of a module than its code size
  • 58. Approach 2 Approach 1 depends largely on the amount of information flowing in and out of the module Approach 2 is a variant that also considers the number of modules connected to a particular module; in addition, the code size of a module is considered insignificant with respect to a module's complexity The module design complexity Dc is defined as Dc = (fan_in * fan_out) + (inflow*outflow) fan_in above refers to the number of modules that call this module, fan_out is the number of modules called by this module
  • 59. Classification Neither of these metrics is any good, unless they can tell us when to consider a module “too complex” To this end, an approach was developed to compare a module's complexity against the complexity of the other modules in its system avg_complexity is defined as the average complexity of the modules in the current design std_deviation is defined as the standard deviation in the design complexity of the modules in the current design A module can be classified as error prone , complex , or normal using the following conditions Dc is the complexity of a particular module A module is error prone if Dc > avg_complexity + std_deviation A module is complex if avg_complexity < Dc < avg_complexity + std_deviation Otherwise a module is considered normal