
IMPLEMENTING THE DATA ACCESS OBJECT PATTERN USING ASPECTJ André Luiz de Oliveira, André Luis Andrade Menolli and Ricardo Gonçalves Coelho Informatics Department, State University of the North of Paraná, Br 369 highway Km 54, Bandeirantes, Brazil Keywords: Data Access Object pattern, aspect oriented implementation, metrics. Abstract: Due to the constant need of access and information storage, there is a constant concern for implementing those functionalities in large part of the currently developed applications. The most of those applications use the Data Access Object pattern to implement those functionalities, once that this pattern makes possible the separation of the data access code of the application code. However your implementation exposes the data access object to others application objects, causing situations in that a business object access the data access object. With the objective of solving this problem, this paper proposes an aspect oriented implementation of this pattern, followed by a quantitative evaluation of both, object oriented (OO) and aspect oriented (AO), implementations of this pattern. This study used strong software engineering attributes such as, separation of interests, coupling and cohesion, as evaluation criteria. 1 INTRODUCTION access objects factory strategy, in situations in which the applications access more than one storage A lot of applications frequently need implementing mechanism, or create a generic data access object, in some access mechanism and data persistence, once order to determine a common access point to the that the organizations often need access and storage data access functions of the application. its information in some kind of database. To access Both implementations previously mentioned are this information surely and efficiently some patterns good solutions that isolate the data access code from were introduced by several authors, not only in the others application functions, optimizing the object-oriented software development (OOSD) but legibility and the modularity of the developed also in the aspect-oriented software development application, facilitating future maintenance and (AOSD). extension processes of the application, providing the In literature we can find several patterns that reuse of several components of the system. implement the data persistence, such as Persistence It was verified in Sun Microsystems (2002), that Data Collections (Massoni et. al. 2001), that Data Access Object pattern allows the business provides a set of class and interfaces to separate data object to using the data source without having the access code and business rules from user interface, knowledge of the specific details of its promoting the modularity. Among others patterns implementation, providing a transparent access to its with the same purpose is the Decoupling Patterns, functionalities, once that those details of the data that is a set of data access patterns proposed by source implementation are encapsulated within the Nock (2003), that describes strategies to uncouple data access object. That whole transparency causes data access components from others parts of the the exposition of the data access object to others application, and the Data Access Object (Sun application objects, causing situations in which a Microsystems 2002), that is one of the data access business object access the data access object, patterns more often used, due to fact of this pattern harming the modularity, the legibility and the isolates the whole data access code of the encapsulation of the application code, besides the application code facilitating migration processes for need of adding an extra object layer between the other storage systems. data client and the data source so that its There are several forms of implementing the data implementation benefits this pattern. access functionalities of the application. As seen in With the objective of solving this problem, this Sun Microsystems (2002), it can be adopted a data study proposes an alternative implementation of the 523 Luiz de Oliveira A., Luis Andrade Menolli A. and Gonçalves Coelho R. (2008). IMPLEMENTING THE DATA ACCESS OBJECT PATTERN USING ASPECTJ. In Proceedings of the Tenth International Conference on Enterprise Information Systems - DISI, pages 523-530 DOI: 10.5220/0001714805230530 Copyright c SciTePress ICEIS 2008 - International Conference on Enterprise Information Systems Data Access Object pattern using the aspect oriented works to this study. And finally, the section 6 programming with AspectJ language. This solution exposes the conclusions and the future research provides the encapsulation of the data access proposes. functions of the application developed, once that the business object and others application components not more need access the data access functions of the 2 ORGANIZATION OF THE application, all the control of the calls to the data access and persistence operations is made by STUDY aspects. This way, the others application objects do not need anymore know the implementation details This section describes the configuration of that of the classes and methods responsible by the data empirical study. This study approaches an access functions of the application, optimizing the alternative implementation of the Data Access application modularity and legibility. Object pattern, using the aspect oriented In this study, we identified some situations where programming, with the AspectJ language. In order to it is profitable to change the Data Access Object explicit the foundations of proposed solution, the pattern implementation to an aspect oriented section 2.1 presents the object oriented implementation of this pattern. Those situations implementation of the Data Access Object pattern occur when there is a constant need of isolating all and later the aspect oriented implementation of this the data access functions implementation of the pattern. Already the section 2.2 introduces the application, in order to avoid the exposition of the metrics used in the evaluation process of the data access object to others application objects. Your proposed solution. And finally, the section 2.3 application provides a better separation of concerns describes the evaluation procedures applied in this of data access which is verified by the outcomes study. presented in the section 4. The results of this study were obtained through a 2.1 Data Access Object Pattern comparative study between object oriented (OO) and Implementation aspect oriented (AO) implementations of the Data Access Object pattern. The comparison between OO As seen previously, the Data Access Object aims at and AO implementations of traditional patterns is avoiding direct dependence situations between the not so new. Some papers have already made this application code and the data access code (Sun kind of comparison, like Hannamann and Kiczales Microsystems 2002). When analyzing this pattern, it (2002) and Garcia et. al. (2005). This paper presents was verified that it defines two roles for its an alternative implementation of the Data Access participant classes that corresponds to the Business Object pattern, followed by a quantitative evaluation Logic and the Data Access. The Business Logic role of both OO and AO implementations of this pattern. is responsible by the whole control of the business It is important to point out that this work does not logic of the application, that means, it treats the propose an approach that substitutes the Data Access input data before of those data have been passed into Object pattern, but certainly is an alternative the call of one data access function, besides approach for the implementation of this pattern, manipulating the obtained data of a data access which can be applied to the applications function, to summarize that role is a data client (Sun environment previously mentioned, providing a Microsystems 2002). The Data Access role better separation of concerns of this pattern. represents the object that abstracted the underlying In order to explicit the foundation of the data access implementation (Sun Microsystems proposed solution, the present work is organized in 2002) to the Business Logic role, enabling eight sections. The section 2 presents the transparent access to the data source, which means, organization of the developed study that includes the it provides all the access and storage data illustration of the OO and AO implementations of functionalities to the Business Logic role. The the Data Access Object pattern, the metrics used in Figure 1 illustrates the oriented object the validation of this study and the evaluation implementation of this pattern applied in the present procedures adopted. The section 3 exposes the work. When analyzing this figure it is assumed that outcomes obtained in the comparison of the OO and the Data Access role implementation is dispersed by AO implementations of the Data Access Object all classes of the pattern. Since the Business Logic pattern. The section 4 illustrates the constraints of role is implemented by the BusinessObject and this study. The section 5 approaches some related TransferObject classes. 524 IMPLEMENTING THE DATA ACCESS OBJECT PATTERN USING ASPECTJ Figure 3: Aspect oriented model of the Data Access Object pattern. Figure 1: Object oriented model of the Data Access Object pattern. In the diagram previously shown, the business object acts as a Facade (Gamma et. al. 1995) object that The Figure 2 presents the source code of the works as an access interface to functionalities
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages8 Page
-
File Size-