
3612209e57a0f755f80848d79f80e11c.ppt
- Количество слайдов: 41
Formal concept analysis based normal forms for class hierarchy design in object-oriented software development http: //www. info. uqam. ca/~godin/ICFCA 2003. ppt Robert Godin, UQAM First Conference on "Formal Concept Analysis" Darmstadt Feb. 2003
Collaborators l l Rokia Missaoui, Hafedh Mili (UQAM) Guy Mineau (ULaval) Petko Valtchev, Houari Sahraoui (Ude. M) Marianne Huchard (LIRMM)
Plan l l l The problem of class hierarchy design Quality criteria Work on FCA for class hierarchies FCA framework Normal forms (design patterns) for class hierarchies – – – Attributes Methods body/signature/redefinition Associations
Problem: designing & maintaining good class hierarchies l Difficult problem (Booch, 1994; Rumbaugh, Blaha, Premerlani, Eddy & Lorensen, 1991) – – – l Large solution space Evolution Conflicting criteria Large body of work – (Godin, Huchard, Roume & Valtchev, 2002)
Development scenarios l Building the hierarchy from scratch using – – l objects (Lieberherr, Bergstein & Silva-Lepe, 1991) class specifications (Dvorak, 1994; Godin & Mili, 1993) Evolution of the class hierarchy to accommodate new requirements – – unconstrained class addition (Dvorak, 1994; Godin & Mili, 1993) addition constrained by backward compatibility l l l Reengineering of an existing class hierarchy – – – l l with a previous hierarchy (Rapicault & Napoli, 2001) existing objects (Huchard, 1999) from the relation between classes and their attributes/methods (Casais, 1991; Cook, 1992) using code analysis tools (Dicky, Dony, Huchard & Libourel, 1996; Godin, Mili, Mineau, Missaoui, Arfi & Chau, 1998) by applying refactorings (Fowler, 2002; Moore, 1996) from UML models including associations (Huchard, Roume, Valtchev…) from access patterns in applications (Snelting & Tip, 2000) prompted by detecting defects using software metrics (Sahraoui, Godin & Miceli, 2000) Reengineering procedural code (Sahraoui, Lounis, Melo & Mili, 1999; Tonella, 2001) Merging existing partial hierarchies (Snelting & Tip, 2002)
Formal quality criteria l Minimize redundancy (code duplication) – l l Maximal factorization Subclass as specialization Multiple inheritance only if necessary Limit number of classes Guaranteed by FCA framework
Using FCA for class hierarchy l Initial proposal OOPSLA’ 93 (Godin & Mili, 1993) – l LIRMM : ARES incremental alg. (Dicky, Dony, Huchard & Libourel, 1994) – l l l l Object Oriented Reorganization using GAlois lattices Syste. M Galois subhierarchy ISGOOD incremental alg. (Godin, Mineau, Missaoui, 95; Godin & Chau, 2000) ARES++ : Overloading/extracting specs. from code OOPSLA’ 96 (Dicky et al. , 1996) Combined with method refactoring GURU OOPSLA’ 96(Moore, 96) Object database design (Yahia, Lakhal, Bordat & Cicchetti, 1996) Smalltalk tool, exp. , metrics (Godin, Mili, Mineau, Missaoui, Arfi & Chau, 1998) Access patterns from applications TOPLAS (Snelting & Tip, 2000) CERES : Java tool, batch alg. (Huchard, Dicky, Leblanc, 2000) Factoring associations (Huchard, Roume, Valtchev, 2002)
FCA framework l l Context K : = (G, M, I) G (objects of context) – – – l classes example objects associations M (attributes of context) – instance variables (OO attributes) l – – – values methods body/signature association role association properties
Relation g. Im l l l From analyst From code From access patterns in applications
Example : class attributes
Reduced labelling of concept lattice
Interpretation as class hierarchy : attribute factored lattice form
Minimize number of classes while preserving other quality criteria
Prune empty classes : FCA object/attribute concepts (Galois subhierarchy, PICH)
Attribute factored subhierarchy form
The case for empty class ?
Method body factored lattice/subhierarchy form
Declaration of method signatures l l Use many valued attribute for each signature + Scaling
Derived one-valued context
Concept lattice
Method declaration and body factored lattice/subhierarchy
Method redefinition l By scaling
Method redefinition factored lattice/subhierarchy
Maximal factorization l l H is maximally factorized : if – – – l x 1 in Class 1 x 2 in Class 2 x 3 is least upper bound of x 1 and x 2 then – x 3 in superclass of Class 1 and Class 2
Maximal factorization
Associations : value of manyvalued attribute is an FCA object
First concept lattice : B 0
Relational extension K+ with B 0
Concept lattice B 1 : association factored lattice/subhierarchy forms
Relational context family (RCF) l General framework for set of related contexts – l (Huchard, Roume & Valtchev, 2002) UML – – – Take into account UML properties (multiplicity, association classes, …) One context for classes : K 1 One context for associations : K 2 Mutual enrichment Iterate until fixed point is reached
Definition of Relational Context Family (RFC) Definition : Relational context family (RCF) R s = (KR , AR) KR set of s multi-valued contexts Ki = (Ai , Oi , Vi , Ji ) and set of relations AR = { j } j : O r 2 O q Auxiliairy functions : i. dom, cod : AR {Oi } 0 ≤ i ≤ s such that for all j : Or 2 Oq : a) dom( j ) = Or , b) cod( j ) = Oq. ii. rel : KR 2 AR with rel ( Ki ) = { j | dom( j ) = Oi}
UML example Student name address College Renting Tenant name address Transaction s. P m. R 1…* Rent > d. D Landlord Trans. Val t. V name address 1…* Buy > Purchase p. C p. D * House * type
Context for classes : K 1 GF 1 = GF 2 = GF 3 = GFDate = GFValue = GF 4 = name adrs col s. P p. D d. D m. R p. C t. V type Student X X X Tenant X X Landlord X X House X Transaction X Trans. Val X Renting X X Purchase X X
Build concept lattice for K 1 Trans. Val t. V Renting s. P m. R Tenant-Landlord name address Student College Transaction d. D Purchase p. D p. C Rent > 1…* * Buy > * House type
Context for associations : K 2 name = mo = Nav = md = Rent Buy 1…* * * O-D D-O Rent X X X Buy X X X
K 2 K+2 name = mo = md = Nav = Rent Buy 1 …* Rent X X X Buy X X X to = * * O-D D-O Tenant td = Landlord X AC = Renting X X House X X Purchase X
Discover Ass. G 1 > 1…* * td=House Rent > to=Tenant 1…* Renting s. P m. R Buy > * td=House to=Landlord 1…* * Purchase p. D p. C td=House
K 1 K+1 na m e a d r s col Student X X X Tenant X X Landlord X X House Transacti on Trans. Val GFDate = GFValue = Orig. Of = Dest. Of = Cl. Of = Re nt Bu y Ass G 1 Re nt Ass Buy G 1 Re nt Bu y As s. G 1 X X X X X X X X X X s p d D D D m. R p C t. V ty p Renting Purchase
Discover new classes NC 1 (Person) name address Student College Trans. Val t. V Transaction d. D Ass. G 1 > 1…* NC 2 NC 4 Renting s. P m. R Tenant Landlord Purchase p. D p. C * Rent > 1…* * Buy > * House type
Conclusion l l FCA is natural framework for design of class hierarchies FCA based normal forms for hierarchy design – l Attribute, method body, method signature, redefinition, association factored lattice/hierarchy Future work – – Theoretical : RFC Tool support
References l l l l l l l Booch, G. (1994). Object-Oriented Analysis and Design (2 nd ed. ). Reading, MA: Benjamin Cummings. Casais, E. (1991). Managing Evolution in Object Oriented Environments: An Algorithmic Approach. Thèse de doctorat Thesis, Geneva. Cook, W. R. (1992). Interfaces and Specifications for the Smalltalk-80 Collection Classes. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications , A. Paepcke (Ed. ), Vancouver, B. C. , Canada: ACM Press, pp. 1 -15. Dicky, H. , Dony, C. , Huchard, M. & Libourel, T. (1996). On Automatic Class Insertion with Overloading. In Proceedings of the ACM Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA'96) , CA, USA: ACM SIGPLAN Notices, pp. 251 -267. Dvorak, J. (1994). Conceptual Entropy and Its Effect on Class Hierarchies. IEEE Computer, 27(6), 59 -63. Fowler, M. (2002). Refactoring : Improving the Design of Existing Code. Reading, MA: Addison-Wesley. Ganter, B. & Wille, R. (1999). Formal Concept Analysis : Mathematical Foundations. Springer-Verlag. Godin, R. , Huchard, M. , Roume, C. & Valtchev, P. (2002). Inheritance and Automation : Where Are We Know ? In Proceedings of the Inheritance Workshop, ECOOP 2002 Workshop Reader, Malaga, Spain: Lecture Notes In Computer Science, Springer-Verlag, Godin, R. & Mili, H. (1993). Building and Maintaining Analysis-Level Class Hierarchies Using Galois Lattices. In Proceedings of the ACM Conference on Object. Oriented Programming Systems, Languages, and Applications (OOPSLA'93) , A. Paepcke (Ed. ), Washington, DC: ACM Press, pp. 394 -410. Godin, R. , Mili, H. , Mineau, G. W. , Missaoui, R. , Arfi, A. & Chau, T. -T. (1998). Design of Class Hierarchies based on Concept (Galois) Lattices. Theory and Practice of Object Systems (TAPOS), 4(2), 117 -134. Huchard, M. (1999). Classification des classes contre classification d'instances. Évolution incrémentale dans les systèmes à objets basés sur des treillis de Galois. In Proceedings of the Langages et Modèles à Objets (LMO'99) , Hermès, pp. 179 -196. Huchard, M. , Dicky, H. & Leblanc, H. (2000). Galois lattice as a framework to specify building class hierarchies algorithms. Theoretical Informatics and Applications , n. 34, 521 -548. Huchard, M. , Roume, C. & Valtchev, P. (2002). When Concepts Point at Other Concepts : the Case of UML Diagram Reconstruction. In Proceedings of the Workshop FCAKDD, pp. 32 -43. Johnson, R. & Foote, B. (1988). Designing Reusable Classes. Journal of Object-Oriented Programming, June/July, 22 -35. Korson, T. & Mc. Gregor, J. D. (1992). Technical Criteria for the Specification and Evaluation of Object-Oriented Libraries. Software Engineering Journal, March, 85 -94. Lieberherr, K. J. , Bergstein, P. & Silva-Lepe, I. (1991). From Objects to Classes: Algorithms for Optimal Object-Oriented Design. Journal of Software Engineering , 6(4), 205 -228. Moore, I. (1996). Automatic Inheritance Hierarchy Restructuring and Method Refactoring. In Proceedings of the ACM Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA'96) , CA, USA: ACM SIGPLAN Notices, pp. 235 -250. Rapicault, P. & Napoli, A. (2001). Évolution d'une hiérarchie de classes par interclassement. L'Objet, 7(1 -2). Rumbaugh, J. , Blaha, M. , Premerlani, W. , Eddy, F. & Lorensen, W. (1991). Object-Oriented Modeling and Design. Prentice Hall. Sahraoui, H. , Lounis, H. , Melo, W. & Mili, H. (1999). ·A Concept Formation Based Approach to Object Identification in Procedural Code. Journal of Automated Software Engineering, 10(4). Sahraoui, H. A. , Godin, R. & Miceli, T. (2000). Can Metrics Help to Bridge the Gap Between the Improvement of OO Design Quality and Its Automation? In Proceedings of the International Conference on Sofware Management (ICSM) 2000 , San Jose, CA: Snelting, G. & Tip, F. (2000). Understanding Class Hierarchies Using Concept Analysis. ACM Transactionson Programming Languages and Systems , 22(3), 540 -582. Snelting, G. & Tip, F. (2002). Semantics-Based Composition of Class Hierarchies. In Proceedings of the pp. 562 -584. Tonella, P. (2001). Concept Analysis for Module Restructuring. IEEE Transactions on Software Engineering , 27(4), 351 -363. Yahia, A. , Lakhal, L. , Bordat, J. P. & Cicchetti, R. (1996). An algorithmic method for building inheritance graphs in object oriented design. In Proceedings of the 15 th International Conference on Conceptual Modeling, ER'96 , B. Thalheim (Ed. ), Cottbus, Germany: pp. 422 -437.
3612209e57a0f755f80848d79f80e11c.ppt