Applying Design by Contract to Feature-Oriented Programming

  • Thomas Thüm
  • Ina Schaefer
  • Martin Kuhlemann
  • Sven Apel
  • Gunter Saake
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7212)


Feature-oriented programming (FOP) is an extension of ob- ject-oriented programming to support software variability by refining existing classes and methods. In order to increase the reliability of all implemented program variants, we integrate design by contract (DbC) with FOP. DbC is an approach to build reliable object-oriented software by specifying methods with contracts. Contracts are annotations that document and formally specify behavior, and can be used for formal verification of correctness or as test oracles. We present and discuss five approaches to define contracts of methods and their refinements in FOP. Furthermore, we share our insights gained by performing five case studies. This work is a foundation for research on the analysis of feature-oriented programs (e.g., for verifying functional correctness or for detecting feature interactions).


Feature Module Software Product Line Java Modeling Language Code Clone Method Contract 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Agostinho, S., Moreira, A., Guerreiro, P.: Contracts for Aspect-Oriented Design. In: Proc. Workshop on Software Engineering Properties of Languages and Aspect Technologies (SPLAT). ACM (2008)Google Scholar
  2. 2.
    Apel, S., Kästner, C.: An Overview of Feature-Oriented Software Development. J. Object Technology (JOT) 8(5), 49–84 (2009)CrossRefGoogle Scholar
  3. 3.
    Apel, S., Kästner, C., Größlinger, A., Lengauer, C.: Type Safety for Feature-Oriented Product Lines. Automated Software Engineering (ASE) 17(3), 251–300 (2010)CrossRefGoogle Scholar
  4. 4.
    Apel, S., Leich, T., Saake, G.: Aspectual Feature Modules. IEEE Trans. Software Engineering (TSE) 34(2), 162–180 (2008)CrossRefGoogle Scholar
  5. 5.
    Apel, S., Scholz, W., Lengauer, C., Kästner, C.: Detecting Dependences and Interactions in Feature-Oriented Design. In: Proc. Int’l Symposium Software Reliability Engineering (ISSRE), pp. 161–170. IEEE (2010)Google Scholar
  6. 6.
    Apel, S., Speidel, H., Wendler, P., von Rhein, A., Beyer, D.: Detection of Feature Interactions using Feature-Aware Verification. In: Proc. Int’l Conf. Automated Software Engineering (ASE), pp. 372–375. IEEE (2011)Google Scholar
  7. 7.
    Batory, D., Sarvela, J.N., Rauschmayer, A.: Scaling Step-Wise Refinement. IEEE Trans. Software Engineering (TSE) 30(6), 355–371 (2004)CrossRefGoogle Scholar
  8. 8.
    Benavides, D., Segura, S., Ruiz-Cortés, A.: Automated Analysis of Feature Models 20 Years Later: A Literature Review. Information Systems 35(6), 615–708 (2010)CrossRefGoogle Scholar
  9. 9.
    Bruns, D., Klebanov, V., Schaefer, I.: Verification of Software Product Lines with Delta-Oriented Slicing. In: Beckert, B., Marché, C. (eds.) FoVeOOS 2010. LNCS, vol. 6528, pp. 61–75. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  10. 10.
    Delaware, B., Cook, W., Batory, D.: A Machine-Checked Model of Safe Composition. In: Proc. Workshop Foundations of Aspect-Oriented Languages (FOAL), pp. 31–35. ACM (2009)Google Scholar
  11. 11.
    Dhara, K.K., Leavens, G.T.: Forcing Behavioral Subtyping through Specification Inheritance. In: Proc. Int’l Conf. Software Engineering (ICSE), pp. 258–267. IEEE (1996)Google Scholar
  12. 12.
    Hähnle, R., Schaefer, I.: A Liskov Principle for Delta-oriented Programming. In: Proc. Int’l Conf. Formal Verification of Object-Oriented Software (FoVeOOS), pp. 190–207. Technical Report 2011-26, Department of Informatics, Karlsruhe Institute of Technology (2011)Google Scholar
  13. 13.
    Hoare, C.A.R.: An Axiomatic Basis for Computer Programming. Comm. ACM 12(10), 576–580 (1969)zbMATHCrossRefGoogle Scholar
  14. 14.
    Juergens, E., Deissenboeck, F., Hummel, B., Wagner, S.: Do Code Clones Matter? In: Proc. Int’l Conf. Software Engineering (ICSE), pp. 485–495. IEEE (2009)Google Scholar
  15. 15.
    Kang, K.C., Cohen, S.G., Hess, J.A., Novak, W.E., Peterson, A.S.: Feature-Oriented Domain Analysis (FODA) Feasibility Study. Technical Report CMU/SEI-90-TR-21, Software Engineering Institute (1990)Google Scholar
  16. 16.
    Leavens, G.T., Baker, A.L., Ruby, C.: Preliminary Design of JML: A Behavioral Interface Specification Language for Java. Software Engineering Notes (SEN) 31(3), 1–38 (2006)CrossRefGoogle Scholar
  17. 17.
    Liskov, B.H., Wing, J.M.: A Behavioral Notion of Subtyping. Trans. Programming Languages and Systems (TOPLAS) 16(6), 1811–1841 (1994)CrossRefGoogle Scholar
  18. 18.
    Liu, J., Basu, S., Lutz, R.: Compositional Model Checking of Software Product Lines using Variation Point Obligations. Automated Software Engineering (ASE) 18(1), 39–76 (2011)CrossRefGoogle Scholar
  19. 19.
    Lorenz, D.H., Skotiniotis, T.: Extending Design by Contract for Aspect-Oriented Programming. Computing Research Repository (CoRR), abs/cs/0501070 (2005)Google Scholar
  20. 20.
    Meyer, B.: Applying Design by Contract. Computer 25(10), 40–51 (1992)CrossRefGoogle Scholar
  21. 21.
    Prehofer, C.: Feature-Oriented Programming: A Fresh Look at Objects. In: Aksit, M., Auletta, V. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 419–443. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  22. 22.
    Scholz, W., Thüm, T., Apel, S., Lengauer, C.: Automatic Detection of Feature Interactions using the Java Modeling Language: An Experience Report. In: Proc. Int’l Workshop Feature-Oriented Software Development (FOSD), pp. 7:1–7:8. ACM (2011)Google Scholar
  23. 23.
    Thüm, T., Schaefer, I., Kuhlemann, M., Apel, S.: Proof Composition for Deductive Verification of Software Product Lines. In: Proc. Int’l Workshop Variability-intensive Systems Testing, Validation and Verification (VAST), pp. 270–277. IEEE (2011)Google Scholar
  24. 24.
    Zhao, J., Rinard, M.: Pipa: A Behavioral Interface Specification Language for AspectJ. In: Pezzé, M. (ed.) FASE 2003. LNCS, vol. 2621, pp. 150–165. Springer, Heidelberg (2003)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Thomas Thüm
    • 1
  • Ina Schaefer
    • 2
  • Martin Kuhlemann
    • 1
  • Sven Apel
    • 3
  • Gunter Saake
    • 1
  1. 1.University of MagdeburgGermany
  2. 2.University of BraunschweigGermany
  3. 3.University of PassauGermany

Personalised recommendations