Java Extensions for Design Pattern Instantiation

  • André L. SantosEmail author
  • Duarte Coelho
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9679)


Design patterns are not easily traceable in source code, leading to maintainability and comprehension issues, while the instantiation of certain patterns involves generalizable boiler-plate code. We provide high-level language constructs addressing design patterns that transform source code by injecting a substantial part of their implementation at compile time. We developed proof of concept extensions addressing widely used design patterns, namely Singleton, Visitor, Decorator, and Observer, using annotations as the means to extend Java. We describe our Java annotations to support these design patterns and the associated source code transformations, demonstrating that it is possible to significantly reduce the necessary code to instantiate a pattern through the use of high-level constructs.


Design Pattern Abstract Class Language Construct Language Extension Observer Pattern 
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.
    Barbosa, F.S., Aguiar, A.: Using roles to model crosscutting concerns. In: Proceedings of the 12th Annual International Conference on Aspect-Oriented Software Development, AOSD 2013, pp. 97–108. ACM, New York (2013)Google Scholar
  2. 2.
    Bosch, J.: Design patterns as language constructs. J. Object-Oriented Program 11(2), 18–32 (1998)Google Scholar
  3. 3.
    Brooks Jr., F.P.: No silver bullet - essence and accidents of software engineering. Computer 20(4), 10–19 (1987)MathSciNetCrossRefGoogle Scholar
  4. 4.
    Cacho, N., Sant’Anna, C., Figueiredo, E., Garcia, A., Batista, T., Lucena, C.: Composing design patterns: a scalability study of aspect-oriented programming. In: Proceedings of the 5th International Conference on Aspect-Oriented Software Development, AOSD 2006, pp. 109–121. ACM, New York (2006)Google Scholar
  5. 5.
    Cachopo, J., Rito-Silva, A.: Versioned boxes as the basis for memory transactions. Sci. Comput. Program. 63(2), 172–185 (2006)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Chambers, C., Harrison, B., Vlissides, J.: A debate on language and tool support for design patterns. In: Proceedings of the 27th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 277–289. ACM (2000)Google Scholar
  7. 7.
    Fowler, M.: Patterns of Enterprise Application Architecture. Addison-Wesley Longman Publishing Co., Inc., Boston (2002)Google Scholar
  8. 8.
    Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Pearson Education, Upper Saddle River (1994)zbMATHGoogle Scholar
  9. 9.
    Hakala, M., Hautamäki, J., Koskimies, K., Paakki, J., Viljamaa, A., Viljamaa, J.: Architecture-oriented programming using FRED. In: Proceedings of the 23rd International Conference on Software Engineering, pp. 823–824. IEEE Computer Society (2001)Google Scholar
  10. 10.
    Hannemann, J., Kiczales, G.: Design pattern implementation in java and aspectj. In: Proceedings of the 17th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2002, pp. 161–173. ACM, New York (2002)Google Scholar
  11. 11.
    Nobakht, B., de Boer, F., Bonsangue, M., de Gouw, S., Jaghoori, M.: Monitoring method call sequences using annotations. Sci. Comput. Program. 94, 362–378 (2014)CrossRefGoogle Scholar
  12. 12.
    Perry, D.E., Wolf, A.L.: Foundations for the study of software architecture. SIGSOFT Softw. Eng. Notes 17(4), 40–52 (1992)CrossRefGoogle Scholar
  13. 13.
    Prechelt, L., Unger, B., Tichy, W.F., Brossler, P., Votta, L.G.: A controlled experiment in maintenance: comparing design patterns to simpler solutions. IEEE Trans. Softw. Eng. 27(12), 1134–1144 (2001)CrossRefGoogle Scholar
  14. 14.
    Prechelt, L., Unger-Lamprecht, B., Philippsen, M., Tichy, W.F.: Two controlled experiments assessing the usefulness of design pattern documentation in program maintenance. IEEE Trans. Softw. Eng. 28(6), 595–606 (2002)CrossRefGoogle Scholar
  15. 15.
    Soukup, J.: Implementing patterns. In: Coplien, J.O., Schmidt, D.C. (eds.) Pattern Languages of Program Design, Chap. Implementing Patterns, pp. 395–412. ACM Press/Addison-Wesley Publishing Co., New York (1995)Google Scholar
  16. 16.
    Tatsubori, M., Chiba, S., Killijian, M.-O., Itano, K.: OpenJava: a class-based macro system for java. In: Cazzola, W., Houmb, S.H., Tisato, F. (eds.) Reflection and Software Engineering. LNCS, vol. 1826, pp. 117–133. Springer, Heidelberg (2000)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2016

Authors and Affiliations

  1. 1.Instituto Universitário de Lisboa (ISCTE–IUL), ISTARLisbonPortugal

Personalised recommendations