1 / 15

Domain, Encumbrance, and Cohesion

Understand the domains of object classes - from foundation to application, business, and architecture. Explore class encumbrance and cohesion, measuring sophistication and interrelationships. Learn about low, medium, and high reusability across different industries and computer architectures. Discover the Law of Demeter and class cohesion concepts to enhance design quality.

rcerda
Download Presentation

Domain, Encumbrance, and Cohesion

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. Domain, Encumbrance, and Cohesion • Domains of Object Classes • application domain • business domain • architecture domain • foundation domain • Encumbrance • Class Cohesion

  2. Foundation Domain • Classes used in different applications from different industries on different computer architectures • Classes of highest reusability • A foundation class may be built upon other foundation classes • Fundamental Classes - primitive types • Structural Classes - implementation of data structures • Semantic Classes - used conventionally

  3. Architecture Domain • Usable in different applications from different industries • Reusability is limited to a single computer (hardware & software) architecture • Machine-Communication Classes • Database-Manipulation Classes • Human-Interface Classes

  4. Business Domain • Useful in different applications within a single industry • Reusability may even limited to one corporation • Attribute Classes - properties of things • Role Classes - roles played in business • Relationship Classes - associations among things

  5. Application Domain • Used only within a single application • Lowest reusability • Event-Recognizer Classes • event daemons • monitor input to check for occurrence of specific events in the environment • Event-Manager Classes • carry out business policy when an event of a given type occurs

  6. Domains of Classes and Reusability Low Reusability • Application Domain • event manager classes • event recognizer classes • Business Domain • relationship classes • role classes • attribute classes • Architecture Domain • machine communication classes • database manipulation classes • human interface classes • Foundation Domain • semantic classes • structural classes • fundamental classes Medium Reusability High Reusability

  7. Encumbrance • Quantitative Measure of Class Sophistication • Definition of Encumbrance in Object-Oriented Systems • Use of Encumbrance • Law of Demeter

  8. Class Reference • Direct Class-Reference Set - the set of classes referred directly by a class (class C refer directly to D if:) • C inherits from D • C has an attribute of class D • C has an operation with an input argument of class D • C has a method that sends a message with a returned argument of class D • C has a method containing a local variable of class D • C supplies D as an actual class parameter to a parameterize class • C has a friend class D (in C++ only) • Indirect Class-Reference Set - union of direct class-reference sets

  9. Definition of Encumbrance • Measures the total ancillary machinery of a class • comprises all the other classes that the given class must rely on in order to work • total number of classes referred (both directly and indirectly) to by the given class • Direct Encumbrance • size of its direct class-reference set • Indirect Encumbrance • size of its indirect class-reference set • Used to indicate class coupling

  10. Use of Encumbrance • Measure of class sophistication • Higher domains have higher encumbrance • Unexpected encumbrance may indicate a fault in class design • low domain with high encumbrance => may have a problem with class cohesion • high domain with low encumbrance => lack of reusability

  11. Law of Demeter • Guiding principle for limiting direct encumbrance of a class • Limitation of message receivers: • the object itself • an object referred to by a method signature • an object referred to by a variable (attribute) • current class only • current class plus inherited classes • an object created by a method • an object referred to by a global variable

  12. Class Cohesion • Measure of interrelationship of attributes and operations located in the external interface of a class • Observe from outside instead of inside of the class • Three major cohesion problems • mixed instance • mixed domain • mixed role • A class may have more than one cohesion problem

  13. Mixed-Instance Cohesion • A class has some features (attributes or operations) that are undefined for some objects of the class • Design problem of type definition • Usually involve redesign of the inheritance hierarchy

  14. Mixed-Domain Cohesion • A class contains an element that directly encumbers the class with an extrinsic class of a different domain • Class B is extrinsic to A if A can be fully defined with no notion of B • Class B is intrinsic to A if B captures some characteristic inherent to A • Always include classes from lower domains because of intrinsic properties of the class

  15. Mixed-Role Cohesion • A class contains an element that directly encumbers the class with an extrinsic class of the same domain • Depend on the basic definition (original representation) of the class • Least serious cohesion problem • may reduce reusability

More Related