0% found this document useful (0 votes)
13 views19 pages

Lecture 4 Part 2

Uploaded by

hagertamer1620
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views19 pages

Lecture 4 Part 2

Uploaded by

hagertamer1620
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Program Design

System Design 2022-2023


Design Guidelines

For constructing a structure chart,


there are several guidelines that you can use to improve its quality.
High-quality structure charts result in programs that are modular,
reusable, and easy to implement.
Measures of good design include
1. Coupling
2. Cohesion
3. Appropriate levels of fan-in and/or fan-out.

System Design 2022-2023


Build Modules With High Cohesion
Cohesion refers to how well
the lines of code within each
structure chart module relate
to each other. Ideally, a module
should perform only one task,
making it highly cohesive.

The more tasks that a module


has to perform, the more
complex the logic in the code
must be to implement the tasks
correctly 1.3 actually said calculate current and cumulative GPA and that module
1.4 was display grade listing and dean’s list

System Design 2022-2023


System Design 2022-2023
System Design 2022-2023
Functional cohesion occurs when all elements of the module contribute to
performing a single task, and this form of cohesion is highly desirable

Temporal cohesion takes place when functions within a module may not have
much in common other than being invoked at the same time.

Coincidental cohesion occurs when there is no apparent relationship among a


module’s functions (definitely something to avoid).

Factoring is the process of separating out a function from one module into a
module of its own

System Design 2022-2023


Cohesion decision tree (Adapted from Page-Jones, 1980).

System Design 2022-2023


Build Loosely Coupled Modules

Coupling involves how closely modules are interrelated, and the second guideline
for good structure chart design states that modules should be loosely coupled

Basically, the fewer the


arrows on the diagrams,
the easier it will be to
make future alterations
to the program

System Design 2022-2023


System Design 2022-2023
Create High Fan-In

Fan-in describes the number of control modules that communicate with a


subordinate; a module with high fan-in has many different control modules
that call it. This is a very good situation because high fan-in indicates that
a module is reused in many places on the structure chart, which suggests
that the module contains well-written generic code

System Design 2022-2023


Example (a) is better.

(a) high fan-in


System Design 2022-2023
(b) low fan-in
System Design 2022-2023
Avoid High Fan-Out

Although we want a subordinate to have several control modules,


we wish to limit the number of subordinates linked to a single control module.

System Design 2022-2023


(c) high fan-out

System Design 2022-2023


low fan-out (IRA = individual retirement account).
System Design 2022-2023
Assess the Chart for Quality

✓ Library modules have been created whenever possible.


✓ The diagram has a high fan-in structure.
✓ Control modules have no more than seven subordinates.
✓ Each module performs only one function (high cohesion).
✓ Modules sparingly share information (loose coupling).
✓ Data couples that are passed are actually used by the accepting module.
✓ Control couples are passed from “low to high.”
✓ Each module has a reasonable amount of code associated with it.

System Design 2022-2023


Program Specification
• After the analyst has communicated the general picture of the program's
structure.
• He must describe the individual modules in sufficient detail so that
programmers may take over and begin creating code.
• A programme specification is a document that describes a module on a
structure diagram and provides detailed instructions on how to implement that
module in the code.
• During the implementation phase of a project, programmers typically use
program specifications written by project team members for each module on
the structure chart to guide their own coding efforts.
• Specifications must be very clear and easy to understand, or else programmers
will be slowed down trying to decipher vague or incomplete instructions.

System Design 2022-2023


Syntax
There is no formal syntax for a program specification, so every organization uses
its own format.
Most program specification forms contain four components that convey the
information that programmers will need to write the appropriate code.
Program Information Events Inputs and Pseudocode
The top of the form in The second section Outputs Pseudocode is a
corresponding Figure contains basic of the form is used Next, the program detailed outline of
specification describes the lines of code that
program information, such as the to list the events need to be written
name of the module, its purpose, the inputs and outputs
that trigger the
to the program, which
the deadline, the programmer, and functionality in the are identified by the
the target programming language. program. An event data couples and
This information is used to help is a thing that control couples found
manage the programming effort. happens or takes on the structure chart

1 place 2 3 4
System Design 2022-2023
Program
specification form

System Design 2022-2023

You might also like