Skip to content

Latest commit

 

History

History
21 lines (11 loc) · 2.34 KB

programing-paradigms.md

File metadata and controls

21 lines (11 loc) · 2.34 KB

Computer programming paradigms represent different approaches or styles of programming. They are essentially philosophical approaches to how code is structured and how problems are solved through programming. Here are some of the most common programming paradigms:

  1. Imperative Programming: This is about giving the computer a sequence of tasks and then it executes them. While doing so, it can change state. It's the most common paradigm and includes procedural programming.

  2. Procedural Programming: A type of imperative programming where the code is organized into procedures or functions. This means breaking down a task into a series of steps or procedures.

  3. Object-Oriented Programming (OOP): This paradigm uses "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs.

  4. Functional Programming: In this paradigm, programs are constructed by applying and composing functions. It focuses on the return values of functions, and side effects and different states are avoided.

  5. Declarative Programming: Unlike imperative programming, declarative programming expresses the logic of a computation without describing its control flow. Examples include SQL and HTML.

  6. Logic Programming: This paradigm is based primarily on formal logic. Any program written in a logic programming language is a set of sentences in logical form, expressing facts and rules about some problem domain. Prolog is a known logic programming language.

  7. Structured Programming: An approach to programming that follows a top-down design and employs a clear, structured control flow. Elements of structured programming include loops, if/else conditions, and subroutines.

  8. Event-Driven Programming: This paradigm is centered around the system responding to different events or messages. GUI applications are often event-driven.

  9. Concurrent Programming: In this paradigm, multiple processes are executed during overlapping time periods rather than sequentially. This is particularly useful in systems with multiple processors or cores.

Each of these paradigms has its own set of principles and concepts, and they often influence one another. Many modern programming languages support multiple paradigms, allowing developers to choose the most suitable one for each task.