Programming Languages Concepts

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

Statement

Expression

Typing

Type

A type determines the set of values and operations specific to values of that type, and the way the instances of the type are stored in memory - the size of the values. Expressions of a certain type (variables, functions) take their values from the type's set of values.

Static Typing vs Dynamic Typing

For a statically typed system, the variables and expressions always have a specific type, and that type cannot be changed. The type is known at compile-time.

Dynamically typed languages are convenient, because there are no intermediate steps between writing the code and executing it. However certain types of errors cannot be caught until the program executes. For statically typed languages, many of these errors are caught at the compilation phase. On the downside, static languages usually comes with a great deal of ceremony around everything that happens in the program (heavy syntax, type annotations, complex type hierarchies).

Strong Typing vs Loose Typing

A strong typed language is a language in which types limit the values that a variable can hold, or than an expression can produce, limit the operations supported by those values and determine the meaning of operations.

Type Safety

https://en.wikipedia.org/wiki/Type_safety

Type safety is the extent to which a programming language discourages or prevents type errors. Type enforcement can be static, exercised at compile-time, or dynamic, associated type information with values and detecting type errors at run-time, or both. Java and C# are examples of type-safe languages.

Type Systems

The Go Type System
The JavaScript Type System

Duck Typing

Polymorphism

Polymorphism is a feature of a programming language allowing to write code that behaves differently depending on the runtime state at a specific moment in time. The contract of the behavior is defined by an interface, while the implementation of the interface can vary. In Java, different classes may implement an interface, and instances of those classes can be used interchangeably as that interface. In Go, different concrete types implement an interface.

Interfaces in Go

Metaprogramming

Metaprogramming is writing code that manipulates other code, or even itself.

Object-Oriented Programming

Object-Oriented Programming

Functional Programming

Functional Programming

Concurrent Programming

Concurrent Programming

Formal Languages and Translators

Formal Languages and Translators

Number Representation in Computers

Number Redpresentation in Computers