[Avg. reading time: 4 minutes]

Static vs Dynamic

Statically Typed

  • Type checking happens at compile time
  • The compiler verifies whether operations on variables are valid before execution
  • Many errors are caught early, during development
  • Types are usually explicit, sometimes inferred
int a = "Hello";
  • This fails at compile time
  • The program never runs

The above statement will result in an error during compile time itself.

Common statically typed languages

C / C++ / Go / Haskell / Java / Scala / Rust

Trade-offs

  • Safer refactoring
  • Better tooling and IDE support
  • More upfront thinking required

Dynamically Typed

  • Type checking happens at runtime
  • Variables do not have fixed types
  • The same variable can reference different types over time
  • Faster to write, easier to prototype
a = "Hello"
a = 10
  • This is valid
  • Errors appear only if invalid operations are executed

Common dynamically typed languages

Python / Ruby / Erlang / JavaScript / PHP / Perl

Trade-offs

  • Faster iteration
  • More runtime flexibility
  • Requires strong testing discipline

Simple Python example

Sum Up

  • Static does not mean bug-free
  • Dynamic does not mean unsafe
  • Most modern languages blur the line
  • Type inference
  • Optional typing
  • Runtime checks plus static analysis

#static #dynamic #python #rustVer 2.0.0

Last change: 2026-01-19