Program Characteristics - robbiehume/CS-Notes GitHub Wiki
Language | Programming Paradigm(s) | Weak vs Strong | Dynamic or Static | Compiled or Interpreted |
---|---|---|---|---|
Python | OOP, Imperative, Functional | Strong | Dynamic | Interpreted |
Java | OOP, Imperative | Strong | Static | Compiled (JIT for JVM) |
JavaScript | Func., Imper., Event-Driven | Weak | Dynamic | Interpreted (JIT in browsers) |
C | Procedural, Imperative | Weak | Static | Compiled |
C++ | OOP, Procedural, Imperative | Weak | Static | Compiled |
PHP | Imperative, OOP | Weak | Dynamic | Interpreted |
Statically v. dynamically v. strongly v. weakly typed languages
Languages are either strongly typed or weakly typed but are also either statically typed or dynamically typed. This gives four different categories:
- Strongly, Statically typed languages (eg. COBOL, Fortran, Pascal, Modual-2, Ada, Oberon, Java)
- Strongly, Dynamically typed languages (eg. Python, Lisp, Scheme, Clojure, Lua)
- Weakly, Statically typed languages (eg. Objective-C, C++, C, VBScript)
- Weakly, Dynamically typed languages (eg. Forth, Perl, PHP, JavaScript, Assembly)
Programming Paradigms:
- Imperative: programming with an explicit sequence of commands that update state
- Procedural: specifies series of well-structured procedures and steps to compose a program
- C, Java, BASIC
- Object-Oriented: based on objects and data encapsulation
- Java, Python, JavaScript, C++
- Parallel Processing Approach:
- Procedural: specifies series of well-structured procedures and steps to compose a program
- Declarative: programming by specifying the result you want, not how to get it
- Functional: programs constructed by applying and composing functions. Loops and conditional statements are NOT supported
- Scala, Haskell, JavaScript?
- Logical:
- Database Processing Approach:
- Functional: programs constructed by applying and composing functions. Loops and conditional statements are NOT supported
Weak vs Strong Typed:
- Weak: implicit casting of data types
- Strong: implicit conversions between unrelated types isn't allowed
- Ex: allowing
2 + "hey" //"2hey"
or not
Dynamic vs Static Typed:
- Dynamic: data types are not predefined for variables; the type is determined at runtime
- Static: variable data type must be declared before defining value
Compiled vs Interpreted:
- Compiled: translate instructions once before running code
- Interpreted: translate instructions while code is executed
- Slows it down and can potentially make it harder to test/debug
- Allows for dynamic typing
- Hybrid:
JIT (Just-in-Time) vs AOT (Ahead-of-Time)
Aspect | JIT Compilation | AOT Compilation |
---|---|---|
Startup Time | Slower due to runtime compilation | Faster as code is pre-compiled |
Runtime Performance | Potentially faster in long-running apps via dynamic optimizations | Consistent but may lack some runtime-specific optimizations |
Memory Usage | Higher and variable due to runtime compilation and optimizations | Lower and more predictable |
Optimization | Adapts to actual usage patterns; can re-optimize as needed | Limited to compile-time analysis; cannot adapt at runtime |
Portability | High, as intermediate code can run on multiple platforms | Lower, binaries are platform-specific |
Use Cases | Long-running, performance-critical applications where adaptability is key | Applications requiring quick startup and consistent performance |
Low-level vs High-level:
Naming convention styles:
snake_case
camelCase
PascalCase
UPPER_CASE
(AKA Screaming Snake Case)kebab-case
(AKA "lisp-case" or "dash-case")