2. Elementary structures of structured programs
Structured programming (sometimes known as modular programming) is a
programming paradigm that facilitates the creation of programs with readable code
and reusable components. Includes
• Block: It is a command or a set of commands that the program executes linearly.
• Selection: It is the branching of the flow of control based on the outcome of a
condition.
• Iteration: It is the repetition of a block as long as it meets a specific condition.
• Nesting: The above building blocks can be nested because conditions and
iterations, when
• Subroutines: Since entire programs now have singular entry-exit points,
encapsulating them into subroutines allows us to invoke blocks by one identifier.
3. Types of structured programming
Structured programming can be divided into three categories,
including:
Procedural programming: Defines modules as "procedures" or
"functions" that are called with a set of parameters to perform a task.
Object-oriented programming (OOP): Defines a program as a set of
objects or resources to which commands are sent. An object-oriented
language will define a data resource and send it to process commands.
Model-based programming: The most common example of this is
database query languages. In database programming, units of code are
associated with steps in database access and update or run when those
steps occur.
4. Advantages and Disadvantages of structured programming
Advantages of structured programming
The primary advantages of structured programming are:
▪ It encourages top-down implementation, which improves both readability
and maintainability of code.
▪ It promotes code reuse, since even internal modules can be extracted and
made independent, residents in libraries, described in directories and
referenced by many other applications.
▪ It's widely agreed that development time and code quality are improved
through structured programming.
These advantages are normally seen as compelling, even decisive, and nearly
all modern software development employs structured programming.
5. Cont..
Disadvantages of structured programming
▪ Reduction in execution efficiency,
▪ Greater memory usage.
▪ A queue organized as LIFO, or last-in-first-out)
▪ Over-structuring and loss of efficiency.
6. Self-Assessment Exercises 2
1) Define structured programming and explain its components
2) Discuss different categories of structured programming