FOSD program cubes

Last updated

In feature-oriented software development, feature-oriented software development program cubes (FOSD program cubes) are n-dimensional arrays of functions (program transformations) that represent n-dimensional product lines. A program is a composition of features: a base program is augmented with increments in program functionality, called features, to produce a complex program. A software product line (SPL) is a family of related programs. A typical product line has F0 as a base program, and F1..Fn as features that could be added to F0. Different compositions of features yield different programs. Let + denote the feature composition operation. A program P in SPL might have the following expression:

Contents

P = F8 + F4 + F2 + F1 + F0

That is, P extends program F0 with features F1, F2, F4, and F8 in this order.

We can recast P in terms of a projection and contraction of a 1-dimensional array. Let Fi = [F0 .. Fn] denote the array of features used by a product line. A projection of Fi eliminates unneeded features, yielding a shorter array (call it) Gi. A contraction of Gi sums each Gi in a specific order, to yield a scalar expression. The expression for P becomes:

where the index values accomplish projection and summation is array contraction. This idea generalizes to n-dimensional arrays that model multi-dimensional product lines.

Multi-dimensional product lines

A 2-D Product Line (or Cube) Kube.jpg
A 2-D Product Line (or Cube)

A multi-dimensional product line is described by multiple interacting sets of features. [1] [2] [3] [4] As an elementary 2D example, it is easy to create a product line of calculators, where variants offer different sets of operations. Another variation might offer different presentation front ends to calculators, one with no GUI, another with a Java GUI, a third with a web GUI. These variations interact: each GUI representation references a specific calculator operation, so each GUI feature cannot be designed independently of its calculator feature. Such a design leads to a matrix: columns represent increments in calculator functionality, and rows represent different presentation front-ends. Such a matrix M is shown to the right: columns allow one to pair basic calculator functionality (base) with optional logarithmic/exponentiation (lx) and trigonometric (td) features. Rows allow one to pair core functionality with no front-end (core), with optional GUI (gui) and web-based (web) front-ends.

An element Mij implements the interaction of column feature i and row feature j. For example, the element labeled cb is a base program that implements the core functionality of a calculator. Element gb adds code that displays the core functionality as a GUI; element wb adds code that displays the core functionality via the web. Similarly, element ct adds trigonometric code to the core calculator functionality; elements gt and wt add code to display the trigonometric functionality as a GUI and web front-ends.

A calculator is uniquely specified by two sequences of features: one sequence defines the calculator functionality, the other the front-end. For example, calculator C that offers both base and trig functionality in a web format is defined by the expression:

Note: Each dimension is a collection of base programs and features. Not all of their compositions are meaningful. A feature model defines the legal combinations of features. Thus, each dimension would have its own feature model. It is possible that selected features along one dimension may preclude or require features along other dimensions. In any case, these feature models define the legal combinations of features in a multidimensional product line.

Cubes

In general, a cube is an n-dimensional array. The rank of a cube is its dimensionality. A scalar is a cube of rank 0, a vector is a cube of rank 1, and a matrix is rank 2. Following tensor notation: the number of indices a cube has designates its rank. A scalar S is rank 0 (it has no indices), Vk is a vector (rank 1), Mij is a matrix (rank 2), Cijk is a cube (rank 3).

Program Cubes are n-dimensional arrays of functions (program transformations) that represent n-dimensional product lines. The values along each axis of a cube denote either a base program or a feature that could elaborate a base program. The rank of a product line is the rank of its cube.

Note: program cubes are inspired by tensors and data cubes in databases. The primary difference is that data cube elements are numerical values that are added during cube contraction; program cube elements are transformations that are composed. Both use tensor notations and terminology.

A program in an n-dimensional SPL is uniquely specified by n sequences of features S1..Sn, one per dimension. The design of a program is a scalar (expression) that is formed by (1) projecting the cube of its unneeded elements, and (2) contracting the resultant kcube to a scalar:

Program generation is evaluating the scalar expression to produce program P.

