Unit 1 - Structured Paradigm
Unit 1 - Structured Paradigm
Unit 1 - Structured Paradigm
TextBook: Shalom, Elad. A Review of Programming Paradigms Throughout the History: With a Suggestion Toward a Future Approach, Kindle Edition
2.Procedural Programming Paradigm
Session 6 – 10 covers the following Topics:-
Procedural Programming Paradigm
Routines, Subroutines, Functions
Using Functions in Python
logical view, control flow of procedural programming in various aspects
Other languages: Bliss, ChucK, Matlab
Demo: creating routines and subroutines using functions in Python
Lab 2: Procedural Programming
Assignment : Comparative study of : Bliss, ChucK, Matlab
TextBook: Shalom, Elad. A Review of Programming Paradigms Throughout the History:
With a Suggestion Toward a Future Approach, Kindle Edition
3. Object-Oriented Programming
1. History
2. Overview
3. Component
4. Representations in different languages(C, C++, Java,
Python)
1. History
The Böhm-Jacopini theorem, also called structured program
theorem, stated that working out a function is possible by
combining subprograms in only three manners:
Executing one subprogram, and the other subprogram
(sequence) .
Executing one of two subprograms according to the value of
a Boolean expression (selection) .
Executing a subprogram until a Boolean expression is true
(iteration)
Some of the languages that initially used structured
approach are ALGOL, Pascal, PL/I and Ada.
Ex:-
Structograms use the following diagrams:
1.process blocks - Process blocks represent the simplest actions and
don’t require analysis. Actions are performed block by block.
2.Branching blocks
Branching blocks are of two types – True/False or
Yes/No block and multiple branching block.
3.Testing loops
Testing loops allow the program to repeat one or
many processes until a condition is fulfilled. There are
two types of testing loops – test first and test last
blocks – and the order in which the steps are
performed is what makes them different.
3.2. Subroutine
Procedure,
Function
Routine
Method
Subprogram.
Callable unit - Generic term.
Block
Two types of blocks can be distinguished based on
their location withina program:
block associated with a procedure
in-line block
Control structure – sequence, selection ,iteration and recursion.
(example for Control structure)
Recursion:
Recursion"; a statement is executed by repeatedly calling itself
until termination conditions are met. While similar in practice to
iterative loops, recursive loops may be more computationally
efficient, and are implemented differently as a cascading stack .
Graphical representation of the three basic patterns — sequence, selection, and repetition
Note:
Examples of Structured Programming language are C, C+, C++, C#, Java, PERL, Ruby, PHP, ALGOL, Pascal,
PL/I and Ada
Examples of unstructured Programming language are JOSS, FOCAL, MUMPS, TELCOMP, COBOL
Control Structure - DECISION MAKING (PYTHON )
With the break statement we can stop the loop even if the
while condition is true:
Example - Exit the loop when i is 3:
OUTPUT
i=1 1
2
while i < 6: 3
print(i)
if i == 3:
break
i += 1
THE CONTINUE STATEMENT
Reference : https://www.w3schools.com/python/python_for_loops.asp