## Abstract

We present *Clafer* (class, feature, reference), a class modeling language with first-class support for feature modeling. We designed Clafer as a concise notation for meta-models, feature models, mixtures of meta- and feature models (such as components with options), and models that couple feature models and meta-models via constraints (such as mapping feature configurations to component configurations or model templates). Clafer allows arranging models into multiple specialization and extension layers via constraints and inheritance. We identify several key mechanisms allowing a meta-modeling language to express feature models concisely. Clafer unifies basic modeling constructs, such as class, association, and property, into a single construct, called *clafer*. We provide the language with a formal semantics built in a structurally explicit way. The resulting semantics explains the meaning of hierarchical models whereby properties can be arbitrarily nested in the presence of inheritance and feature modeling constructs. The semantics also enables building consistent automated reasoning support for the language: To date, we implemented three reasoners for Clafer based on Alloy, Z3 SMT, and Choco3 CSP solvers. We show that Clafer meets its design objectives using examples and by comparing to other languages.

## Keywords

Language design Feature modeling OOM Semantics Unification## References

- 1.Anastasakis, K., Bordbar, B., Georg, G., Ray, I.: UML2Alloy: a challenging model transformation. Model Driven Eng. Lang. Syst. (2007)Google Scholar
- 2.Antkiewicz, M., Bąk, K., Zayan, D., Czarnecki, K., Wąsowski, A., Diskin, Z.: Example-driven modeling using clafer. In: First International Workshop on Model-Driven Engineering By Example (2013). http://ceur-ws.org/Vol-1104
- 3.Antkiewicz, M., Bąk, K., Murashkin, A., Liang, J., Olaechea, R., Czarnecki, K.: Clafer tools for product line engineering. In: Proceedings of the 17th International Software Product Line Conference Co-located Workshops (2013)Google Scholar
- 4.Antkiewicz, M., Czarnecki, K., Stephan, M.: Engineering of framework-specific modeling languages. Softw. Eng. IEEE Trans.
**35**(6), 521–549 (2009)Google Scholar - 5.Asikainen, T., Männistö, T.: Nivel: a metamodelling language with a formal semantics. Softw. Syst. Model.
**8**(4), 31–40 (2009)Google Scholar - 6.Asikainen, T., Männistö, T., Soininen, T.: A unified conceptual foundation for feature modelling. In: Software Product Line Conference, 10th International (2006)Google Scholar
- 7.Asikainen, T., Männistö, T., Soininen, T.: Kumbang: A domain ontology for modelling variability in software product families. Adv. Eng. Inform.
**21**(1), 23–40 (2007)Google Scholar - 8.Astels, D.: Refactoring with UML. In: Proceedings of the 3rd International Conference Extreme Programming and Flexible Processes in Software Engineering (2002)Google Scholar
- 9.Bąk, K., Zayan, D., Czarnecki, K., Antkiewicz, M., Diskin, Z., Wąsowski, A., Rayside, D.: Example-driven modeling: model = abstractions + examples. In: New Ideas and Emerging Results (NIER) Track of the 35th International Conference on Software Engineering (2013)Google Scholar
- 10.Barr, M., Wells, C.: Category Theory for Computing Science, vol. 10. Prentice Hall, New York (1990)Google Scholar
- 11.Berger, T., Rublack, R., Nair, D., Atlee, J.M., Becker, M., Czarnecki, K., Wąsowski, A.: A survey of variability modeling in industrial practice. In: Proceedings of the Seventh International Workshop on Variability Modelling of Software-Intensive Systems (2013)Google Scholar
- 12.Berger, T., She, S., Lotufo, R., Wąsowski, A., Czarnecki, K.: Variability modeling in the real: a perspective from the operating systems domain. In: Proceedings of the IEEE/ACM International Conference on Automated Software Engineering (2010)Google Scholar
- 13.Bąk, K., Czarnecki, K., Wąsowski, A.: Feature and meta-models in Clafer: mixed, specialized, and coupled. In: Malloy, B., Staab, S., van den Brand, M. (eds.) SLE 2010, LNCS 6563, pp. 102–122. Springer, Heidelberg (2010)Google Scholar
- 14.Bąk, K., Diskin, Z., Antkiewicz, M., Czarnecki, K., Wąsowski, A.: Partial instances via subclassing. Softw. Lang. Eng. (2013)Google Scholar
- 15.Classen, A., Boucher, Q., Heymans, P.: A text-based approach to feature modelling: Syntax and semantics of TVL. Sci. Comp. Program.
**76**(12), 1130–1143 (2011)Google Scholar - 16.Clauß, M., Jena, I.: Modeling variability with UML. In: Young Researchers Workshop at GCSE (2001)Google Scholar
- 17.Consortium, A., et al.: EAST-ADL domain model specification, Nov. 28, 2013. Version 2.1.12Google Scholar
- 18.Czarnecki, K., Antkiewicz, M.: Mapping features to models: a template approach based on superimposed variants. In: Gluck, R., Lowrt, M. (eds.) GPCE 2005, LNCS, vol. 3676, pp. 422–437. Springer, Heidelberg (2005)Google Scholar
- 19.Czarnecki, K., Bednasch, T., Unger, P., Eisenecker, U.: Generative programming for embedded software: an industrial experience report. In: Batory, D., Consel, C., Taha, W. (eds.) GPCE 2002, LNCS 2487, pp. 156–172. Springer. Heidelberg (2002)Google Scholar
- 20.Czarnecki, K., Grüenbacher, P., Rabiser, R., Schmid, K., Wąsowski, A.: Cool features and tough decisions: a comparison of variability modeling approaches. In: Proceedings of the Sixth International Workshop on Variability Modeling of Software-Intensive Systems (2012)Google Scholar
- 21.Czarnecki, K., Helsen, S., Eisenecker, U.: Formalizing cardinality-based feature models and their specialization. Softw. Process Improv. Pract.
**10**(1), 331–348 (2005)Google Scholar - 22.Czarnecki, K., Hwan, C., Kim, P., Kalleberg, K.: Feature models are views on ontologies. Software Product Line Conference, 10th International (2006)Google Scholar
- 23.Czarnecki, K., Kim, C.H.: Cardinality-based feature modeling and constraints: a progress report. In: International Workshop on Software Factories (2005)Google Scholar
- 24.Czarnecki, K., Pietroszek, K.: Verifying feature-based model templates against well-formedness ocl constraints. In: Proceedings of the 5th International Conference on Generative Programming and Component Engineering (2006)Google Scholar
- 25.Dahchour, M., Pirotte, A., Zimányi, E.: Generic relationships in information modeling. J. Data Semant. IV 3730, 1–34 (2005)Google Scholar
- 26.De Moura, L., Bjørner, N.: Z3: An efficient SMT solver. In: Tools and Algorithms for the Construction and Analysis of Systems, pp. 337–340 (2008)Google Scholar
- 27.Diskin, Z.: Visualization vs. specification in diagrammatic notations: A case study with the UML. In: Hegarty, M., Meyer, B., Hari Narayanan, N. (eds.) Diagrams 2002, LNAI 2317, pp. 112–115. Springer, Heidelberg (2002)Google Scholar
- 28.Diskin, Z., Cadish, B.: Variable sets and functions framework for conceptual modeling: integrating ER and OO via sketches with dynamic markers. In: Object-Oriented and Entity-Relationship Modeling (1995)Google Scholar
- 29.Diskin, Z., Easterbrook, S., Dingel, J.: Engineering Associations: From Models to Code and Back through Semantics. In: Objects, Components, Models and Patterns (2008)Google Scholar
- 30.Diskin, Z., Kadish, B.: Variable set semantics for keyed generalized sketches: formal semantics for object identity and abstract syntax for conceptual modeling. Data Knowl Eng
**47**, 1–59 (2003)Google Scholar - 31.Diskin, Z., Kadish, B., Piessens, F., Johnson, M.: Universal arrow foundations for visual modeling. In: Anderson, M., Cheng, P., Haarslev, V. (eds.) Diagrams 2000, LNAI 1889, pp. 345–360. Springer, Heidelberg (2000)Google Scholar
- 32.Felfernig, A., Friedrich, G.E., Jannach, D.: UML as domain specific language for the construction of knowledge-based configuration systems. Int. J. Softw. Eng. Knowl. Eng.
**10**(04), 449–469 (2000)Google Scholar - 33.Gaeta, J.A.P.: Modeling and implementing variability in aerospace systems product lines. Master’s thesis, University of Waterloo (2014)Google Scholar
- 34.Gomaa, H.: Designing Software Product Lines with UML. Addison-Wesley, Boston (2004)Google Scholar
- 35.Group, O.M.: Systems Modeling Language (SysML) (2012). http://www.omg.org/spec/SysML/1.3/
- 36.Heidenreich, F., Kopcsek, J., Wende, C.: FeatureMapper: mapping features to models. In: Companion of the 30th International Conference on Software Engineering (2008)Google Scholar
- 37.Hubaux, A., Boucher, Q., Hartmann, H., Michel, R., Heymans, P.: Evaluating a textual feature modelling language: four industrial case studies. Softw. Lang. Eng. (2010)Google Scholar
- 38.Hubaux, A., Xiong, Y., Czarnecki, K.: A user survey of configuration challenges in Linux and eCos. In: Proceedings of the Sixth International Workshop on Variability Modeling of Software-Intensive Systems (2012)Google Scholar
- 39.IBM, Thales, Fokus, F., TCS: Proposal for Common Variability Language (CVL) (2012, revised submission). http://www.omgwiki.org/variability/doku.php
- 40.Jackson, D.: Alloy: a lightweight object modelling notation. ACM Trans. Softw. Eng. Methodol.
**11**(2), 256–290 (2002)Google Scholar - 41.Jackson, D.: Software Abstractions: Logic, Language, and Analysis. The MIT Press, Cambridge (2011)Google Scholar
- 42.Janota, M., Botterweck, G.: Formal approach to integrating feature and architecture models. Fundam. Approach. Softw. Eng. 31–45 (2008)Google Scholar
- 43.Jouault, F., Bézivin, J.: KM3: a DSL for metamodel specification. In: Formal Methods for Open Object-Based Distributed Systems, pp. 171–185 (2006)Google Scholar
- 44.Jussien, N., Rochart, G., Lorca, X., et al.: Choco: an open source java constraint programming library. In: CPAIOR’08 Workshop on Open-Source Software for Integer and Contraint Programming (OSSICP’08) (2008)Google Scholar
- 45.Kang, K., Cohen, S., Hess, J., Nowak, W., Peterson, S.: Feature-oriented domain analysis (FODA) feasibility study. Technical Report CMU/SEI-90-TR-21, CMU (1990)Google Scholar
- 46.Kang, K.C.: FODA: Twenty years of perspective on feature modeling. In: Proceedings of the Fourth International Workshop on Variability Modelling of Software-Intensive Systems (2010)Google Scholar
- 47.Lambek, J., Scott, P.J.: Introduction to Higher-Order Categorical Logic, vol. 7. Cambridge University Press, Cambridge (1988)zbMATHGoogle Scholar
- 48.Liang, J.: Correcting Clafer Models with Automated Analysis. Technical Report GSDLab-TR 2012-04-30, GSD Lab, University of Waterloo (2012)Google Scholar
- 49.Liang, J.: Solving Clafer models with Choco (GSDLab-TR 2012-12-30) (2012)Google Scholar
- 50.Michel, R., Classen, A., Hubaux, A., Boucher, Q.: A formal semantics for feature cardinalities in feature diagrams. In: Proceedings of the 5th Workshop on Variability Modeling of Software-Intensive Systems (2011)Google Scholar
- 51.Murashkin, A.: Automotive electronic/electric architecture modeling, design exploration and optimization using Clafer. Master’s thesis, University of Waterloo (2014)Google Scholar
- 52.Murashkin, A., Antkiewicz, M., Rayside, D., Czarnecki, K.: Visualization and exploration of optimal variants in product line engineering. In: Proceedings of the 17th International Software Product Line Conference (2013)Google Scholar
- 53.Olaechea, R., Stewart, S., Czarnecki, K., Rayside, D.: Modeling and multi-objective optimization of quality attributes in variability-rich software. In: Proceedings of the Fourth International Workshop on Nonfunctional System Properties in Domain Specific Modeling Languages (2012)Google Scholar
- 54.OMG: Meta Object Facility (MOF) Core Specification (2011)Google Scholar
- 55.OMG: OMG Object Constraint Language (OCL) 2.4 (2014)Google Scholar
- 56.Partnership, A.D.: Automotive open system architecture (autosar), release 4.1 (2013). http://www.autosar.org/specifications/release-41/
- 57.Partnership, A.D.: Feature model exchange format (2013).https://www.autosar.org/fileadmin/files/releases/4-1/methodology-templates/templates/standard/AUTOSAR_TPS_FeatureModelExchangeFormat.pdf
- 58.Reiser, M.O., Kolagari, R.T., Weber, M.: Unified feature modeling as a basis for managing complex system families. In: Proceedings of the First International Workshop on Variability Modelling of Software-Intensive Systems (2007)Google Scholar
- 59.Rossini, A., Rutle, A., Lamo, Y., Wolter, U.: A formalisation of the copy-modify-merge approach to version control in MDE. J. Log. Algebr. Program.
**79**(7), 636–658 (2010)Google Scholar - 60.Rutle, A., Rossini, A., Lamo, Y., Wolter, U.: A formal approach to the specification and transformation of constraints in MDE. J. Log. Algebr. Program.
**81**(4), 422–457 (2012)Google Scholar - 61.Schmid, K., John, I.: A customizable approach to full lifecycle variability management. Sci. Comput. Program.
**53**, 259–284 (2004)Google Scholar - 62.Software Productivity Consortium Services Corporation: Reuse-Driven Software Processes Guidebook, version 02.00.03. Technical Report SPC-92019-CMC (1993)Google Scholar
- 63.Stephan, M., Antkiewicz, M.: Ecore.fmp: A tool for editing and instantiating class models as feature models. Technical Report 2008-08, University of Waterloo (2008)Google Scholar
- 64.Sunyé, G., Pollet, D., Traon, Y.L., Jézéquel, J.M.: Refactoring UML models. In: UML—The Unified Modeling Language. Modeling Languages, Concepts, and Tools, pp. 134–148 (2001)Google Scholar
- 65.Wand, Y., Storey, V., Weber, R.: An ontological analysis of the relationship construct in conceptual modeling. ACM Trans. Database Syst.
**24**(4), 494–528 (1999)Google Scholar