structured design n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Structured Design PowerPoint Presentation
Download Presentation
Structured Design

Loading in 2 Seconds...

play fullscreen
1 / 29

Structured Design - PowerPoint PPT Presentation


  • 81 Views
  • Uploaded on

Structured Design. Design Quality – Simplicity. “There are two ways of constructing a software design: One is to make it so simple that there are obviously no deficiencies, and the other is to make it so complex that there are no obvious deficiencies. The first method is far more difficult.”

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Structured Design' - kadeem


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
design quality simplicity
Design Quality – Simplicity

“There are two ways of constructing a software design: One is to make it so simple that there are obviously no deficiencies, and the other is to make it so complex that there are no obvious deficiencies. The first method is far more difficult.”

  • -- C. A. R. Hoare
good designs
Good Designs . . .
  • Are modular, reflecting a clear logical problem decomposition
  • Are flexible, making them easier to maintain
  • Employ modules with coherence and sharp focus
  • Employ loose coupling between modules
  • Employ simple module interfaces
  • Allow for reusability (leveraging)
  • Employ encapsulation (logical data independence)
aspects of structured design
Aspects of Structured Design
  • Combined with Structured Analysis, it allows the form of the problem to guide the form of the solution
  • Manages complexity by partitioning the system design and employing hierarchies
  • Uses graphical tools (structure charts)
  • Includes strategies for developing a design from analysis
  • Offers a set of criteria for evaluating the quality of a design
structured application development
Structured Application Development
  • Top-down approach
  • Partitioning
  • Modular design
  • Must proceed carefully, with constant input from programmers and IT management to achieve a sound, well-integrated structure
  • Must ensure that integration capability is built into each design and thoroughly tested
process decomposition
Process Decomposition

Decomposition – the act of breaking a system into sub-components. Each level of abstraction reveals more or less detail.

decomposition diagrams
Decomposition Diagrams

Decomposition diagram – a tool used to depict the decomposition of a system. Also called hierarchy chart.

structured application development1
Structured Application Development
  • Structure Charts
    • Structure charts show the program modules and the relationships among them
    • Control module
    • Subordinate modules
structured application development2
Structured Application Development
  • Structure Charts
    • Condition
      • A condition line indicates that a control module determines which subordinate modules will be invoked, depending on a specific condition
    • Loop
      • A loop indicates that one or more modules are repeated
structured application development3
Structured Application Development
  • Structure Chart Examples
structured application development4
Structured Application Development
  • Drawing a Structure Chart
    • Step 1: Review the DFDs
    • Step 2: Identify Modules and Relationships
    • Step 3: Add Couples, Loops, and Conditions
    • Step 4: Analyze the Structure Chart and the Data Dictionary
criteria to evaluate a design
Criteria to Evaluate a Design
  • Coupling
  • Cohesion
  • Factoring
  • Decision-Splitting

Why do we bother?

The issue is always maintenance!

structured application development5
Structured Application Development
  • Cohesion and Coupling
    • If you need to make a module more cohesive, you can split it into separate units, each of which performs a single function
    • Loosely coupled
    • Tightly coupled
    • Status flag
flags and data in structure charts
Flags and Data in Structure Charts
  • Sometimes we need to communicate information beyond data
  • Flags can be used to communicate control issues
  • To distinguish the two different kinds of parameters, the symbol is used for data and the symbol is used for flags in structure charts
  • Control Couple
    • Flag
    • A module uses a flag to signal a specific condition or action to another module
coupling
Coupling
  • Coupling refers to the degree ofinterdependence between/among modules
  • The objective is to minimize coupling and make modules as independent as possible
advantages of low loose coupling
Advantages of Low (Loose) Coupling
  • Fewer connections between modules means less chance for a ripple error effect
  • We want to be able to change one module with minimum effect on another
  • Maintenance will be made easier if we can focus on only one module at a time – the black box philosophy
types of coupling
Types of Coupling
  • Data coupling
  • Stamp coupling
  • Control coupling
  • Common( Module refers to the same global data area)
  • Content (module refers to inside of another module (really bad))

Good, or Loose

Less Desirable, or Tight

(harder to maintain)

example of data coupling
Example of Data Coupling
  • Two modules are data coupled if they communicate explicitly via parameters
  • This is normal and desirable, provided the parameters have been well thought through

format customer

record

coupled through parameters

acct_num

cust_name

. . .

get customer

name

example of stamp coupling
Example of Stamp Coupling
  • Two modules are stamp coupled if they refer to the same data structure.
  • This is done often for convenience, but it does present some potential dangers:
    • It exposes a module to more data than it needs
    • Can create dependencies between otherwise unrelated modules

generate car rental bill

customer

rental

record

customer

rental

record

basic

rental

charge

mileage

charge

calculate basic

charge

compute mileage

charge

stamp coupled

via a record

example of control coupling
Example of Control Coupling
  • Two modules are control coupled if one passes information (often a flag) to the other that is intended to control the internal logic of the other
  • Can indicate poor delegation of tasks/authority

generate car rental bill

compute discount

basic

rental

charge

Rules for discount eligibility and algorithm for discount calculation seem to be divided between the two modules. Could be a maintenance headache when eligibility rules and/or calculation algorithm change.

customer rental

record

calculate basic

Charge and Discount

prescriptive flagfor this module

Flags should be descriptive – not prescriptive.

cohesion
Cohesion
  • Cohesion refers to the degree to which a module has a clear function and focus
  • The objective is to maximize the cohesion of modules
advantages of strong cohesion
Advantages of Strong Cohesion
  • The more focused a module, the less likely that it will be interdependent with other modules
  • Maintenance is easier if the purpose of modules is clear cut and singular (black box design)
levels of cohesion
Levels of Cohesion
  • Functional cohesion
  • Sequential cohesion
  • Communicational cohesion
  • Temporal cohesion
  • Logical cohesion
  • Coincidental

Best (pure black box)

Increasing harder to maintain

functional cohesion
Functional Cohesion
  • A functionally cohesive module focuses on one clearly defined problem or task
  • Note that details of this task may require calls to other modules, so we are not talking about just the size of a task, but rather its focus
  • Three examples of functionally cohesive modules:
    • Read customer record
    • Calculate basic rental charge
    • Compute federal tax deduction
sequential cohesion
Sequential Cohesion
  • A sequentially cohesive module has functions that operate in sequence, with results from one function acting as input for the next
  • Can sometimes be factored into several functionally cohesive modules – example later

Example:

Validate account number and use it to find customer name

communicational cohesion
Communicational Cohesion
  • A communicationally cohesive module operates on common input data
  • Individual tasks may not be tightly related – only by the fact that they operate on the same data
  • Could be factored (separated) if this is deemed desirable

Example:

Compute maximum and average regional sales

Both calculations would operate on the same data set

temporal cohesion
Temporal Cohesion
  • A temporally cohesive module has activities related by time
  • These occur because it is tempting to group activities that occur at initialization or end-of-task, etc.
  • Could be a problem for maintenance. May be wise to separate.

Two examples:

Initialize all records and tables

Perform all end of job activities (write logs, close files, rewind tapes)

logical cohesion
Logical Cohesion
  • A logically cohesive module has activities that are of the same general category (i/o for example)
  • At a given call, the activity appropriate to the task at hand might be chosen (perhaps by a flag)
  • Again, can be an issue for maintenance. Such modules can be very useful, but they must be designed carefully.
  • Two examples:
    • Collect any required input (probably need a flag to operate)
    • Compute selected statistics for data (again, need a flag)