loading page

An Approach Based on Metadata to Implement Convention over Configuration Decoupled from Framework Logic
  • +1
  • Everaldo Gomes,
  • Eduardo Guerra,
  • Phyllipe Lima,
  • Paulo Meirelles
Everaldo Gomes
Universidade de Sao Paulo

Corresponding Author:[email protected]

Author Profile
Eduardo Guerra
Libera Universita di Bolzano
Author Profile
Phyllipe Lima
Universidade Federal de Itajuba
Author Profile
Paulo Meirelles
Universidade de Sao Paulo
Author Profile

Abstract

Frameworks are essential for software development, providing code design and reuse for its users. Well-known Java frameworks and APIs such as Spring, JUnit, and JPA rely on metadata usage, commonly defined by code annotations. Those frameworks use the Java Reflection API for consuming and processing these annotations. Code elements usually have some similarities and can also have the same annotation. This paper proposes a model for defining conventions over configuration for annotations usage decoupled from the metadata reading logic. With this model, if a convention is present, the framework will consider that the element is configured by a specific target annotation, even if the code element does not have the annotation. We implemented this model in the metadata reading framework Esfinge Metadata API. The model implementation was evaluated refactoring an existing framework to add support to conventions using our approach. As a result, it was possible to introduce the conventions only by adding configurations to the annotations. The model was further evaluated in an experiment in which participants implemented the Conventions over Configuration pattern using the Esfinge Metadata API and Java Reflection API. Based on the results, approach fulfilled its goal of supporting the definition of conventions decupled from the framework logic, making the code more readable and easier to maintain according to the participants perception.
05 Apr 2023Submitted to Journal of Software: Evolution and Process
05 Apr 2023Assigned to Editor
05 Apr 2023Submission Checks Completed
03 Aug 2023Reviewer(s) Assigned