coding-M 4
coding-M 4
Coding
SHEMIL K.K
S6 CSE
Govt. Engg.
College
Idukki
Goal
Structured Programming
Information Hiding
Programming Style
Internal Documentation
Top-Down and Bottom-Up
Static Structure
structure of the text of the program (fixed)
Dynamic Structure
sequence of statements executed during execution
of the program
Objective
e.g:
Selection: if B then S1 else S2
if B then S1
Iteration: While B do S
repeat S until B
Sequencing: S1;S2;S3;…
Information Hiding
Principle: when information is represented as data
structures, only some defined operations should be
performed on the data structures
Control constructs
single-entry, single-exit constructs
Gotos
forward transfers is more acceptable than a
backward jump
Information Hiding
Contd…
User- defined types: enumerated type
Nesting
deep nesting should be avoided
Module size
guiding principle should be cohesion and
coupling
Module Interface
any module whose interface has more than five
parameters should be carefully examined and broken
in to multiple modules with a simple interface
Contd…
Program Layout
proper indentation, blank spaces, and parentheses
should be used to enhance the readability of programs
Side Effects
if a module has side effects, they should be properly
documented
Static Analysis
Symbolic Execution
Proving Correctness
Code Inspections
Unit Testing
Code Reading (Desk Review)
Details Abstraction
Static Analysis
Analyzing of programs by methodically analyzing the
program text
Done by programmer