Glossary

Abstract Data Type

A more formal definition of the familiar idea that types should be defined by abstractions with hidden implementations. An abstract data type is defined only in terms of allowed operations, i.e., without specifying fields, since they are part of the implementation. Abstract data types may or may not be immutable. Representative examples include maps, queues, and stacks, where multiple implementations are possible (including mutable and immutable, as long as all state-changing operations are defined to return a reference to the possibly new instance). Contrast with algebraic data type, where only a well-defined set of public subtypes are allowed.

Abstraction

The outwardly visible state, state transformations, and other operations supported by a type. This is separate from the encapsulated implementation (fields and methods) of the abstraction. Scala traits and abstract classes are often used to define abstractions and optionally implement them. Concrete types provide complete implementations.

ACID

A desired property of database transactions. They should support atomicity, consistency, isolation, and durability. See [ACID] for more details.

Actor

An autonomous sender and receiver of messages in the actor model of concurrency.

Actor Model of Concurrency

A concurrency model where autonomous actors coordinate work by exchanging messages. An actor’s messages are stored in a mailbox until the actor processes them.

Agile and Agile Methods

An umbrella term for several lightweight development processes and specific practices that are designed to minimize process waste, while improving code quality and communications with project stakeholders.

Algebraic Data Type

A special kind of data type that is defined in Java by an interface and a fixed set of possible implementing classes, representing all possible instances of the data type. There may be a well-defined set of operations that maps instances of one type to new instances of the same type or one of the other types. Algebraic data types are always containers for other types (e.g., list and option). Contrast with abstract data type, where the implementing subtypes are not limited and are often hidden from the user of the type.

Anonymous Function

