Search This Blog

Friday, January 11, 2019

Structured/Imperative/Functional/Procedural Programming

Structured Programming 


  • Top-down analysis
    • Problem broken down into small piece (sub-problems) where each one has some significance.
    • Each small piece of problems are individually solved and steps are clearly stated.
  • Modular Programming
    • Code is broke down into small groups of instructions
    • These groups are knows as modules or subprograms or subroutines or methods.
    • Avoid jumps (unconditional GoTo) as non-traceable
  • Structured Code
    • Divide modules into further small units of code

  • Follow Top Down design model 
  • Maintainable Code
  • Systematic Organization
  • Reusable code block
  • Subdivision of program into functions
  • Hierarchy of task
  • Simple and easy to understand the code
  • Avoid unconditional Goto

Un-Structured code
  • Unconditional Goto 


Imperative languages


  • Imperative programming is a paradigm of computer programming in which the program describes a sequence of steps that change the state of the computer.
  • Unlike declarative programming, which describes "what" a program should accomplish, imperative programming explicitly tells the computer "how" to accomplish it.
  • To make programs simpler for a human to read and write, imperative statements can be grouped into sections known as code blocks.


Functional Programming


  • Functional programming (FP) is about passing data from function to function to get a result.
  • In FP, functions are treated as data, meaning you can use them as parameters, return them, build functions from other functions, and build custom functions.
  • A functional approach involves composing the problem as a set of functions to be executed.
  • In software, everything is a statement, unless it is a function. 


Procedural Programming


  • Procedural programming is a programming paradigm, derived from structured programming
  • Based upon the concept of the procedure call. Procedures
  • Also known as routines, subroutines, or functions, simply contain a series of computational steps to be carried out.
  • Any given procedure might be called at any point during a program's execution, including by other procedures or itself.
  • Procedural programming (PP), also known as inline programming takes a top-down approach.
  • It is about writing a list of instructions to tell the computer what to do step by step.
  • It relies on procedures or routines.
  • Procedural programming is a type of imperative programming in which the program is built from one or more procedures (also termed subroutines or functions).
  • Procedural programming could be considered a step towards declarative programming.
  • A programmer can often tell, simply by looking at the names, arguments, and return types of procedures (and related comments), what a particular procedure is supposed to do, without necessarily looking at the details of how it achieves its result.
  • At the same time, a complete program is still imperative since it fixes the statements to be executed and their order of execution to a large extent.

No comments:

Post a Comment


This is a User Friendly Blog.
Simple Interface and Simple Controls are used.
Post your comments so i can modify blog regarding your wish.