Static vs. dynamic typing

  • Static typing means that a reference value is manifestly (which is not necessarily the same as at compile time) constrained with respect to the type of the value it can denote
  • The language implementation, whether it is a compiler or an interpreter, both enforces and uses these constraints as much as possible
  • A language is dynamically typed if the type is associated with run-time values, and not named variables

Variable typing

  • A type system is a collection of rules that assign a property called type to various constructs in a computer program
  • Types are assigned to variables, expressions, functions, modules...
  • Defines a set of rules and protocols behind how a piece of data is supposed to behave
  • Reduces the number of bugs by verifying that data is represented properly throughout a program

Types of types

  • Primitive types – common types such as integers, booleans, floats, and characters
  • Composite types – composed of more than one primitive type, e.g. an array or record - all composite types are considered data structures
  • Abstract types – types that do not have a specific implementation (and thus can be represented via multiple types), such as a hash, set, queue, and stack
  • Other types – such as pointers (a type which holds as its value a reference to a different memory location) and...

Compiler

(in a narrow sense)
turns a higher-level program into a native-binary program

A native-binary program is:
- a bunch of instructions (cleverly called the text segment)
- a bunch of space for global/static initialized data (named the data segment)
- a bunch of space for global/static uninitalized data (named the bss segment)
- a bunch of empty workspace for intermediate calculations (called the stack)
- a bunch of empty space to place stuff we don't know the size of before it's needed (called the heap)

Compiled vs. interpreted

  • Programming languages are not classified as interpreted or compiled
  • Their particular implementations are
  • People confuse common implementation methods with necessary properties of language implementations

Imperative vs. declarative

  • Imperative programming is about telling your machine how to do something
  • Declarative programming is about telling your machine what you would like to happen in order to do something