A value that is a function (as opposed to a class instance or a primitive value) without a name in the usual way that methods are named. Languages that support anonymous functions have a special syntax for defining the value. For example, using the planned lambda syntax in Java 8, addCallback(#{Event e -> log(INFO, e)}) passes an anonymous function to some addCallback method. The anonymous function takes a single argument of type Event and logs it. Anonymous functions are sometimes called lambdas (for historical reasons) or function literals. See also closure.

Associative Arrays

Another common name for the map data structure, i.e., a collection of key-value pairs.

Base Type

A synonym for parent type or supertype.

Big Data

A buzzword for the challenges of and approaches to working with data sets that are too big to manage with traditional tools, such as relational databases. So called NoSQL databases, clustered data processing tools like MapReduce, and other tools are used to gather, store, and analyze such data sets.

Bound Variable

A variable that is declared as an argument to an anonymous function or is a local variable declared within the function. It is “bound” to a value when the function is invoked.

Bridge

A design pattern where a reference to an object is separated from the instance itself, allowing both to vary independently. Also known as “handle/body.” Bridge is used in Software Transactional Memory to allow references to values to be changed in a controlled way. It is also used in some Actor libraries, like the [Akka] library, to allow clients to keep the same reference to an actor, even if the actual instance has been replaced with a new one.

Category Theory

A branch of mathematics that studies collections of “objects” (used more generally than in object-oriented programming) and “arrows” or “morphisms” that connect the objects in some sense. Category theory has been a fruitful source of ideas for concepts in functional programming.

Child Type or Child Class

A class which is derived from another class and also optionally implements one or more interfaces. Also called a subtype or derived type. See inheritance.

Class

A template for creating instances. A class defines implementation of methods and fields. A class defines type.

Closure

A function with every free variable referenced in the function bound to variables of the same name in the enclosing scope where the function is defined. The free variables are “closed over,” hence the name. See also bound variable.

Combinators

Functions that return an instance of one of their input types, which can be “combined,” according to the rules of Combinatory Logic, to build more complex logic. The result can then be applied to values to perform the computation. The filter, map, and fold functions are combinators.

Combinatory Logic

A model of computation invented by Haskell Curry and others that eliminates explicit variables and instead expresses calculations as the combination of operators (higher-order functions) that will be applied to data when used.

Composable (or Composition)

The ability to join software “modules” together with relatively little effort to create new behaviors and representations of state from the individual behaviors and states provided by the components.

Comprehensions

“Comprehending” the elements of a collection or lazy representation of one (such as all integers), including filtering, mapping, and folding over them. In some languages, comprehensions are syntactic sugar for filter, map, and fold invocations.

Concurrency

A model of computation with simultaneous sequences of computation and unpredictable interaction between the sequences. For example, two threads in an application that occasionally communicate. In contrast to parallelism, the apparent simultaneity might be an illusion, for example when the program executes on a single CPU with a single core. An example of the unpredictability of concurrency is the handling of asynchronous events, such as user input or network traffic. The precise sequence of execution steps that will occur in the entire program can’t be predicted in advance. Contrast with parallelism.

Contract

The protocol and requirements that exist between a module (e.g., class, object, or single method) and clients of the module. More specifically, see design by contract.

Coupling

In this context, how closely dependent one “module” is on the details of another. Strong coupling between two modules makes the reuse and evolution of either module more difficult. It also becomes harder to substitute one module for another, if both satisfy the same public abstractions. Hence weak coupling is generally preferred. Inheritance is an example of strong coupling.

Currying

Converting an N argument function into a sequence of N functions of one argument, where each function except for the last returns a new function that takes a single argument that returns a new function, etc., until the last function that takes a single argument and returns a value.

Declarative Programming

The quality of many functional programs and domain-specific languages where the code consists of statements that declare relationships between values, rather than directing the system to take a particular sequence of actions. The underlying runtime can then decide how to “satisfy” the relationships. Contrast with imperative programming.

Derived Type

A synonym for sub type and child type.

Design by Contract

An approach to class and module design invented by Bertrand Meyer for the Eiffel language [Meyer1997]. For each entry point (e.g., method call), valid inputs are specified in a programmatic way, so they can be validated during testing. These specifications are called preconditions. Similarly, assuming the preconditions are satisfied, specifications on the guaranteed results are called postconditions and are also specified in an executable way. Invariants can also be specified that should be true on entry and on exit.

Design Pattern

A solution to a problem in a context. A code idiom or design structure that satisfies the needs of a frequently occurring problem, constraint, requirement, etc. The “context” portion of the definition is important, as it specifies conditions when the pattern is an appropriate choice and when it isn’t.

Domain-Specific Language

A custom programming language that resembles the terms, idioms, and expressions of a particular domain. An internal DSL is an idiomatic form of a general-purpose programming language. That is, no special-purpose parser is required for the language. Instead, DSL code is written in the general-purpose language and parsed just like any other code. An external DSL is a language with its own grammar and parser. In Java, good examples of internal DSLs include most “mocking” frameworks for testing. See, for example, [Mockito].

Eager Evaluation

Evaluation of an expression (such as computing a value) as soon as the expression is encountered, rather than delaying evaluation until the result is actually needed, on demand, which is called lazy evaluation. Eager evaluation is sometimes called “call by name.”

Encapsulation

Restricting the visibility of members of a type so they are not visible to clients of the type when they shouldn’t be. This is a way of exposing only the abstraction supported by the type, while hiding implementation details, which prevents unwanted access to them from clients and keeps the abstraction exposed by the type consistent and minimal.

Event

The notification of a state change in event-based concurrency.

Event-Based Concurrency

A form of concurrency where events are used to signal important state changes and handlers are used to respond to the events.

Factory

A general term for several related design patterns that abstract the process of constructing objects.

Field

A variable in an object that holds part of the object’s state.

Final

Keyword for declarations. For types, final prevents users from subclassing the type. For methods, final prevents users from overriding the members. For variables, final prevents users from reassigning the values.

First-Class Value

An indication that the applicable “concept” is a first-class construct in the language, meaning you can assign instances to variables, pass them as function parameters, and return them from functions. In Java, primitives and objects are first-class values, while functions and classes themselves are not. Most other programming languages support functions as first-class values, at least in some form.

Free Variable

A variable that is referenced in an anonymous function, but is not passed in as an argument nor declared as a local variable. Therefore, it must be “bound” to a defined variable of the same name in the scope where the anonymous function is defined, to form a closure.

Function

Similar to a method, but not bound to a particular class or object. Functions are first-class values in functional programming languages, and they can usually be defined “anonymously”; see anonymous function. Functions also have no side effects in functional programming, meaning they don’t change state, but only return new values.

Function Literal

A less commonly used name for an anonymous function. See also lambda.

Functional Programming

A form of programming that follows the mathematical principles for function and variable behaviors. Mathematical functions are side-effect-free and first-class values. Variables are assigned once, so values are immutable.

Generics

Types that are defined with type parameters representing other types that they use. For example, Java’s List<T>. When an instance of a generic type is created, the type parameters must be specified with actual types. The term parameterized types is sometimes used instead.

Higher-Order Functions

Functions that take other functions as arguments or return a function value.

Immutable Value

A value that can’t be changed after it has been initialized. Contrast with mutable value.

Imperative Programming

The quality of many object-oriented and “procedural” programs where the code consists of statements directing the system to take a particular sequence of actions. Contrast with declarative programming.

Infinite Data Structure

A data structure that represents a non-terminating collection of values (such as the non-negative integers), but which is capable of doing so without exhausting system resources. The values are not computed until the data structure is asked to produce them. As long as only a finite subset of the values are requested, resource exhaustion is avoided.

Inheritance

A strong coupling between one class or interface and another. The inheriting (derived) class or interface incorporates the members of the parent class or interface, as if they were defined within the derivative. Hence, inheritance is a form of reuse. The derivative may override inherited members (unless declared final). For a properly defined derived type, instances of it are substitutable for instances of the parent, satisfying the Liskov Substitution Principle.

Instance

Another term for an object created by invoking a class constructor or a value of a primitive type.

Invariance and Invariant

In the context of design by contract, an assertion that should be true before and after a method is executed.

Lambda

In the days when Alonzo Church and others were developing lambda calculus, it got its name from the use of the Greek letter lambda (λ) to represent a function. As a result, the term is often used for anonymous functions.

Lazy Evaluation and Laziness

A feature of mathematics and many functional languages where expression evaluation is delayed until its value is needed, rather than doing the evaluation eagerly. This feature is useful for delaying or eliminating expensive evaluations, preventing unnecessary re-evaluations (e.g., through memoization), and for representing infinitely large data structures, where only some of the values will be needed. Compare with eager evaluation and contrast with strict reduction. Lazy evaluation is sometimes called “call by need.”

List

The fundamental data structure in functional programming, representing a linked list, which is implemented as a “head” element and a “tail” linked list that represents the rest of the list. Lists are algebraic data types; there are only two concrete types that represent all lists, a type for empty lists and a type for non-empty lists. There are also well-defined rules for transitioning from one to the other. Compare with map.

Liskov Substitution Principle

Named after its inventor, Barbara Liskov, it specifies that if a type T has certain properties P, then instances of a different type T2 can be substituted for instances of T if and only if T2 also satisfies the same properties P. In object-oriented programming, inheritance is normally used to define these type relationships. See also [LSP].

Map

The common data structure in programming, representing a collection of key-value pairs. Maps have a well-defined abstraction that declares operations that can be performed on the map. A wide variety of implementations are possible, often based on performance and resource tradeoffs. Because there is no fixed set of possible implementing types and the focus is instead on the abstract “specification,” maps are an example of an abstract data type. Compare with list.

MapReduce

A divide and conquer strategy for processing large data sets in parallel. In the “map” phase, the data sets are subdivided. The desired computation is performed on each subset. The “reduce” phase combines the results of the subset calculations into a final result. MapReduce frameworks handle the details of managing the operations and the nodes they run on, including restarting operations that fail for some reason. The user of the framework only has to write the code for mapping and reducing the data sets.

Member

A generic term for a field or method declared in a class.

Memoization

A form of caching that optimizes function invocations. The results from a function’s invocations are saved so that when repeated invocations are made with the same inputs, the cached results can be returned instead of re-invoking the function. Memoization is only useful for functions that are side-effect-free.

Message

In the actor model of concurrency, messages are exchanged between actors to coordinate their work. In object-oriented programming, method invocation is sometimes referred to as “sending a message to an object,” especially in certain languages (for example, Smalltalk).

Method

A function that is defined by a class and can only be invoked in the context of the class or one of its instances.

Monad

A Category Theory concept adopted in functional programming. A monad is a kind of container with a protocol for adding elements to it. For example, Monads are used to sequence computations that must be evaluated in a particular order (such as IO) that would otherwise be lazy and evaluated in arbitrary order, if at all. Monads are also useful for isolating code with side effects (which is also incompatible with laziness).

Mutable Value

A value that can be changed after it has been initialized. Contrast with immutable value.

NoSQL

An umbrella term for non-relational data stores, hence the name. These stores sacrifice ACID transactions for greater scalability and availability.

Object

A cohesive unit with a particular state, possible state transitions, and behaviors. In Java, an object is an instance of a class.

Object-Oriented Programming

A form of imperative programming that encapsulates state values and related operations, exposing a cohesive abstraction to clients of the object while hiding internal implementation details. Java’s object model is based on classes; objects are instantiated from classes. Most class-based, object-oriented languages also support subtyping to define specializations and “family” relationships between types.

Overloaded Functions

Two or more functions defined in the same scope (e.g., as methods in a type or as “bare” functions) that have the same name, but different signatures.

Overridden Functions

When a function with a particular signature in a parent class is redefined in a child class, so its behavior changes. Overridden functions must obey the Liskov Substitution Principle.

Parallelism

Computation sequences that happen at the same time, because they are running on separate CPU cores or separate servers. Parallelism is a deterministic model in the sense that sequences are spawned at specific points in the program and the program often waits at another point until all the parallel sequences have finished (called “joining”). Contrast with concurrency.

Parameterized Types

An alternative term for generics.

Parametric Polymorphism

The property of generic types like List<T> that their behavior is independent of the actual type for T.

Parent Type or Parent Class

A class from which another class is derived. Also called a supertype or base type. See inheritance.

Partial Application

A feature of many languages where a function can be invoked with only a subset of its arguments supplied, yielding a new function that takes the remaining arguments. Some languages only permit “curried” functions to be invoked in this way (see currying).

Pattern Matching

An advanced form of switch expressions that support matching instances by type and extracting values from those types, e.g., field values.

Precondition

An assertion that should be true on entry to a method or other entry point. See design by contract.

Postcondition

An assertion that should be true on exit from a method or other boundary point. See design by contract.

Primitive Type

The non-object types in Java, e.g., int, long, float, double, and boolean.

Pure

Used in the context of functions to mean that they are side-effect-free. See also referential transparency.

Recursion

When a function calls itself as part of its computation. A termination condition is required to prevent an infinite recursion. You can also have cycles of recursion between two or more functions. See also tail-call recursion.

Referential Transparency

The property of an expression, where it can be replaced with its value without changing the behavior of the code (see memoization). This can only be done with side-effect-free expressions (e.g., functions) when the inputs are the same.

Scope

A defined boundary of visibility, constraining what variables, types and their members are visible within it.

Side-Effect-Free

Functions or expressions that have no side effects, meaning they modify no global or “object” state, only return new values.

Signature

For a function, the name, parameter list types, type parameters (for generic functions), and the return value. For a method, the signature also includes the type that defines the method.

Singleton

A design pattern where a class is implemented in a special way so that only one instance of the type is ever instantiated.

State

As in, “the state of an object,” where it means the set of the current values of an object’s fields. The state of the whole program is the set of all object states and the “value” of the stack.

Static Typing

Analyzing expressions in a program to prove that certain behaviors won’t occur, based on an analysis of the values the expressions can produce.

Strict Reduction

A concept similar to lazy evaluation, but pertaining to how expressions are reduced to simpler forms. See [Lazy vs. non-strict] for more details.

Strong Coupling

See coupling.

Structure Sharing

A technique for efficiently copying large, immutable data structures, where the parts that aren’t changing are shared between the old and new copies.

Subtype

A synonym for child type or derived type.

Subtype Polymorphism

The technical term for polymorphic behavior of a type hierarchy implemented using inheritance.

Supertype

A synonym for parent type or base type.

Tail-Call Recursion

A form of recursion where a function calls itself as the last thing it does, i.e., it does no additional computations with the result of the recursive call. Tail-call recursions can be automatically converted to loops, eliminating the overhead of creating a stack frame for each invocation. However, neither the JVM nor the Java compiler currently performs this optimization.

Test Double

A generic term for a special object that substitutes for a “normal” object in a test, e.g., to fake network I/O or do some verifications during execution.

Test-Driven Development

A development discipline where no new functionality is implemented until a test has been written that will fail initially, but pass once the functionality is implemented.

Type

A categorization of allowed states and operations on those states, including transformations from one state to another. In Java, the type of an object is a primitive type or the combination of its declared class (explicitly named or anonymous), the specific types used to resolve any parameters when the class is generic, and finally, any overridden methods that are defined when the instance is defined.

Type Erasure

A property of the generics type model on the JVM. When a type is created from a generic, the information about the specific types substituted for the type parameters is not stored in the byte code and is therefore not available at run time, e.g., through reflection.

Type Inference

Inferring the type of a value based on the context in which it is used, rather than relying on explicit type information attached to the value.

Value

The actual state of an instance, usually in the context of a variable that refers to the instance.

Variable

A named reference to a value. If the variable is declared with the final keyword, a new value can’t be assigned to the variable. Otherwise, a new value can be assigned to the variable.

Visibility

The scope in which a declared type or type member is visible to other types and members.

Weak Coupling

See coupling.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.136.165