Programming Concepts

Last updated on
1 min read

Table of Contents

Programming Paradigms

Imperative Programming

  • You tell the computer how to do something, step by step

  • total = 0
    for i in range(1, 6):
        total += i
    print(total)```
  • const button = document.createElement("button");
    button.innerText = "Click me";
    button.addEventListener("click", () => alert("Clicked"));
    document.body.appendChild(button);
  • Imperative Paradigms

    • Procedural Programming - C, Python. Using procedures/functions
    • Object Oriented Programming - C++, Java, C++. Using objects with state and behavior.

Declarative Programming

  • You tell the computer what you want, and the underlying system figures out the how

  • print(sum(range(1, 6)))

  • function App() {
      return <button onClick={() => alert("Clicked")}>Click me</button>;
    }
  • Declarative Paradigms

    • Functional Programming - Haskell, JS.
    • Logic Programming - Prolog, Datalog
    • Database Query Language - SQL
    • Config/markup languages - HTML, CSS, YAML, Terraform