1 / 27

Towards a Unified Framework for Measuring the Properties of Class Diagrams Augmented with OCL

Towards a Unified Framework for Measuring the Properties of Class Diagrams Augmented with OCL. By: Eng. Mohamed Awad Elshaarawy Supervisors: Prof. Dr. Ismail Taha, Dr. Haitham S.Hamza Date: 8 th Jul, 2013. Introduction Related Work Motivation Thesis Contribution Proposed Model

dennis
Download Presentation

Towards a Unified Framework for Measuring the Properties of Class Diagrams Augmented with OCL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Towards a Unified Framework for Measuring the Properties of Class Diagrams Augmented with OCL By: Eng. Mohamed AwadElshaarawy Supervisors: Prof. Dr. Ismail Taha, Dr. Haitham S.Hamza Date: 8th Jul, 2013

  2. Introduction • Related Work • Motivation • Thesis Contribution • Proposed Model • Controlled Experiments and Results • Conclusion & Future Work

  3. Introduction Class Diagram In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram that describes the structure of a system by showing the system's classes, their attributes, operations (or methods), and the relationships among the classes

  4. Introduction OCL Object Constraint Language In order to write clear, understandable and standardized constraints, OCL have been developed OCL is a formal, modeling, typed and pure expression language used to specify (invariants, pre-and post conditions on operations and methods and as navigation language Formal language for the definition of constraints and queries on UML models Declarative to add precise semantics 1 2 3 4 contextCustomerCard invariant correctDates:validFrom.isBefore(goodThru) isBefore(Date):Boolean is a Date operation. contextCustomerCard invariant: owner.age() >= 18 contextCustomerCard invariant printedName: printedName = owner.title.concat(‘ ‘).concat(owner.name) contextMembership

  5. 3 4 5 Related Work Class Diagram Metrics Brief Chidamber and Kemerer proposed six metrics for the measurement of OO systems. Only three of the six CK metrics are available for a UML class diagram 1 Chidamber & Kemerer 2 Li & Henry Li and Henry defined metrics that tend to measure different internal attributes such as coupling, complexity and size Brito proposed MOOD metrics to measure the use of OO design mechanisms such as inheritance, information hiding, and polymorphism Brito Lorenz & Kidd’s Lorenz and Kidd’s proposed Class size metrics, Class inheritance metrics and Class’ internals metrics Briand et al provided metrics which could distinguish the relationship between classes’ different type of interactions, and the locus of impact of the interaction Briand Marchesi Proposed three categories of metrics: those related to single classes, those related to packages and those related to the system as a whole 6 Marchesi

  6. 9 10 Related Work Class Diagram Metrics Brief 7 Harrison Harrison et al. defined metric to measure the inter-class coupling Bansiya and Davis defined metrics for assessing design properties such as encapsulation, coupling, cohesion, composition and inheritance 8 Bansiya & Davis Genero defined metrics to measure class diagram complexity, due to the use of different kinds of relationships, such as associations, generalizations, aggregations and dependencies, in relation with their impact on external quality attributes such as class diagram maintainability Genero Zhou only used one indicator, namely entropy distance based structure complexity metric, to evaluate the complexity of class diagrams Zhou 11 Reynosa, Genero &Piattini Reynosa, Genero &Piattini defined a metric suite for measuring structural properties of OCL expressions Cabot and Teniente presented a new metric to measure the complexity of OCL expressions 12 Cabot & Teniente

  7. Related Work OCL Metrics Brief 1 Reynosa, Genero &Piattini Reynosa, Genero &Piattini defined a metric suite for measuring structural properties of OCL expressions Cabot and Teniente presented a new metric to measure the complexity of OCL expressions 2 Cabot & Teniente

  8. Motivation & Objectives Motivation Objectives • Lack of an integrated metrics suites that consider class diagrams with its OCL expressions as a one chunk. • An integrated framework has been presented to assess the structural properties of the class diagram made using the unified modeling language (UML) with considering the added complexity involved when a class diagram is augmented with expressions written in (OCL) • Answering the question of whether using OCL is in the benefit and not only the efficiency of the work but also the effectiveness‘ of it. • A controlled experiment’s results analysis has been provided answering this common question. propose a unified framework contains a set of “Integrated” metrics, a set of new class diagram metrics, a set of new OCL metrics in additions to the well-known class diagram and OCL metrics that have been selected for their extensively use, relevant scope and validity presents the results of a controlled experiment that investigates the impact of using OCL on class diagram comprehension and maintainability provide the theoretical and empirical validation for the proposed metrics 1 1 2 2 3

  9. Proposed Model Brief • The structural properties will be measured are: size, length and coupling. And, the scopes of measures are: class diagram, OCL expressions and class diagram augmented with OCL (integrated metrics) • So, the proposed metrics structured as follows: three metrics suites size measurement metrics suite, length measurement metrics suite and coupling measurement metrics suite). Each suite consists of class diagram scope, OCL expressions scope and integrated class diagram _OCL metrics

  10. Size Measurement Metric Suite Class Diagram Size Scope Metrics The selected well known (existing literature) metrics are : CdNC(Class diagram number of classes), CdNM(Class diagram number of methods), CdNAss(Class diagram number of association relationships) for uni directional and bi directional association, CdNAgg( Class diagram no. of aggregation relationships), CdNDep(Class diagram number of dependency relationships), CdNGen(Class diagram number of generalization relationships), CdNGenH(Class diagram number of generalization hierarchies ), CdNAggH(Class diagram number of aggregation hierarchies) The proposed metrics are: CdNA(Class diagram number of attributes), CdNR(Class diagram no. of relations) it can be calculated by: CdNR =CdNAss+ CdNAgg+ CdNDep+ CdNGen+ CdNGenH+ CdNAggH

  11. Size Measurement Metric Suite OCL Expressions Size Scope Metrics OcNoBj(the no. of objects in Bexp where Bexp is the bag of objects accessed during the evaluation of an expression), OcWNM(OCL expressions Weighted No. of Messages), OcWNN(OCL expressions Weighted No. of Navigations) OcNL(OCL expressionsNo. of Lines),OcNC(OCL expressions No. of constraints),OcNI(OCL expressions No. of Invariants),OcNO(OCL expressions No. of Operations) Including operations Boolean type, operations on integer and real types, operations on string types, operations on collection types and query operation, OcNCond(OCL expressions No. of pre and post Conditions), OcNV(OCL expressions No. of Variables defined through <<Definition>> constraints included number of variables defined by Let expressions in an expression), OcNaA(OCL expressions No. of accessed class diagram attributes),OcNaM(OCL expressions No. of accessed class diagram Methods), OcNaR(OCL expressions No. of accessed class diagram Relations), OcNaC(OCL expressions No. of accessed classes)

  12. Size Measurement Metric Suite Integrated Size Scope Metrics Classes' Density: The ratio of (total no. of accessed classes in OCL expressions /total no. of classes within class diagram= OcNaC/CdNC) this represents the extra complexity added to CdNC due to using OCL Attributes' Density:The ratio of (total no. of accessed attributes In OCL expressions /total no. of attributes within class diagram= OcNaA/CdNA) this represents the extra complexity added to CdNA due to using OCL Methods’ Density: The ratio of (total no. of accessed method. In OCL expressions /total no. of methods within class diagram= OcNaM/CdNM) this represent the extra complexity added to CdNM (no. of methods) due to using OCL Relations' Density: The ratio of (total no. of accessed relations In OCL expressions /total no. of relations within class diagram=OcNaR/CdNR) this represents the extra complexity added to CdNR due to using OCL

  13. Size Measurement Metric Suite Theoretical validation Following the property based framework of Briand, it has been assured that all of the size metrics suite fulfill all of the following axioms that characterize size metrics: PropertySize.1 (Non-negativity): This property is directly proven because it is impossible to obtain a negative value for all of the size metrics suites PropertySize.2 (Null value): Any system from the above described three systems have no elements will lead to its related metrics =0 PropertySize.3 (Module Additivity): This property is directly proven because the size of a system is equal to the sum of the sizes of its modules

  14. Length Measurement Metric Suite These metrics were grouped into: class diagram length scope metrics, OCL expressions length scope metrics and class diagram augmented with OCL length scope metrics. Class Diagram Length Scope Metrics: CdMaxDIT(The maximum between the Depth of Inheritance DIT values obtained for each class of the class diagram, The DIT value for a class within a generalization hierarchy is the length of the longest path from the class to the root of the hierarchy) ,CdMaxHAgg(The maximum between the Hierarchical Aggregation (HAgg) values obtained for each class of the class diagram ,The HAgg value for a class within an aggregation hierarchy is the length of the longest path from the class to the leaves)Units. OCL Expressions Length Scope Metrics: OcDN: Depth of Navigations (DN) is the maximum depth of the navigation tree Max Depth: the added length to the longest path from the class to others related classes in the class diagram due to navigation tree build after using OCL Class Diagram & OCL Length Scope Metrics

  15. Length Measurement Metric Suite Theoretical Validation Following the property based framework of Briand, it has been assured that all of the length metrics suite fulfill all of the following axioms that characterize length metrics: • PropertyLength.1 (Nonnegativity) and Null Value are straightforwardly satisfied, the depth of a tree can never be negative, and an expression without navigation has an empty tree. • PropertyLength.2 (Nonincreasingmonotonocity) for connected components: If we add relationships between elements of a tree (classes or interfaces) the depth of the tree does not vary. • PropertyLength.3 (Nondecreasingmonotonocity) for non- connected components: Adding a relationship to two unconnected components (two trees) makes them connected, and its length is not less than the length of the two unconnected components. • PropertyLength.4 (Disjoint modules): The depth of a tree is given by the component that has more levels from the root to the leaves.

  16. Coupling Measurement Metric Suite Class Diagram Coupling Scope Metrics These metrics were grouped into: class diagram coupling scope metrics, OCL expressions coupling scope metrics and class diagram augmented with OCL coupling scope metrics. (Integrated metrics) Class Diagram Coupling Scope Metrics: CdNPCAIC(Number of coupling relationship to Parent classes if there is a Class-attribute interaction between classes of Import coupling type) , CdNOCAIC(Number of coupling relationship to other classes if there is a Class-attribute interaction between classes of Import coupling type ), CdNDCAEC(Number of coupling relationship to descendant classes if there is a Class-attribute interaction between classes of Export coupling type), CdNOCAEC(Number of coupling relationship to other classes if there is a Class-attribute interaction between classes of Export coupling type), CdNPCMIC(Number of coupling relationship to parent classes if there is a Class-Method interaction between classes of Import coupling type ),CdNOCMIC(Number of coupling relationship to other classes if there is a Class-Method interaction between classes of Import coupling type ) CdNDCMEC(Number of coupling relationship to descendant classes if there is a Class-Method interaction between classes of Export coupling type,CdNOCMEC(Number of coupling relationship to other classes if there is a Class-Method interaction between classes of Export coupling type)

  17. Coupling Measurement Metric Suite OCL Expressions Coupling Scope Metrics OcNPT(The OCL expressions Number of Parameters whose types are classes defined in the class diagram), OcNAN(The OCL expressions Number of attributes referred through navigations in an expression, OcWNM(OCL expressions Weighted No. of Messages), OcWNO(The OCL expressions Weighted Number of referred Operations through navigations)

  18. Coupling Measurement Metric Suite Integrated Coupling Scope Metrics • Classes Fan-In: The extra number of classes due to using OCL expressions that use a specific class above the classes that originally use this specific class in the class diagram • Methods Fan-In: The extra number of Methods due to using OCL expressions that use a specific method in OCL operations above the methods that originally use this specific method in the class diagram • Messages Fan-In: The extra number of messages due to using OCL expressions that use a specific message above the messages that originally use this specific message in the class diagram • Classes Fan-Out: The extra number of classes due to using OCL expressions that a specific class calls above the number of classes that originally have been called by this class in the class diagram • Methods Fan-Out: The extra number of methods due to using OCL expressions that a specific method calls above the number of methods that originally have been called by this method in the class diagram • Attributes Fan-Out: The extra number of Attributes due to using OCL expressions (let and call expressions) that a specific method calls above the number of attributes that originally have been called by this Method in the class diagram

  19. Coupling Measurement Metric Suite Theoretical Validation Following the property based framework of Briand, it has been assured that all of the coupling metrics suite fulfill all of the following axioms that characterize coupling metrics: • PropertyCoupling.1 (Non-negativity): Is directly proven, and it is impossible to obtain a negative value for all of stated metrics • PropertyCoupling.2 (Monotonicity): Is directly verified, adding import interactions - in this case, DU-interactions (interaction from Data declaration to data Used in an OCL expression) • PropertyCoupling.3 (Merging Modules): This property can be expressed for our context in the following way: “the sum of the import coupling of two modules is no less than the coupling of the module which is composed of the data used of the two modules”. The value of metrics for an expression which consists of the union of two original expressions, is equal to the metrics of each expression merged when the sets of classes, methods, attributes and messages referred to in each original expression are disjointed, otherwise is less than metrics of each merged expression

  20. Controlled Experiment Experiments Planning Definition The purpose of this experiment is to analyze UML class diagrams with its OCL expressions proposed framework metrics and to evaluate the metrics results with the subjects’ ratings results indicating the impact of using OCL, combined with UML class diagrams on the understandability and maintainability degree. Context & Material Selection The context of the experiment is a group related to the area of Software Engineering in different seniority levels. They were grouped into 4 groups (8 subjects per group) and each subject worked individually on each of the two systems, using class diagram+OCL in one case and only class diagram in the other. Two comparable, in terms of complexity and size, class diagrams with their OCL expressions representing (Royal& Loyal system and Hotel management system) are used.

  21. Controlled Experiment Hypothesis Formulation • The impact of using OCL will be assessed on two dependent variables: Understandability (U) and Maintainability (M) were measured according to the subjects’ ratings (of the experiment’s designed questionnaires) targets the system logic(U), and the ability of subjects to correctly specify the affected system elements due to changes in requirements(M). The other dependent variable is Maintenance time which is comprises the time to comprehend the class diagram, analyze the required changes and to implement them. • The null hypothesis (H0): There is no significant correlation between the framework metrics and the above variables • The alternative hypothesis (Ha): There is a significant correlation between the framework metrics and the above variables

  22. Controlled Experiment Instrumentation: • Besides the class diagrams with its OCL expressions separate documents, other forms were used like a survey questionnaire was distributed to obtain information about the subjects’ background. After the completion of both Understandability and Maintenance tasks, forms were distributed that contains specific questions about the system. Maintenance questions address the Maintainability variable • All of the questions were covered different parts of the system, feasible to answer but not trivial and could be answered with or without OCL. • In addition, another after-lab questionnaire was distributed with questions addresses the selected variables.Those questions were answered on a Likert scale from 1 (Strongly agree) to 5 (Strongly disagree) Execution and Data Validation: • The operations were done successfully and all the data have been collected including subjects’ answers obtained from the responses of the experiment and the metrics value

  23. Controlled Experiment Spearman's correlation between the metrics and Understandability and Maintainability we can conclude that there is a significant correlation between the proposed integrated class diagram & OCL structural complexity metrics and subject’s rating

  24. Controlled Experiment II Null hypothesis, H0: There is no significant correlation between structural complexity metrics and maintenance time Alternative hypothesis, H1 : There is a significant correlation between structural complexity metrics and maintenance time By calculating the mean of the maintenance time |It’s concluded that there is a significant correlation between all the metrics and the maintenance time

  25. Conclusion • This thesis shows how we defined a metric suite for measuring the overall Structural Properties of a class diagram augmented with OCL • Also, it shows the best way from our point of view to measure the Structural Properties of a class diagram and the OCL expressions individually • We validated our framework theoretically by using the property-based framework of Briand et al. and classified it to size, length and interaction-based metrics for coupling • A controlled experiment was done to validate the proposed framework empirically and shows that there are correlations between the metrics and their tested variables. And also shows that OCL, as a constraint language complementary to UML class diagrams, is useful in helping understand system models facilitate change and understanding • Obviously that the benefits of using OCL may only be observed if subjects have sufficient training and/or obtained sufficient experience in UML class diagrams and OCL The extension of the proposed work to cover other UML diagrams is very important to make a unified framework for measuring the overall structural properties of UML diagrams which augmented with OCL

  26. Future Work The extension of the proposed work to cover other UML diagrams is very important to make a unified framework for measuring the overall structural properties of UML diagrams which augmented with OCL

  27. Q&A

More Related