An interesting property of cube design is that the order in which dimensions are contracted does not matter—any permutation of dimensions during contraction results in a different scalar expression (i.e. a different program design), but all expressions produce the same value (program). For example, another expression (design) to produce calculator C contracts dimensions in the opposite order from its original specification:

C = Mcb + Mwb + Mct + Mwt

Or more generally:

Note: Underlying cube designs is a commutative diagram, such that there are an exponential number of paths from the empty program 0 to program P. Each path denotes a particular contraction of a cube, and corresponds to a unique incremental design of P. Included among these paths are cube aggregations that contract cubes using different dimensional orders.

The significance of program cubes is that it provides a structured way in which to express and build multi-dimensional models of SPLs. Further, it provides scalable specifications. If each dimension has k values, an n-cube specification of a program requires O(kn) terms, as opposed to O(kn) cube elements that would otherwise have to be identified and then composed. In general, cubes provide a compact way to specify complex programs.

Applications

The expression problem (a.k.a. the 'extensibility problem) is a fundamental problem in programming languages aimed at type systems that can add new classes and methods to a program in a type-safe manner. [5] [6] [7] [8] It is also a fundamental problem in multi-dimensional SPL design. The expression problem is an example of an SPL of rank 2. The following applications either explain/illustrate the expression problem or show how it scales to product lines of large programs. EP is really a SPL of ~30 line programs; the applications below show how these ideas scale to programs of >30K lines (a 103 increase in size).

Also, FOSD metamodels can be viewed as special cases of program cubes.

Related Research Articles

Bra–ket notation, or Dirac notation, is a notation for linear algebra and linear operators on complex vector spaces together with their dual space both in the finite-dimensional and infinite-dimensional case. It is specifically designed to ease the types of calculations that frequently come up in quantum mechanics. Its use in quantum mechanics is quite widespread.

In mathematics, and more specifically in linear algebra, a linear map is a mapping between two vector spaces that preserves the operations of vector addition and scalar multiplication. The same names and the same definition are also used for the more general case of modules over a ring; see Module homomorphism.

<span class="mw-page-title-main">Linear algebra</span> Branch of mathematics

Linear algebra is the branch of mathematics concerning linear equations such as:

<span class="mw-page-title-main">Tensor</span> Algebraic object with geometric applications

In mathematics, a tensor is an algebraic object that describes a multilinear relationship between sets of algebraic objects related to a vector space. Tensors may map between different objects such as vectors, scalars, and even other tensors. There are many types of tensors, including scalars and vectors, dual vectors, multilinear maps between vector spaces, and even some operations such as the dot product. Tensors are defined independent of any basis, although they are often referred to by their components in a basis related to a particular coordinate system; those components form an array, which can be thought of as a high-dimensional matrix.

<span class="mw-page-title-main">Vector space</span> Algebraic structure in linear algebra

In mathematics and physics, a vector space is a set whose elements, often called vectors, may be added together and multiplied ("scaled") by numbers called scalars. Scalars are often real numbers, but can be complex numbers or, more generally, elements of any field. The operations of vector addition and scalar multiplication must satisfy certain requirements, called vector axioms. The terms real vector space and complex vector space are often used to specify the nature of the scalars: real coordinate space or complex coordinate space.

In linear algebra, the trace of a square matrix A, denoted tr(A), is defined to be the sum of elements on the main diagonal of A. The trace is only defined for a square matrix.

In linear algebra, the outer product of two coordinate vectors is the matrix whose entries are all products of an element in the first vector with an element in the second vector. If the two coordinate vectors have dimensions n and m, then their outer product is an n × m matrix. More generally, given two tensors, their outer product is a tensor. The outer product of tensors is also referred to as their tensor product, and can be used to define the tensor algebra.

In multilinear algebra, a tensor contraction is an operation on a tensor that arises from the natural pairing of a finite-dimensional vector space and its dual. In components, it is expressed as a sum of products of scalar components of the tensor(s) caused by applying the summation convention to a pair of dummy indices that are bound to each other in an expression. The contraction of a single mixed tensor occurs when a pair of literal indices of the tensor are set equal to each other and summed over. In Einstein notation this summation is built into the notation. The result is another tensor with order reduced by 2.

TI-BASIC is the official name of a BASIC-like language built into Texas Instruments (TI)'s graphing calculators. TI-BASIC is a language family of three different and incompatible versions, released on different products:

In computer science, array programming refers to solutions which allow the application of operations to an entire set of values at once. Such solutions are commonly used in scientific and engineering settings.

In geometry and algebra, the triple product is a product of three 3-dimensional vectors, usually Euclidean vectors. The name "triple product" is used for two different products, the scalar-valued scalar triple product and, less often, the vector-valued vector triple product.

In mathematics, the kernel of a linear map, also known as the null space or nullspace, is the linear subspace of the domain of the map which is mapped to the zero vector. That is, given a linear map L : VW between two vector spaces V and W, the kernel of L is the vector space of all elements v of V such that L(v) = 0, where 0 denotes the zero vector in W, or more symbolically:

Harbour is a computer programming language, primarily used to create database/business programs. It is a modernized, open source and cross-platform version of the older Clipper system, which in turn developed from the dBase database market of the 1980s and 1990s.

In a relativistic theory of physics, a Lorentz scalar is an expression, formed from items of the theory, which evaluates to a scalar, invariant under any Lorentz transformation. A Lorentz scalar may be generated from e.g., the scalar product of vectors, or from contracting tensors of the theory. While the components of vectors and tensors are in general altered under Lorentz transformations, Lorentz scalars remain unchanged.

<span class="mw-page-title-main">Three-dimensional space</span> Geometric model of the physical space

In geometry, a three-dimensional space is a mathematical space in which three values (coordinates) are required to determine the position of a point. Most commonly, it is the three-dimensional Euclidean space, the Euclidean n-space of dimension n=3 that models physical space. More general three-dimensional spaces are called 3-manifolds.

A vector-valued function, also referred to as a vector function, is a mathematical function of one or more variables whose range is a set of multidimensional vectors or infinite-dimensional vectors. The input of a vector-valued function could be a scalar or a vector ; the dimension of the function's domain has no relation to the dimension of its range.

<span class="mw-page-title-main">Vector notation</span> Mathematical notation for working with vectors

In mathematics and physics, vector notation is a commonly used notation for representing vectors, which may be Euclidean vectors, or more generally, members of a vector space.

In computer programming, feature-oriented programming (FOP) or feature-oriented software development (FOSD) is a programming paradigm for program generation in software product lines (SPLs) and for incremental development of programs.

Feature-oriented programming or feature-oriented software development (FOSD) is a general paradigm for program synthesis in software product lines. The feature-oriented programming page is recommended, it explains how an FOSD model of a domain is a tuple of 0-ary functions and a set of 1-ary (unary) functions called features. This page discusses multidimensional generalizations of FOSD models, which are important for compact specifications of complex programs.

<span class="mw-page-title-main">Matrix (mathematics)</span> Array of numbers

In mathematics, a matrix is a rectangular array or table of numbers, symbols, or expressions, arranged in rows and columns, which is used to represent a mathematical object or a property of such an object.

References

  1. "Generating Product-Lines of Product-Families" (PDF).
  2. "Refinements and Multi-Dimensional Separation of Concerns" (PDF).
  3. "Scaling Step-Wise Refinement" (PDF).
  4. "Evaluating Support for Features in Advanced Modularization Technologies" (PDF).
  5. User-defined types and procedural data structures as complementary approaches to data abstraction. MIT Press. 12 August 1994. pp. 13–23. ISBN   9780262071550.
  6. "Object-Oriented Programming versues Abstract Data Types" (PDF).
  7. "The Expression Problem".
  8. "Synthesizing Object-Oriented and Functional Design to Promote Re-Use".