ArticleslgStudy

science

FOSD origami

FOSD origami is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand FOSD origami rather than just read about it. In short: 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 (called values) and a set of 1-ary (unary) functions called features.

Key takeaways

  • FOSD origami belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect FOSD origami to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of FOSD origami from memory before moving on to harder problems.

Reference excerpt

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 (called values) 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.

Origami A fundamental generalization of metamodels is origami. The essential idea is that a program's design need not be represented by a single expression; multiple expressions can be used. This involves the use of multiple orthogonal GenVoca models.

Example: Let T be a tool model, which has features P (parse), H (harvest), D (doclet), and J (translate to Java). P is a value and the rest are unary-functions. A tool T1 that parses a file written in a Java dialect language and translates it to pure Java is modeled by: T1 = J•P. And a javadoc-like tool T2 parses a file in a Java dialect, harvests comments, and translates harvested comments into an HTML page is: T2 = D•H•P. So tools T1 and T2 are among the products of the product line of T. A language model L describes a family (product line) of Java dialects. It includes the features: B (Java 1.4), G (generics), S (State machines). B is a value, and the rest are unary functions. So a dialect of Java L1 that has generics (i.e., Java 1.5) is: L1 = G•B. And a dialect of Java L2 that has language support for state machines is: L2 = S•B. So dialects L1 and L2 are among the products of the product line of L. To describe a javadoc like tool (E) for the dialect of Java with state machines requires two expressions: one that defines the tool functionality for E (using the T model) and its Java dialect (using the L model): E = D•H•P -- tool equation E = S•B -- language equation

Models L and T are orthogonal GenVoca models: one expresses the feature-based structure of the E tool, and the other the feature-based structure of its input language. Note that models T and L really are abstract in the following sense: the implementation of any feature of T really depends on the tool's dialect (expressed by L), and (symmetrically) the implementation of any feature of L really depends on the tool's functionality (expressed by T). So the only way one could implement E is by knowing both T and L equations. Let {{{1}}} be a GenVoca model of n features, and {{{1}}} be a GenVoca model of m features. The relationship between two orthogonal models U and W is a matrix UW, called an Origami matrix, where each row corresponds to a feature in U and each column corresponds to a feature in W. Entry UWij is a function that implements the combination of features Ui and Wj.

Note: UW is the tensor product of U and W (i.e., UW=U×W). UW=U×W=[UW11UW12⋯UW1n⋮⋮⋱⋮UWm1UWm2⋯UWmn] Example. Recall models T=[P,H,D,J] and L=[B,G,S]. The Origami matrix TL is: TL=T×L=[PBPGPSHBHGHSDBDGDSJBJGJS] where PB is a value that implements a parser for Java, PG is a unary-function that extends a Java parser to parse generics, and PS is a unary-function that extends a Java parser to parse state machine specifications. HB is a unary-function that implements a harvester of comments on Java code. HG is a unary-function that implements a harvester of comments on generic code, and HS is a unary-function that implements a harvester of comments on state machine specifications, and so on. To see how multiple equations are used to synthesize a program, again consider models U and W. A program F is described by two equations, one per model. We can write an equation for F in two different ways: referencing features by name or by their index position, such as:

F=U1⋅U2⋅U4=∑i=1,2,4Ui — U expression of F F=W1⋅W3=∑j=1,3Wi — W expression of F The UW model defines how models U and W are implemented. Synthesizing program F involves projecting UW of unneeded columns and rows, and aggregating (a.k.a. tensor contraction):

F=UW11⋅UW21⋅...⋅UW33=∑i=1,2,3∑j=1,3UWi,j=∑j=1,3∑i=1,2,3UWi,j A fundamental property of origami matrices, called orthogonality, is that the order in which dimensions are contracted does not matter. In the above equation, summing across the U dimension (index i) first or the W dimension (index j) first does not matter. Of course, orthogonality is a property that must be verified. Efficient (linear) algorithms have been developed to verify that origami matrices (or tensors/n-dimensional arrays) are orthogonal. The significance of orthogonality is one of view consistency. Aggregating (contracting) along a particular dimension offers a 'view' of a program. Different views should be consistent: if one repairs the program's code in one view (or proves properties about a program in one view), the correctness of those repairs or properties should hold in all views. In general, a product of a product line may be represented by n expressions, from n orthogonal and abstract GenVoca models G1 ... Gn. The Origami matrix (or cube or tensor) is an n-dimensional array A:

A=G1×...×Gn=∏k=1nGk A product H of this product line is formed by eliminating unnecessary rows, columns, etc. from A, and aggregating (contracting) the n-cube into a scalar:

H=∑i1∑i2...∑inGi1,i2...in Example. Recall program E and model T=[P,H,D,J]. E=D•H•P=T2•T1•T0. Similarly, E's representation in model L=[B,G,S] is E=S•B=L2•L0. Synthesizing E given Origami model TL is evaluating the following expression: E=∑i=2,0∑j=2,0TLi,j=∑j=2,0∑i=2,0TLi,j.

Applications There are several of product line applications developed using Origami. Among them include:

AHEAD Tool Suite and Extensible Java Preprocessors Expression Problem or the Extensibility Problem Refinements and Multi-Dimensional Separation of Concerns More applications to be supplied.

See also Feature-oriented programming FOSD metamodels

References

Worked examples

Example 1 — a first encounter with FOSD origami

Start with the simplest possible case. Write down what FOSD origami claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to FOSD origami before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about FOSD origami ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of FOSD origami

In research
FOSD origami appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses FOSD origami in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
FOSD origami is common in secondary-school and first-year university syllabi. It links to neighbouring topics Programming paradigms, so understanding it makes those chapters shorter.
In everyday life
Look for FOSD origami outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “FOSD origami” →

How to study FOSD origami in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what FOSD origami means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain FOSD origami out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is FOSD origami in simple terms?

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 (called values) and a set…

Why does FOSD origami matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study FOSD origami?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on FOSD origami.

Tags

  • Programming paradigms

Keep exploring