Programming Languages Concepts: Difference between revisions
Line 48: | Line 48: | ||
=Functional Programming= | =Functional Programming= | ||
{{Internal|Functional Programming|Functional Programming}} | |||
Closures and recursion are at the base of the ''functional programming'' paradigm. | Closures and recursion are at the base of the ''functional programming'' paradigm. |
Revision as of 16:17, 21 March 2018
Internal
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
- Wikipedia Type System https://en.wikipedia.org/wiki/Type_system
For a statically typed system, the variables always have a specific type, and that type cannot be changed.
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
- Wikipedia Strong and Weak Typing https://en.wikipedia.org/wiki/Strong_and_weak_typing
Type Safety
Type Systems
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.
Metaprogramming
Metaprogramming is writing code that manipulates other code, or even itself.
Functional Programming
Closures and recursion are at the base of the functional programming paradigm.
Java 8 introduced lambda expressions, which allow behavior parameterization and functional programming.