A Metadata Based Components Model - CiteSeerX

26 downloads 0 Views 90KB Size Report
Available on http://www.javalobby.org/java/forums/t65305.html, 2006. 7. Bauer, Christian and King, Gavin. Hibernate in Action. Manning Publications, 2004. 8.
A Metadata-Based Components Model Eduardo Martins Guerra1 and Clovis Torres Fernandes1 (advisor) Aeronautical Institute of Technology, Praça Marechal Eduardo Gomes, 50 Vila das Acácias - CEP 12.228-900 – São José dos Campos – SP, Brazil [email protected], [email protected]

1

Abstract. Metadata-based component is a component or a framework that processes its logic based on the metadata of the class whose instance it is working with. Many frameworks use this approach to increase the flexibility and the reuse in applications. But all those frameworks are created by the experience of the developers, because there are not documented techniques or best practices for the development of this kind of component. This work proposes the development of a model for Metadata-based components, to ease the development of flexible software components and increase the application reuse.

1 Problem Description There are many ways for a component or a framework to be reusable and adaptable. Specialization of the component classes and implementation of its interfaces, allows the application to extend the behavior and to adapt it to its needs [1] [2]. For instance, the use of dependency injection, allows the client to insert the instances that composes the component [3], changing the behavior based on the class and information of the instance inserted. Combining these techniques, the developer combines composition and inheritance to enable flexibility and reuse in the component. These techniques are used in design patterns to document common solutions for some recurrent problems in object-oriented applications [4]. Another approach to achieve flexibility and a high reuse degree are used in some recent frameworks. These frameworks process its logic based on metadata configured for the application classes. This allows those frameworks to be more close to the application classes and adapt its behavior in runtime based on the metadata. The metadata describes additional data about attributes, methods and classes that are relevant for the component processing. This proposed research will explore this kind of component. This approach became more popular in the Java Platform after the incorporation of annotations natively in the programming language [5]. The metadata can be stored not only using annotations, but also in external files (usually as XML documents), databases or programmatically. The metadata can also be configured implicitly using name conventions [6]. The following are examples of frameworks and APIs that uses this approach: Hibernate [7] and JPA [8] uses metadata to create an object-relational mapping and to

manage events in different phases of an instance persistence process; EJB [8] uses metadata to configure how the container is going to control some non-functional features, like transaction strategy and access control policy; JAXB [9] do the mapping between the application object model and a XML document using metadata; JUnit [10] identifies test and life cycle methods of a test class by metadata. The use of this kind of component can lead to a high degree of reuse, because some logic that deals with specificities of the application classes can be done by the component using the metadata information. In traditional frameworks, this kind of logic is implemented programmatically in the application extending the frameworks classes or implementing its interfaces. This new approach exchanges an imperative code, for the declaration of the class metadata. All existent metadata-based components are created based only on the experience of its developers, because there are not documented techniques or best practices for dealing with metadata. There are many situations that the metadata approach could be used with advantages, but because of the little documentation about it few components of this kind are created.

2 Goal Statement The goal of this work is to propose a metadata-based components model, to ease the development of flexible software components and increase the application reuse. This model must be a reference for solving design problems about how to deal with metadata in this kind of component. The model must be also the basis for other studies about metadata-based components. This work investigates the following key questions about the metadata-based components: 1. What are the characteristics that metadata-based components had in common? 2. What kind of problems can be addressed using metadata-based components? 3. What are the design requirements that may appear in this kind of components because of the use of metadata? 4. How are the existent metadata-based components designed? How do they deal with class metadata? 5. How much reuse degree can an application get using a metadata-based component? 6. How much easier and faster is to develop an application using a metadata-based component?

3 Approach To investigate about metadata-based components, seeking for an abstraction of its characteristics and concepts, three different strategies are being followed, namely: 1. The existent metadata-based components will be analyzed, looking for what problem is solved with metadata, how it is designed and how it is internally

structured. The abstraction of those solutions will lead the research for suitable patterns for solve metadata problems. 2. There are two open source metadata-based frameworks, SwingBean [11] and Esfinge [12], developed by the author of this proposal. They are currently used by some large and medium scale applications in production. Those frameworks will be refactored to study the implementation of the patterns found and to analyze how their use influence the application and framework flexibility. 3. Other minor case studies of metadata-based components are also going to be developed. These case studies are intended to explore the concepts of metadatabased components and to experiment the patterns found in different situations. Using the knowledge obtained by these tree different strategies, some design patterns for application in metadata-based components will be identified and documented. These patterns are going to be presented as a pattern language that addresses the most important aspects about dealing with metadata in components. The structure of this pattern language will address patterns for metadata creation and management, logic processing based on metadata and for metadata use applicability. After the pattern identification, the main components and their relationships will be formalized using an Architecture Description Language (ADL). There is an ongoing research about how the internal architecture of those components will be formalized. Wright [13] is one of the options being considered.

