Modularizing application and database evolution - an aspect-oriented framework for orthogonal persistence

Rui Humberto R. Pereira, J. Baltasar García Perez-Schofield, Francisco Ortin
2016 Software, Practice & Experience  
In the maintenance of software applications, database evolution is one common difficulty. In object-oriented databases, this process comprises schema evolution and instance adaptation. Both tasks usually require significant effort from programmers and database administrators. In this paper, we propose orthogonal persistence and aspect-oriented programming to support semi-transparent database evolution. A default mechanism for instance evolution is defined, but the user may provide modularized
more » ... lutions using the aspect-oriented paradigm. We present our framework AOF4OOP to test the feasibility of our proposed approach. This prototype allows programmes to transparently access data in other versions of the database schema. We evaluate our framework, comparing it to related approaches using two real applications and measuring the improvement of the productivity of the programmer. of an adult education organization where day-to-day activities are supported on a database, which stores information about students, staff, courses, examinations and results, among others. The management of the organization decided to redesign the database for a variety of reasons, such as fixing design mistakes. In the structure prior to evolution, the class hierarchy did not conform to good object-oriented design principles as the class Student was not a subclass of the class Person. Thus, in the new structure, Person is a superclass of Student and Staff. Hence, it defines attributes common to both classes (which are transferred to the superclass). Figure 1 (a) and (b) shows the structure before and after the evolution, respectively. From now on, we will refer to these two versions of the class structure as version 'A' and version 'B', respectively. In this example, the database evolution is necessary because the metadata layer (in version 'A') in the object-oriented database system (OODBS) does not follow the new class structure in version 'B'. Additionally, at the data layer, existing instances of the classes must be adapted. This instance adaptation problem is particularly complex in the case of the subclasses of Person and Staff, in which there are semantic variations. Figure 1. Database evolution case study (extracted from [2]). The object-oriented database evolution problem has been intensively studied in the last decades but still remains an error prone and time consuming undertaking for programmers and database administrators. Currently, there is some excitement in the scientific community regarding bidirectional transformations (BX) [3] . BX is a mechanism for maintaining the consistency of two (or more) related sources of information. The BX is a concept encompassing many different areas, including software engineering, programming languages, databases and document engineering. As far as we are aware, regarding databases, this research activity has been focused on relational databases, view mechanisms and query translations [4] [5] [6] , as well as other research areas [7] . Besides other goals, our work intends to fill this gap proposing a new aspect-oriented approach to establish mappings between multiple versions of classes in object-oriented databases. Object-oriented database management systems like DB4O [8], Versant [9] and ObjectDB [10], provide transparent schema evolution mechanisms. These mechanisms alleviate the programmers' workload by keeping the data and application layers synchronized. Although these modern systems provide such transparent mechanisms, the most frequent types of schema updates identified in earlier works are not supported [11, 12] . In these systems, some types of updates, such as class movements in the inheritance hierarchy, attribute renaming and semantic changes in attributes content, require the programmer's intervention in order to convert the data from the old structure to the new one. Additionally, in the case of a class that is moved within its inheritance hierarchy, these systems also require a temporary class, with a distinct name, which must be renamed at the end of the conversion process. Thus, in real world applications, the use of these systems requires significant effort by the programmers to evolve the database. This is the case with the aforementioned example, in which this type of update occurs. These database evolution problems motivated us to find solutions to improve the programmer's work in order to be more productive and less prone to errors. This paper addresses the database evolution problem, in the specific context of orthogonal object-oriented persistent programming systems [13, 14] in both its parts: schema evolution and instance adaptation. These systems, due to their intrinsic characteristics, have motivated our research work. We have found that some of these characteristics are distinctive and are not observed in non-orthogonal systems. Therefore, we decided to use a novel approach to deal with the aforementioned problems, applying aspect-oriented programming (AOP) techniques [15] . In this paper, we present our meta-model and its prototype, which explore the benefits of combining the orthogonal persistence paradigm with AOP techniques. Our aspect-oriented framework enables the modularization of the persistence concern of applications as well as the evolution of the database. Applications rely on this framework in order to be provided with orthogonal persistence mechanisms. Programmers can perform updates of the class structure of the application, because our framework will create a new version of these structures in the OODBS. Our schema evolution approach is incremental, that is, new versions are always added to the metadata layer in the database. Additionally, the framework enables previously created objects (instances of other class versions) to remain available to applications. Each application version only knows its own structure of classes. Our framework adapts the objects loaded from the database according to the class version that is expected by the running application. Regarding the instance adaptation problem, it is, in many cases, handled autonomously by the framework. Only when structural or semantic variations occur are the default mechanisms unable to perform the instance adaptation autonomously. In these cases, programmers must write conversion code as aspect-oriented modules which extend the default mechanisms of the framework. The main contribution of our work consists in finding transparent mechanisms for the support of database evolution in orthogonal persistent systems, reducing the programmers' work effort and enabling the coexistence of distinct class versions. In other systems [8-10], programmers must write helper programs to migrate the data when structural or semantic variations occur. In contrast, our framework proposes simple aspect-oriented constructs to extend the default evolution mechanism, making the framework reusable. Our approach focuses on supporting programmers with persistence and database evolution services from a programming perspective rather than a database perspective.
doi:10.1002/spe.2415 fatcat:xh4dutfjcbgklakwzbulhhzrwu