Structured Programming
Structured programming is a programming approach that emphasizes writing clear, organized, and logical code by dividing a program into smaller, manageable sections or functions. It uses three main control structures—sequence, selection, and iteration—to control the flow of the program instead of using unstructured jumps like goto statements. This method promotes top-down design, making programs easier to read, debug, test, and maintain. It is commonly used in languages such as C, Pascal, and Python, and forms the foundation of modern programming practices.
1. INTRODUCTION TO STRUCTURED PROGRAMMING
1.2. Programming Paradigms
A programming paradigm is a style or ―way‖ of programming. Some languages make it easy
to write in some paradigms but not others. Never use the phrase ―programming language
paradigm.‖ A paradigm is a way of doing something (like programming), and not a concrete
thing (like a language).
Some of the more common paradigms are
Imperative — Control flow is an explicit sequence of commands.
Declarative — Programs state the result you want, not how to get it.
Structured — Programs have clean, goto-free, nested control structures.
Procedural — Imperative programming with procedure calls.
Functional (Applicative) — Computation proceeds by (nested) function calls that avoid
any global state.
Function-Level (Combinator) — Programs have no variables. No kidding.
Object-Oriented — Computation is effected by sending messages to objects; objects
have state and behavior.
o Class-based — Objects get their state and behavior based on membership in a
class.
o Prototype-based — Objects get their behavior from a prototype object.
Event-Driven — Control flow is determined by asynchronous actions (from humans or
sensors).
Flow-Driven — Computation is specified by multiple processes communicating over
predefined channels.
Logic (Rule-based) — Programmer specifies a set of facts and rules, and an engine
infers the answers to questions.
Constraint — Programmer specifies a set of constraints, and an engine infers the
answers to questions.
Aspect-Oriented — Programs have cross-cutting concerns applied transparently.
Reflective — Programs manipulate their own structures.
Array — Operators are extended to arrays, so loops are normally unnecessary.
Paradigms are not meant to be mutually exclusive; you can program in a functional, object
oriented, event-driven style.