4 Validation The work will be validated both quantitatively and qualitatively. The qualitative validation will occur during the research, comparing the patterns and the model to existent frameworks and using them in case studies. The case studies will validate if the proposed patterns fulfils some flexibility requirements about metadata manipulation. To validate that the application of the proposed model in a component really improve the reuse degree of the software that uses it, an experiment will be accordingly defined. In this experiment, the same problem will be addressed using tree kind of approaches: (a) without frameworks; (b) with a traditional framework and (c) with a metadata-based framework. The goal of the experiment is to have different solutions with the same interface and behavior, which can be used to do a comparative study. There will be at least tree teams, each one with a different problem. The experiment will use groups of undergraduate students of the object orientation course. The following phases will be considered: · Phase 1: The teams have to solve the problem without using frameworks. There will be an interface that they must use in the implementation. Some automated integration tests will be developed to ensure that the behavior is correct. · Phase 2: The teams have to develop a traditional framework to help someone to solve similar problems that they solve in Phase 1. The documentation for this framework must be created.

· Phase 3: The teams have to exchange the problems and implement the same problem of Phase 1 with the framework developed in Phase 2. The same tests created in Phase 1 must execute successfully. · Phase 4: The team that developed the framework in Phase 2 has to evolve it by using the metadata-based approach. The metadata-based component model developed must be used. The team must suitably document the framework. · Phase 5: A new team that did not already dealt with the problem have to implement it using the metadata-based component created in Phase 4. The same tests created in Phase 1 must execute successfully. A comparative study will be made based on the solutions created by the students in the experiment. Some metrics for reuse [14] and code complexity will be used to analyze quantitatively each approach. The students will also answer some questionnaires for a qualitative analysis of the experiment. The validation will focus on the quantitative metrics, but the questionnaires could also lead to some interesting results. The main goal of the quantitative study is to show that applications that use metadata-based components created using the proposed model have a high degree of reuse compared to those created with traditional frameworks techniques. The qualitative study should also detect that the implementation with metadata-based components is more productive and easier than using traditional frameworks.

References 1. Fayad, M. E., Schimidt, D. C. and Johnson, R. Building application frameworks: Objectoriented foundations of framework design. John Wiley & Sons, 1999. 2. Pree, W., Pomberger, G. Schappert, A. Sommerlad, P. Active Guidance of Framework Development. Software - Concepts and Tools. v.16, i. 3, p. 136 – 145, 1995. 3. Fowler, M. Inversion of Control Containers and the Dependency Injection pattern. Available on http://www.martinfowler.com/articles/injection.html, 2004. 4. Gamma, E. Helm, R. Johnson, R. Vlissides, J. Design Patterns: Elements of Reusable Object-Oriented Software. Reading, MA: Addison-Wesley, 1994. 5. JSR 175. JSR 175: A Metadata Facility for the Java Programming Language. Available on http://www.jcp.org/en/jsr/detail?id=175, 2003. 6. DOV, A. B. Convention vs. Configuration. Available on http://www.javalobby.org/java/forums/t65305.html, 2006. 7. Bauer, Christian and King, Gavin. Hibernate in Action. Manning Publications, 2004. 8. JSR 220. JSR 220: Enterprise JavaBeans 3.0. Available on http://www.jcp.org/en/jsr/detail?id=220, 2006. 9. JSR 222: Java Architecture for XML Binding (JAXB) 2.0. Available on http://jcp.org/en/jsr/detail?id=222, 2006. 10. JUnit, Testing Resources for Extreme Programming. Available on http://www.junit.org/, 2008. 11. SwingBean, Available on http://swingbean.sourceforge.net/, 2008. 12. Esfinge, Available on http://esfinge.sourceforge.net/, 2008. 13. R. Allen, A Formal Approach to Software Architecture, PhD Thesis, Carnegie Mellon Univ., CMU Technical Report CMU-CS-97-144, May 1997. 14. W. Frakes and C. Terry, Software Reuse: Metrics and Models, ACM Computing Surveys, vol. 28, 1996. http://citeseer.ist.psu.edu/frakes96software.html

Suggest Documents