Presentation is loading. Please wait.

Presentation is loading. Please wait.

Formal concept analysis based normal forms for class hierarchy design in object-oriented software development

Similar presentations

Presentation on theme: "Formal concept analysis based normal forms for class hierarchy design in object-oriented software development"— Presentation transcript:

1 Formal concept analysis based normal forms for class hierarchy design in object-oriented software development Robert Godin, UQAM First Conference on "Formal Concept Analysis" Darmstadt Feb. 2003

2 Collaborators Rokia Missaoui, Hafedh Mili (UQAM) Guy Mineau (ULaval) Petko Valtchev, Houari Sahraoui (UdeM) Marianne Huchard (LIRMM)

3 Plan 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

4 Problem: designing & maintaining good class hierarchies Difficult problem (Booch, 1994; Rumbaugh, Blaha, Premerlani, Eddy & Lorensen, 1991) – Large solution space – Evolution – Conflicting criteria Large body of work – (Godin, Huchard, Roume & Valtchev, 2002)

5 Development scenarios Building the hierarchy from scratch using – 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 with a previous hierarchy (Rapicault & Napoli, 2001) existing objects (Huchard, 1999) Reengineering of an existing class hierarchy – 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)

6 Formal quality criteria Minimize redundancy (code duplication) – Maximal factorization Subclass as specialization Multiple inheritance only if necessary Limit number of classes Guaranteed by FCA framework

7 Using FCA for class hierarchy Initial proposal OOPSLA’93 (Godin & Mili, 1993) – Object Oriented Reorganization using GAlois lattices SysteM LIRMM : ARES incremental alg. (Dicky, Dony, Huchard & Libourel, 1994) – 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)

8 FCA framework K Context K := (G, M, I) G (objects of context) – classes – example objects – associations M (attributes of context) – instance variables (OO attributes) values – methods body/signature – association role – association properties

9 Relation gIm From analyst From code From access patterns in applications

10 Example : class attributes

11 Reduced labelling of concept lattice

12 Interpretation as class hierarchy : attribute factored lattice form

13 Minimize number of classes while preserving other quality criteria

14 Prune empty classes : FCA object/attribute concepts (Galois subhierarchy, PICH)

15 Attribute factored subhierarchy form

16 The case for empty class ?

17 Method body factored lattice/subhierarchy form

18 Declaration of method signatures Use many valued attribute for each signature + Scaling

19 Derived one-valued context

20 Concept lattice

21 Method declaration and body factored lattice/subhierarchy

22 Method redefinition By scaling

23 Method redefinition factored lattice/subhierarchy

24 Maximal factorization H is maximally factorized : if – x1 in Class1 – x2 in Class2 – x3 is least upper bound of x1 and x2 then – x3 in superclass of Class1 and Class2

25 Maximal factorization

26 Associations : value of many- valued attribute is an FCA object

27 First concept lattice : B 0

28 Relational extension K + with B 0

29 Concept lattice B 1 : association factored lattice/subhierarchy forms

30 Relational context family (RCF) General framework for set of related contexts – (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

31 Definition of Relational Context Family (RFC) Definition : Relational context family (RCF) R s = (K R, A R ) K R set of s multi-valued contexts K i = (A i, O i, V i, J i ) and set of relations A R = {  j }  j : O r  2 O q Auxiliairy functions : i. dom, cod : A R  {O i } 0 ≤ i ≤ s such that for all  j : O r  2 O q : a) dom(  j ) = O r, b) cod(  j ) = O q. ii. rel : K R  2 A R with rel ( K i ) = {  j | dom(  j ) = O i }

32 UML example Student name address College Transaction dD TransVal tV Tenant name address Renting sP mR Purchase pC pD House type Rent > 1…* * * Buy > Landlord name address

33 Context for classes : K 1 GF1 = GF2 = GF3 =GF Date =GF Value =GF4 = nameadrscolsPpDdDmRpCtVtype StudentXXX TenantXX LandlordXX House X Transaction X TransVal X Renting X XX X Purchase XX XX

34 Build concept lattice for K 1 Tenant-Landlord name address Transaction dD Renting sP mR Purchase pD pC Student College House type Rent > 1…* * * Buy > TransVal tV

35 Context for associations : K 2 name =mo =md = Nav = RentBuy1…***O-DD-O RentX XXXXX Buy XXXXXX

36 K2  K+2K2  K+2 name =mo = md = Nav =to =td =AC = RentBuy 1 …***O-DD-OTenantLandlordHouseRentingPurchase RentX XXXXXXXX Buy XXXXXXXXX

37 Discover AssG1 Renting sP mR Purchase pD pC Rent > 1…* * * Buy > 1…** AssG1 > to=Tenant td=House to=Landlord

38 K1  K+1K1  K+1 GF Date =GF Value = OrigOf =DestOf =ClOf = na m e adrsadrscol sDsD pDpD dDdDmR pCpC tVtV ty p Re nt Bu y As sG 1 Re nt Bu y As sG 1 Re nt Bu y As sG 1 Student XXX Tenant XX X X Landlord XX XX House X XXX Transacti on X TransVal X Renting X XX X X X Purchase XX XX X X

39 Discover new classes Tenant Transaction dD Renting sP mR Purchase pD pC Student College House type Rent > 1…* * * Buy > TransVal tV NC2 NC4 1…* * AssG1 > NC1 (Person) name address Landlord

40 Conclusion FCA is natural framework for design of class hierarchies FCA based normal forms for hierarchy design – Attribute, method body, method signature, redefinition, association factored lattice/hierarchy Future work – Theoretical : RFC – Tool support

41 References Booch, G. (1994). Object-Oriented Analysis and Design (2nd 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 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 Dvorak, J. (1994). Conceptual Entropy and Its Effect on Class Hierarchies. IEEE Computer, 27(6), 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 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), 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 Huchard, M., Dicky, H. & Leblanc, H. (2000). Galois lattice as a framework to specify building class hierarchies algorithms. Theoretical Informatics and Applications, n. 34, 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 Johnson, R. & Foote, B. (1988). Designing Reusable Classes. Journal of Object-Oriented Programming, June/July, Korson, T. & McGregor, J. D. (1992). Technical Criteria for the Specification and Evaluation of Object-Oriented Libraries. Software Engineering Journal, March, 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), 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 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), Snelting, G. & Tip, F. (2002). Semantics-Based Composition of Class Hierarchies. In Proceedings of the pp Tonella, P. (2001). Concept Analysis for Module Restructuring. IEEE Transactions on Software Engineering, 27(4), 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 15th International Conference on Conceptual Modeling, ER'96, B. Thalheim (Ed.), Cottbus, Germany: pp

Download ppt "Formal concept analysis based normal forms for class hierarchy design in object-oriented software development"

Similar presentations

Ads by Google