There are following types of Programming Languages/Programming Paradigm are seen in modern times –
(A) Imperative Programming Paradigm
- Imperative programming is a programming paradigm where the program consists of statements that change the program’s state.
- Imperative programs focus on changing the program’s state through a series of statements or commands. These statements can modify variables, manipulate data structures, or perform input/output operations.
- These types of programming languages/concepts usually consist of commands/instructions and are executed sequentially.
- Imperative programs are typically structured as a sequence of steps to be executed in order. Control structures like loops and conditionals are commonly used to control the flow of execution.
- Imperative programming provides explicit control over the flow of execution through constructs like loops (e.g., for, while) and conditionals (e.g., if-else).
- Imperative programming encourages breaking down tasks into smaller procedures or functions, each of which performs a specific operation.
- Imperative programming allows for fine-grained control over resource management, such as memory allocation and deallocation.
- Imperative programming is well-suited for tasks where low-level control over the computer’s resources and state is necessary, such as systems programming or performance-critical applications.
- Examples are – Algol, Pascal, C, C++, Java, Python, Ada, etc.
- Imperative Programming Paradigm is further categorized into two sub-categories :
(a) Procedural Programming
-
- Procedural programming is a paradigm in software development where the program’s structure and behavior revolve around procedures, or routines, that perform specific tasks.
- These procedures are a series of instructions executed sequentially, often following a top-down approach.
- The program is structured around procedures, which are also known as functions or subroutines.
- These procedures encapsulate a set of instructions to perform a specific task. They can take inputs, perform operations, and return outputs.
- Procedures are executed sequentially, meaning that the instructions within each procedure are executed one after another in the order they are written.
- Procedures can share data through global variables or by passing parameters. However, excessive reliance on global variables can lead to code that is harder to maintain and debug.
- Procedural programming emphasizes breaking down the program into smaller, more modular pieces. Each procedure focuses on a specific task, making the code easier to understand, maintain, and debug.
- Examples are – C, Pascal, Basic, etc.
(1.) Structured Programming
-
-
- Structured programming is a technique for organizing and coding computer programs in which a hierarchy of modules is used, each having a single entry and single exit point.
- Structured Programming may have three types of control structures –
Sequence, Selection, and Iteration.
-
Characteristics for Structured Programming
-
-
- Every program should specify input and output variables.
- The flow of the program should be a top-down approach.
- Every program and function must have a comment at the beginning.
- Divide the big programs into subprograms (functions or procedures).
- Documentation should be short as far as possible.
-
Advantages of Structured Programming
-
-
- Easy to write.
- Easy to debug.
- Easy to understand.
- Easy to change.
-
(2.) Unstructured/Non-Structured Programming
-
-
- Non-structured programming, also known as unstructured programming, is an early programming paradigm that lacks the structured control flow mechanisms found in structured programming languages.
- It was prevalent during the early days of computer programming before structured programming concepts became widely adopted.
- Non-structured programming relies heavily on GOTO statements to control the flow of execution within a program. GOTO allows the program to jump to different parts of the code based on conditions or labels.
- Programs written in a non-structured style often exhibit “spaghetti code,” where the control flow is tangled and difficult to follow. This can make the code hard to understand, maintain, and debug.
- Non-structured programming often makes liberal use of global variables, which can lead to issues with code maintainability and reusability. Global variables can be modified from anywhere in the program, making it harder to track changes and understand program behavior.
- While non-structured programming lacks structured control flow, it may still use procedural decomposition to break down tasks into smaller subroutines or procedures. However, the lack of structured control flow makes it challenging to manage the flow of execution between these procedures.
- Non-structured programming languages typically lack high-level abstractions for organizing code and expressing complex logic. This can result in verbose and error-prone code.
- Early programming languages like assembly language and early versions of BASIC lacked structured programming constructs and were commonly used for non-structured programming. Even some higher-level languages, such as early versions of FORTRAN and COBOL, initially lacked structured programming features.
-
(b) Object Oriented Programming(OOPs)
-
- These types of programming languages/concepts usually consist of Classes & Objects and are executed according to objects.
- Examples are – Smalltalk, Eiffel, C++, Java, Simula, Python, PHP, C#, VB .Net, etc.
(B) Declarative Programming Paradigm
- Declarative programming is a paradigm in which the programmer specifies what the program should accomplish without explicitly specifying how to achieve it. Instead of giving a sequence of steps to follow, the programmer defines the problem to be solved or the desired outcome, and the language/runtime system figures out how to achieve that goal.
- Declarative programming languages emphasize expressing logic and constraints rather than providing step-by-step instructions for execution.
- Declarative languages often provide high-level abstractions for expressing complex operations concisely.
- Declarative programming can lead to more concise, maintainable, and expressive code, especially in domains where expressing relationships and constraints is crucial.
- Prolog, SQL, and HTML/CSS are examples of declarative languages. Prolog is used for logic programming, SQL for querying databases, and HTML/CSS for describing the structure and presentation of web pages.
- Declarative Programming is further categorized into two sub-categories :
(i) Functional Programming
-
- These types of programming languages/concepts usually consist of Functions and are executed according to call.
- Examples are – Lisp, Refal, Planner, Scheme, etc.
(ii) Logical Programming
-
- These types of programming languages/concepts usually consist of Predicate/Logical Formulas(axioms & a theorem) and are executed as per logical conditions.
- Examples are – Prolog etc.
(C) Hybrid Programming Paradigm
(I) Imperative + Object-oriented programming – Examples: Object Pascal, C++, Java, Ada-95, etc.
(II) Functional + Object-oriented programming – Examples: Clos
(III) Logic + Object-oriented – Examples: Object Prolog
Modular programming
- The modular approach to programming involves breaking a program down into sub-components called modules.
- modular programming is a powerful software design technique that promotes code organization, reuse, and maintainability, making it easier to develop and maintain complex software systems.
- Modular programming is a software design technique that emphasizes breaking down a program into smaller, manageable, and independent modules or components.
- Each module focuses on a specific aspect of the program’s functionality, and modules can be developed, tested, and maintained separately.
- This approach promotes reusability, maintainability, and scalability in software development.
- Each module is composed of some set of instructions.
- In this, the program is organized into modules, each responsible for a specific task or functionality. Modules encapsulate related code, data, and operations, making it easier to understand and modify the codebase.
- Modular programming promotes code reuse by allowing modules to be reused in different parts of the program or in other projects. Reusable modules can save development time and improve consistency across projects.
- Modular programming facilitates testing and debugging by isolating modules from each other. Each module can be tested independently, which simplifies the testing process and makes it easier to identify and fix issues.
- Modular programming supports scalability by allowing developers to add, remove, or replace modules as needed without affecting the entire system. This flexibility makes it easier to adapt the program to changing requirements or to extend its functionality.
- Many programming languages support modular programming features, such as modules, packages, or namespaces. Examples include Python’s modules, Java’s packages, and C’s header files and libraries.
Advantages of modular programming
- Easy to write.
- Easy to debug.
- The types of approaches.
- Top-down approach.
- Bottom-up approach.
0 Comments