| Paradigm | Description | Characteristics | Examples |
|---|---|---|---|
| Imperative | Specify how to solve a problem using statements that change program state | Variables, assignment, control flow, subroutines | C, Pascal, Fortran, Basic |
| Object-Oriented | Structure programs around objects that contain data and methods | Encapsulation, inheritance, polymorphism, abstraction | Java, C++, C#, Python |
| Functional | Treat computation as evaluation of mathematical functions | Immutability, higher-order functions, recursion | Haskell, Lisp, ML, F#, JavaScript |
| Logic | Express programs as relations and use logical inference | Declarative, predicates, rules, facts | Prolog, Datalog |
| Procedural | Based on procedure calls and structured programming | Functions, procedures, variables, loops | Pascal, C, Fortran |
| Event-Driven | Program flow determined by events | Event handlers, callbacks, asynchronous execution | JavaScript, Visual Basic, C# |
| Concept | Description | Examples | Advantages/Disadvantages |
|---|---|---|---|
| Static Typing | Types checked at compile time | Java, C, C++, Haskell | Early error detection, performance, but less flexibility |
| Dynamic Typing | Types checked at runtime | Python, Ruby, JavaScript, PHP | Flexibility, rapid development, but runtime errors possible |
| Strong Typing | Strict enforcement of type rules | Haskell, Python, Java | Prevents type errors, but may require explicit conversions |
| Weak Typing | Loose enforcement of type rules | C, C++, JavaScript | Flexibility, but potential for errors |
| Polymorphism | Same interface for different data types | Function overloading, generics, inheritance | Code reusability, but complexity |
| Type Inference | Compiler deduces types automatically | Haskell, ML, Scala, C# | Less verbose, but harder to debug type errors |
| Approach | Description | Examples | Advantages/Disadvantages |
|---|---|---|---|
| Manual Management | Programmer explicitly allocates/deallocates memory | C, C++ | Full control, performance, but memory leaks possible |
| Automatic (Garbage Collection) | Runtime system automatically reclaims unused memory | Java, C#, Python, JavaScript | No memory leaks, but performance overhead |
| Reference Counting | Track number of references to each object | Python (partially), Objective-C | Deterministic deallocation, but cycle detection issues |
| Borrowing/Rust Model | Compile-time ownership checking | Rust | No garbage collection, memory safety |
| Stack Allocation | Automatic allocation/deallocation in LIFO order | All languages | Fast allocation, automatic cleanup |
| Heap Allocation | Dynamic allocation with manual or automatic management | Most languages | Flexible lifetime, but slower allocation |
| Scoping Type | Description | Examples | Characteristics |
|---|---|---|---|
| Lexical (Static) | Variable scope determined by source code structure | C, Java, Python, C++ | Predictable, checked at compile time |
| Dynamic | Variable scope determined at runtime | Early Lisp, Perl (special variables) | Flexible, but harder to debug |
| Global Scope | Variable accessible throughout program | All languages | Easy access, but can cause naming conflicts |
| Local Scope | Variable accessible only within specific block | All languages | Encapsulation, avoids naming conflicts |
| Block Scope | Variable accessible within a block | C, Java, JavaScript | Fine-grained control |
| Function Scope | Variable accessible within function | JavaScript (var) | Hoisting behavior |
| Construct | Purpose | Examples | Implementation |
|---|---|---|---|
| Control Structures | Control flow of execution | if/else, while, for, switch | Conditional jumps, loops in machine code |
| Functions/Methods | Modularize code into reusable units | function, procedure, method, subroutine | Stack frames, parameter passing, return mechanisms |
| Data Structures | Organize and store data | Arrays, records, classes, structs | Memory layout, access methods |
| Abstraction | Hide implementation details | Classes, modules, interfaces | Encapsulation, information hiding |
| Error Handling | Deal with exceptional conditions | try/catch/finally, exceptions, error codes | Stack unwinding, exception handling mechanism |
| Concurrency | Execute multiple tasks simultaneously | Threads, coroutines, async/await | OS threads, event loops, green threads |
| Phase | Description | Input | Output |
|---|---|---|---|
| Lexical Analysis | Convert source code to tokens | Character stream | Token stream |
| Syntax Analysis | Parse tokens into syntax tree | Token stream | Parse tree/AST |
| Semantic Analysis | Check semantic rules | Parse tree | Decorated AST |
| Intermediate Code Generation | Create intermediate representation | Decorated AST | IR code |
| Optimization | Improve code efficiency | IR code | Optimized IR |
| Code Generation | Create target machine code | Optimized IR | Assembly/machine code |
| Assembly | Convert assembly to machine code | Assembly code | Object code |
| Linking | Combine object files | Object files, libraries | Executable |
| Method | Description | Examples | Advantages/Disadvantages |
|---|---|---|---|
| Compilation | Translate entire program before execution | C, C++, Go, Rust | Fast execution, but longer development cycle |
| Interpretation | Execute program directly without prior translation | Python, Ruby, JavaScript (initially) | Fast startup, interactive development |
| Hybrid (Bytecode) | Compile to intermediate code, then interpret | Java (JVM), Python (.pyc), C# (.NET) | Platform independence, good performance |
| Just-In-Time (JIT) | Compile code at runtime | Java (HotSpot), JavaScript (V8), .NET | Optimization opportunities, but warm-up time |
| Transpilation | Translate source to source | TypeScript → JavaScript, CoffeeScript → JavaScript | Use advanced features on existing platforms |
| Feature | C | Java | Python | JavaScript |
|---|---|---|---|---|
| Typing | Static, weak | Static, strong | Dynamic, strong | Dynamic, weak |
| Memory Management | Manual | Garbage collected | Garbage collected | Garbage collected |
| Paradigm | Procedural | OOP, imperative | Multi-paradigm | Multi-paradigm |
| Execution | Compiled | Bytecode + JIT | Interpreted | Interpreted + JIT |
| Concurrency | Threads, POSIX | Threads, async | Threads, async, GIL | Event loop, async |
| Platform | Cross-platform | Write once, run anywhere | Cross-platform | Browser, server |
| Component | Purpose | Examples | Implementation |
|---|---|---|---|
| Standard Library | Provide common functionality | String handling, I/O, data structures | Built-in functions, classes, modules |
| Runtime System | Support program execution | Memory manager, garbage collector | System libraries, kernel interfaces |
| Package Manager | Manage dependencies and libraries | npm, pip, Maven, Cargo | Repository systems, dependency resolution |
| Development Tools | Support development process | IDEs, debuggers, profilers | Language-specific tools |
| Documentation | Explain language features | API docs, tutorials, specifications | Automated doc generation |
| Principle | Description | Application | Benefits |
|---|---|---|---|
| Simplicity | Keep language features minimal and clear | Avoid unnecessary complexity | Easier to learn, implement, and maintain |
| Orthogonality | Combine features in consistent ways | Independent language constructs | Predictable behavior, fewer special cases |
| Generality | Use few constructs for many purposes | Polymorphism, generic types | Reduced redundancy, increased flexibility |
| Uniformity | Consistent syntax and semantics | Consistent naming, syntax rules | Easier to learn and use |
| Abstraction | Hide complexity behind simple interfaces | Functions, classes, modules | Manageable complexity, code reuse |
| Efficiency | Enable performance optimization | Low-level access, optimization opportunities | Fast execution, resource utilization |