Feature-oriented programming

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.

History

vertical stacking of layers
Connection between layer stacks and transformation compositions

FOSD arose out of layer-based designs and levels of abstraction in network protocols and extensible database systems in the late-1980s.[1] A program was a stack of layers. Each layer added functionality to previously composed layers and different compositions of layers produced different programs. Not surprisingly, there was a need for a compact language to express such designs. Elementary algebra fit the bill: each layer was a function (a program transformation) that added new code to an existing program to produce a new program, and a program's design was modeled by an expression, i.e., a composition of transformations (layers). The figure to the left illustrates the stacking of layers i, j, and h (where h is on the bottom and i is on the top). The algebraic notations i(j(h)), i•j•h, and i+j+h have been used to express these designs.

Over time, layers were equated to features, where a feature is an increment in program functionality. The paradigm for program design and generation was recognized to be an outgrowth of relational query optimization, where query evaluation programs were defined as relational algebra expressions, and query optimization was expression optimization.[2] A software product line is a family of programs where each program is defined by a unique composition of features. FOSD has since evolved into the study of feature modularity, tools, analyses, and design techniques to support feature-based program generation.

The second generation of FOSD research was on feature interactions, which originated in telecommunications. Later, the term feature-oriented programming was coined;[3] this work exposed interactions between layers. Interactions require features to be adapted when composed with other features.

A third generation of research focussed on the fact that every program has multiple representations (e.g., source, makefiles, documentation, etc.) and adding a feature to a program should elaborate each of its representations so that all are consistent. Additionally, some of representations could be generated (or derived) from others. In the sections below, the mathematics of the three most recent generations of FOSD, namely GenVoca,[1] AHEAD,[4] and FOMDD[5][6] are described, and links to product lines that have been developed using FOSD tools are provided. Also, four additional results that apply to all generations of FOSD are: FOSD metamodels, FOSD program cubes, and FOSD feature interactions.

GenVoca

GenVoca (a portmanteau of the names Genesis and Avoca)[1] is a compositional paradigm for defining programs of product lines. Base programs are 0-ary functions or transformations called values:

  f      -- base program with feature f
  h      -- base program with feature h

and features are unary functions/transformations that elaborate (modify, extend, refine) a program:

  i + x  -- adds feature i to program x
  j + x  -- adds feature j to program x

where + denotes function composition. The design of a program is a named expression, e.g.:

  p1 = j + f       -- program p1 has features j and f
  p2 = j + h       -- program p2 has features j and h
  p3 = i + j + h   -- program p3 has features i, j, and h

A GenVoca model of a domain or software product line is a collection of base programs and features (see MetaModels and Program Cubes). The programs (expressions) that can be created defines a product line. Expression optimization is program design optimization, and expression evaluation is program generation.

Note: GenVoca is based on the stepwise development of programs: a process that emphasizes design simplicity and understandability, which are key to program comprehension and automated program construction. Consider program p3 above: it begins with base program h, then feature j is added (read: the functionality of feature j is added to the codebase of h), and finally feature i is added (read: the functionality of feature i is added to the codebase of j•h).
Note: not all combinations of features are meaningful. Feature models (which can be translated into propositional formulas) are graphical representations that define legal combinations of features.[7]
Note: A more recent formulation of GenVoca is symmetric: there is only one base program, 0 (the empty program), and all features are unary functions. This suggests the interpretation that GenVoca composes program structures by superposition, the idea that complex structures are composed by superimposing simpler structures.[8][9] Yet another reformulation of GenVoca is as a monoid: a GenVoca model is a set of features with a composition operation (•); composition is associative and there is an identity element (namely 1, the identity function). Although all compositions are possible, not all are meaningful. That's the reason for feature models.

