โ Computer Science Fundamentals learning pathComputer Science Fundamentals ยท Module 8 of 10
Programming paradigms and compilers
Languages follow paradigms and are translated to machine code.
๐ Key ideas
- Imperative code says how to do steps; declarative code says what result you want (SQL).
- Object-oriented programming groups data and behaviour in objects.
- Functional programming uses pure functions and immutable data.
- Compilers translate the whole program ahead of time (C, Go, Rust).
- Interpreters run code line by line (Python); JIT compilers mix both (Java, JavaScript).
๐ก Real-life example: A compiler is a translator who translates a whole book before printing; an interpreter translates sentence by sentence as you listen.
CompilerTranslates code before running
InterpreterRuns code line by line
JITCompiles while the program runs
DeclarativeDescribe the result, not the steps