1 / 13

Stereotype Identification

Stereotype Identification. November 27 th , 2012 Erik Fredericks. Stereotypes. Abstraction of class’ role/responsibility in a system Useful in maintenance and software evolution Can show collaboration between classes in design patterns May be used to identify both methods and classes

mala
Télécharger la présentation

Stereotype Identification

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. Stereotype Identification November 27th, 2012 Erik Fredericks

  2. Stereotypes • Abstraction of class’ role/responsibility in a system • Useful in maintenance and software evolution • Can show collaboration between classes in design patterns • May be used to identify both methods and classes • Note: authors’ work only covered C++ classes/methods

  3. General Method Stereotypes [1] • Structural • Provide or support structure of classes • Creational • Create or destroy objects • Collaborational • Characterize communication between objects • How they’re controlled within system • Degenerate • Limited structural or collaborational types

  4. Sample Metric • To identify the stereotype Accessor::Get the following conditions need to be satisfied: • method is const • returns a data member • return type is primitive or container of primitives

  5. Method • Convert source code to XML (srcML) • Convert metrics to XPath queries • Stereotype predicate • /** @stereotype predicate [searching for --^] */ • boolisValidLabel(const string& label) const; • Annotate source code with results • function[specifier='const’] • [type/name='bool'] • [descendant::return/expr/name= • descendant::decl/name • or descendant::return/expr='false' • or descendant::return/expr='true'] [not(contains(descendant::type,'*'))]

  6. Class Stereotypes [2] • Entity • Encapsulates data and behavior • Contains accessors/mutators • Minimal Entity • Only get/set methods • Trivial entities (Point) • Data Provider • Encapsulates data • Provides accessors

  7. Class Stereotypes • Commander • Encapsulates data • Consists of mutators • Typically complex object states changes • Boundary • Communication methods • Large percentage collaborational methods • Low percentage of controller and factory methods • Factory • Object creator • Mostly factory methods

  8. Class Stereotypes • Controller • Functionality or processing of external object data • Pure Controller • 100% factory or controller methods • Only works on data outside of itselfLarge Class • Contains too many responsibilities • Typically measured by LOC, number of attributes/methods • Multiple roles, highly collaborative • Lazy Class • Does too little • Contains significant number of degenerates

  9. Class Stereotypes • Degenerate • Methods don’t read/write to object state • Half or more are incidental or empty classes • Data Class • Only provides get/set methods • Passively stores data • Small Class • Only incorporates one to two methods

  10. Sample Metrics • Factory: • |factory| > (2/3) ∗ |methods| • Class is identified as a factory class if: • Amount of factory methods is larger than 2/3 * the total amount of methods • Data Provider: • Consists mostly of accessors: • |accessors| > 2 * |mutators| • and low control of other classes • |accessors| > 2 * (|controller| + |factory|)

  11. Toolsets • Conversion to XML • srcML (http://www.sdml.info/projects/srcml/) • The following do not have open-source releases, and would need to be requested should this be considered useful • Classifying method stereotypes • StereoCode • Classifying class stereotypes • StereoClass

  12. Current Plan • Transform Sumit’s annotated code into an ontology • Work from the ground up • Make use of keywords from Cybox specification • Ensure that BAE has access to necessary folders on MSU server

  13. References • [1] N. Dragan, M. L. Collard, and J. I. Maletic, "Reverse Engineering Method Stereotypes," in 22nd IEEE International Conference on Software Maintenance (ICSM'06), Philadelphia, Pennsylvania USA, 2006, pp. 24-34. • [2] Natalia Dragan, Michael L. Collard, and Jonathan I. Maletic. Automatic identification of class stereotypes. In Proceedings of the 2010 IEEE International Conference on Software Maintenance, ICSM ’10, pages 1–10, Washington, DC, USA, 2010. IEEE Computer Society.

More Related