GenVoca features were originally implemented using C preprocessor (#ifdef feature ... #endif) techniques. A more advanced technique, called mixin layers, showed the connection of features to object-oriented collaboration-based designs.

AHEAD

Algebraic Hierarchical Equations for Application Design (AHEAD)[4] generalized GenVoca in two ways. First, it revealed the internal structure of GenVoca values as tuples. Every program has multiple representations, such as source, documentation, bytecode, and makefiles. A GenVoca value is a tuple of program representations. In a product line of parsers, for example, a base parser f is defined by its grammar gf, Java source sf, and documentation df. Parser f is modeled by the tuple f=[gf, sf, df]. Each program representation may have subrepresentations, and they too may have subrepresentations, recursively. In general, a GenVoca value is a tuple of nested tuples that define a hierarchy of representations for a particular program.

Hierarchical relationships among program artifacts

Example. Suppose terminal representations are files. In AHEAD, grammar gf corresponds to a single BNF file, source sf corresponds to a tuple of Java files [c1…cn], and documentation df is a tuple of HTML files [h1…hk]. A GenVoca value (nested tuples) can be depicted as a directed graph: the graph for parser f is shown in the figure to the right. Arrows denote projections, i.e., mappings from a tuple to one of its components. AHEAD implements tuples as file directories, so f is a directory containing file gf and subdirectories sf and df. Similarly, directory sf contains files c1…cn, and directory df contains files h1…hk.

Note: Files can be hierarchically decomposed further. Each Java class can be decomposed into a tuple of members and other class declarations (e.g., initialization blocks, etc.). The important idea here is that the mathematics of AHEAD are recursive.

Second, AHEAD expresses features as nested tuples of unary functions called deltas. Deltas can be program refinements (semantics-preserving transformations), extensions (semantics-extending transformations), or interactions (semantics-altering transformations). We use the neutral term “delta” to represent all of these possibilities, as each occurs in FOSD.

To illustrate, suppose feature j extends a grammar by Δgj (new rules and tokens are added), extends source code by Δsj (new classes and members are added and existing methods are modified), and extends documentation by Δdj. The tuple of deltas for feature j is modeled by j=[Δgj,Δsj,Δdj], which we call a delta tuple. Elements of delta tuples can themselves be delta tuples. Example: Δsj represents the changes that are made to each class in sf by feature j, i.e., Δsj=[Δc1…Δcn]. The representations of a program are computed recursively by nested vector addition. The representations for parser p2 (whose GenVoca expression is j+f) are:

  p2 = j + f                           -- GenVoca expression
     = [Δgj, Δsj, Δdj] + [gf, sf, df]   -- substitution
     = [Δgj+gf, Δsj+sf, Δdj+df]         -- compose tuples element-wise

That is, the grammar of p2 is the base grammar composed with its extension (Δgj+gf), the source of p2 is the base source composed with its extension (Δsj+sf), and so on. As elements of delta tuples can themselves be delta tuples, composition recurses, e.g., Δsj+sf= [Δc1…Δcn]+[c1…cn]=[Δc1+c1…Δcn+cn]. Summarizing, GenVoca values are nested tuples of program artifacts, and features are nested delta tuples, where + recursively composes them by vector addition. This is the essence of AHEAD.

The ideas presented above concretely expose two FOSD principles. The Principle of Uniformity states that all program artifacts are treated and modified in the same way. (This is evidenced by deltas for different artifact types above). The Principle of Scalability states all levels of abstractions are treated uniformly. (This gives rise to the hierarchical nesting of tuples above).

The original implementation of AHEAD is the AHEAD Tool Suite and Jak language, which exhibits both the Principles of Uniformity and Scalability. Next-generation tools include CIDE [10] and FeatureHouse.[11]

FOMDD

Derivational and refinement relationships among program artifacts

Feature-Oriented Model-Driven Design (FOMDD)[5][6] combines the ideas of AHEAD with Model-Driven Design (MDD) (a.k.a. Model-Driven Architecture (MDA)). AHEAD functions capture the lockstep update of program artifacts when a feature is added to a program. But there are other functional relationships among program artifacts that express derivations. For example, the relationship between a grammar gf and its parser source sf is defined by a compiler-compiler tool, e.g., javacc. Similarly, the relationship between Java source sf and its bytecode bf is defined by the javac compiler. A commuting diagram expresses these relationships. Objects are program representations, downward arrows are derivations, and horizontal arrows are deltas. The figure to the right shows the commuting diagram for program p3 = i+j+h = [g3,s3,b3].

A fundamental property of a commuting diagram is that all paths between two objects are equivalent. For example, one way to derive the bytecode b3 of parser p3 (lower right object in the figure to the right) from grammar gh of parser h (upper left object) is to derive the bytecode bh and refine to b3, while another way refines gh to g3, and then derive b3, where + represents delta composition and () is function or tool application:

b3 = Δbj + Δbi + javacc( javac( gh ) ) = javac( javacc( Δgi + Δgj + gh ) )

There are possible paths to derive the bytecode b3 of parser p3 from the grammar gh of parser h. Each path represents a metaprogram whose execution generates the target object (b3) from the starting object (gf). There is a potential optimization: traversing each arrow of a commuting diagram has a cost. The cheapest (i.e., shortest) path between two objects in a commuting diagram is a geodesic, which represents the most efficient metaprogram that produces the target object from a given object.

Note: A “cost metric” need not be a monetary value; cost may be measured in production time, peak or total memory requirements, power consumption, or some informal metric like “ease of explanation”, or a combination of the above (e.g., multi-objective optimization). The idea of a geodesic is general, and should be understood and appreciated from this more general context.
Note: It is possible for there to be m starting objects and n ending objects in a geodesic; when m=1 and n>1, this is the Directed Steiner Tree Problem, which is NP-hard.

Commuting diagrams are important for at least two reasons: (1) there is the possibility of optimizing the generation of artifacts (e.g., geodesics) and (2) they specify different ways of constructing a target object from a starting object.[5][12] A path through a diagram corresponds to a tool chain: for an FOMDD model to be consistent, it should be proven (or demonstrated through testing) that all tool chains that map one object to another in fact yield equivalent results. If this is not the case, then either there is a bug in one or more of the tools or the FOMDD model is wrong.

Note: the above ideas were inspired by category theory.[5][6]

Applications

See also

References

  1. ^ a b c "Design and Implementation of Hierarchical Software Systems with Reusable Components" (PDF).
  2. ^ Access Path Selection In Relational Databases. 30 May 1979. pp. 23–34. doi:10.1145/582095.582099. ISBN 9780897910019. S2CID 8537523.
  3. ^ "Feature-Oriented Programming: A Fresh Look at Objects". Archived from the original on 2003-08-03. Retrieved 2015-12-16.
  4. ^ a b "Scaling Step-Wise Refinement" (PDF).
  5. ^ a b c d "Feature Oriented Model Driven Development: A Case Study for Portlets" (PDF).
  6. ^ a b c Trujillo, Salvador; Azanza, Maider; Díaz, Óscar (October 2007). "Generative metaprogramming". Proceedings of the 6th international conference on Generative programming and component engineering. pp. 105–114. doi:10.1145/1289971.1289990. ISBN 9781595938558. S2CID 236715.
  7. ^ "Feature Models, Grammars, and Propositional Formulas" (PDF).
  8. ^ "An Algebra for Features and Feature Composition" (PDF).
  9. ^ "Superimposition: A Language-Independent Approach to Software Composition" (PDF).
  10. ^ "Guaranteeing Syntactic Correctness for all Product Line Variants: A Language-Independent Approach" (PDF).
  11. ^ "FeatureHouse: Language-Independent, Automated Software Composition" (PDF).
  12. ^ "Testing Software Product Lines Using Incremental Test Generation" (PDF).

Read other articles:

Московский международный турнир по хоккею «Кубок Спартака» Основан 1994 Упразднён 2008 Регион Москва Число участников 4–8 Последний победитель Спартак (Москва) (1) Наиболее титулован Звёзды России (5) Кубок Спартака — предсезонный международный хоккейный турнир, который пр…

Minnesota Senate election, 1992 ← 1990 November 3, 1992 (1992-11-03) 1996 → All 67 seats in the Minnesota Senate34 seats needed for a majority   Majority party Minority party   Leader Roger Moe Duane Benson Party Democratic (DFL) Ind.-Republican Leader since 1980 January 5, 1987 Leader's seat 2nd–Erskine 31st–Lanesboro Last election 46 seats 21 seats Seats won 45 22 Seat change 1 1 Popular vote 1,247,594 970,766 Dis…

Voce principale: Futebol Clube do Porto. FC Porto BCalcio Os Dragões (I Draghi), Os Azuis e Brancos (I Biancoblù) Segni distintivi Uniformi di gara Casa Trasferta Terza divisa Colori sociali Blu, bianco Simboli Drago Dati societari Città Porto Nazione  Portogallo Confederazione UEFA Federazione FPF Campionato Segunda Liga Fondazione 1999 Scioglimento2006Rifondazione2012 Presidente Pinto da Costa Allenatore António Folha Stadio Estádio Municipal Jorge Sampaio(8.500 posti) Sito web www.f…

Dutch footballer (1885–1943) Eddy & Gilles de Neve (ca. 1905) Eduard Karel Alexander de Neve (1 January 1882 or 2 January 1885 – 30 August 1943) was a Dutch footballer who played as a forward for Velocitas Breda, HBS Craeyenhout and the Netherlands national team. Early life De Neve was born in either 1882 or 1885 in Batavia, Dutch East Indies, the son of Eduard Karel Alexander de Neve, a major in the Royal Dutch East Indies Army, and Johanna Christina Fokker. His father died when De Neve…

Football clubVirginia Beach United FCFull nameVirginia Beach United FCFoundedJanuary 1, 2019; 5 years ago (2019-01-01)StadiumVirginia Beach SportsplexCapacity6,000 (Expandable to 14,000)Head CoachChris MillsLeagueUSL League Two20234th, Chesapeake DivisionPlayoffs: DNQWebsiteClub website Home colours Away colours Virginia Beach United FC are an American soccer club competing in the USL League Two, that started play in 2019. The team is a joint effort of local youth organizations…

Anatomical part of the vertebra Not to be confused with Intervertebral foramen or vertebral canal. Vertebral foramenA typical thoracic vertebra, viewed from above. (Vertebral foramen is the large hole at the center.)A cervical vertebra. (Vertebral foramen is the large hole at the center.)DetailsIdentifiersLatinforamen vertebraleTA98A02.2.01.011TA21022FMA13479Anatomical terms of bone[edit on Wikidata] In a typical vertebra, the vertebral foramen is the foramen (opening) of a vertebra bounded …

ESP-DiskStato Stati Uniti Fondazione1965 Fondata daBernard Stollman SettoreMusicale ProdottiAvanguardia,Free Jazz,Controcultura,Pop Rock,Rock Psichedelico Sito webwww.espdisk.com Modifica dati su Wikidata · Manuale La ESP-Disk, nota anche con la grafia ESP-Disk', è una etichetta discografica statunitense: la sede principale si trova a New York. Etichetta di culto, la Esp-Disk è stata una delle prime label indipendenti americane; considerata “la casa discografica più pazza del mon…

この項目には、一部のコンピュータや閲覧ソフトで表示できない文字が含まれています(詳細)。 数字の大字(だいじ)は、漢数字の一種。通常用いる単純な字形の漢数字(小字)の代わりに同じ音の別の漢字を用いるものである。 概要 壱万円日本銀行券(「壱」が大字) 弐千円日本銀行券(「弐」が大字) 漢数字には「一」「二」「三」と続く小字と、「壱」「弐」…

City in Mississippi, United StatesNatchez, MississippiCityPearl Street, Natchez FlagSealNickname(s): The Bluff City, The Trace City, The River City, Antebellum Capital of the World, Historic Natchez on the MississippiMotto: On the Mighty MississippiLocation of Natchez in Adams CountyCoordinates: 31°33′16″N 91°23′15″W / 31.55444°N 91.38750°W / 31.55444; -91.38750CountryUnited StatesStateMississippiCountyAdamsFounded1716 as Fort Rosalie, renamed Fort P…

2020年夏季奥林匹克运动会波兰代表團波兰国旗IOC編碼POLNOC波蘭奧林匹克委員會網站olimpijski.pl(英文)(波兰文)2020年夏季奥林匹克运动会(東京)2021年7月23日至8月8日(受2019冠状病毒病疫情影响推迟,但仍保留原定名称)運動員206參賽項目24个大项旗手开幕式:帕维尔·科热尼奥夫斯基(游泳)和马娅·沃什乔夫斯卡(自行车)[1]闭幕式:卡罗利娜·纳亚(皮划艇)[2…

此条目序言章节没有充分总结全文内容要点。 (2019年3月21日)请考虑扩充序言,清晰概述条目所有重點。请在条目的讨论页讨论此问题。 哈萨克斯坦總統哈薩克總統旗現任Қасым-Жомарт Кемелұлы Тоқаев卡瑟姆若马尔特·托卡耶夫自2019年3月20日在任任期7年首任努尔苏丹·纳扎尔巴耶夫设立1990年4月24日(哈薩克蘇維埃社會主義共和國總統) 哈萨克斯坦 哈萨克斯坦政府與…

This article includes a list of references, related reading, or external links, but its sources remain unclear because it lacks inline citations. Please help improve this article by introducing more precise citations. (February 2021) (Learn how and when to remove this message) 1981 American filmDead AheadDead Ahead DVD coverDirected byLen Dell'AmicoProduced byRichard LorenStarringThe Grateful DeadEdited byVeronica LozaDistributed byMonterey Home VideoRelease dates 1981 (1981) (Original)…

For other uses, see Lake Louise. Hamlet in Alberta, CanadaLake LouiseHamletLake Louise, with which the hamlet shares its name, pictured in June 2018Lake LouiseLocation of Lake Louise in AlbertaShow map of AlbertaLake LouiseLake Louise (Canada)Show map of CanadaCoordinates: 51°25′31″N 116°10′50″W / 51.42528°N 116.18056°W / 51.42528; -116.18056[1]CountryCanadaProvinceAlbertaRegionAlberta's RockiesCensus divisionNo. 15Improvement districtImprovement Distr…

Airport in nm southwest of the CBDArlington Municipal AirportIATA: noneICAO: KAWOFAA LID: AWOSummaryAirport typePublicOwner/OperatorCity of ArlingtonServesArlington, WashingtonLocation3 nm southwest of the CBDElevation AMSL142 ft / 43 mCoordinates48°09′39″N 122°09′32″W / 48.16083°N 122.15889°W / 48.16083; -122.15889Websitearlingtonwa.govRunways Direction Length Surface ft m 16/34 5,332 1,625 Asphalt 11/29 3,498 1,066 Asphalt 16G/34G 4,000 1,219 …

Shadow Cabinet of the United Kingdom in 1997 Major Shadow CabinetShadow cabinet of the United KingdomMay – June 1997Date formed2 May 1997Date dissolved19 June 1997People and organisationsMonarchElizabeth IILeader of the OppositionJohn MajorDeputy Leader of the OppositionMichael HeseltineMember party  Conservative PartyStatus in legislatureOfficial Opposition 165 / 659 (25%)HistoryElection(s)1997 general electionOutgoing election1997 Conservative Party leadership electionLegislature …

العلاقات البوسنية الإسبانية البوسنة والهرسك إسبانيا   البوسنة والهرسك   إسبانيا تعديل مصدري - تعديل   العلاقات البوسنية الإسبانية هي العلاقات الثنائية التي تجمع بين البوسنة والهرسك وإسبانيا.[1][2][3][4][5] مقارنة بين البلدين هذه مقارنة عامة ومر…

Frequency of trains and allowed max speed on the German Intercity-Express (ICE) network (2022) This list of Intercity-Express lines in Germany includes all Intercity-Express lines in Germany.[1] The latest changes to the Intercity Express network took place at the timetable change on 10 December 2023. The network currently has 35 scheduled lines. Legend Line The official line name given by DB Fernverkehr for each line. Some lines, which have many branches, are divided into individua…

.ne

.neDiperkenalkan24 April 1996Jenis TLDTLD kode negara internetStatusAktifRegistriSONITELSponsorSONITELPemakaian yang diinginkanEntitas yang terhubung dengan  NigerPemakaian aktualDigunakan di Niger; juga digunakan sebagai typosquatting dari domain .net, dan untuk domain hack (contoh: redsto.ne)StrukturRegistrasi dilakukan langsung di tingkat keduaSitus webRegistration site.ne adalah top-level domain kode negara Internet untuk Niger. Lihat pula Top Level DomainlbsRanah tingkat teratas kode n…

Vyschaïa Liga 1988 Généralités Sport Football Édition 51e Date du 7 mars 1988 au 19 novembre 1988 Participants 16 équipes Palmarès Tenant du titre Spartak Moscou Promu(s) en début de saison Tchernomorets Odessa Lokomotiv Moscou Vainqueur Dniepr Dniepropetrovsk (2) Relégué(s) Kaïrat AlmatyNeftchi Bakou Meilleur(s) buteur(s) Aleksandr Borodiouk (16) Yevhen Shakhov (16) Navigation Saison 1987 Saison 1989 modifier La saison 1988 de Vyschaïa Liga est la 51e édition du championnat d'…

Nicolás Tagliafico Informasi pribadiNama lengkap Nicolás Alejandro Tagliafico[1]Tanggal lahir 31 Agustus 1992 (umur 31)[1]Tempat lahir Buenos Aires, ArgentinaTinggi 172 cm (5 ft 8 in)[2]Posisi bermain Bek kiriInformasi klubKlub saat ini LyonNomor 3Karier senior*Tahun Tim Tampil (Gol)2010–2015 Banfield 90 (2)2012–2013 → Real Murcia (pinjaman) 27 (0)2015–2018 Independiente 85 (2)2018–2022 Ajax 115 (9)2022– Olympique Lyon 15 (1)Tim nasional…