1 / 15

Encapsulation and Connascence

Encapsulation and Connascence. Encapsulation and connascence are the two fundamental properties of object-oriented systems Present in both traditional and object-oriented systems Encapsulation Structure connascence. Encapsulation. Original Meaning

Download Presentation

Encapsulation and Connascence

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. Encapsulation and Connascence • Encapsulation and connascence are the two fundamental properties of object-oriented systems • Present in both traditional and object-oriented systems • Encapsulation Structure • connascence

  2. Encapsulation • Original Meaning • grouping of related ideas into one unit • can be referred to by a single name • Existing Concept in Software Design • repeating pattern in programs • subroutine • Object-Oriented Encapsulation • packaging of operations and attributes • become an object type • access attributes only via object interface

  3. Encapsulation Structure • Subroutine • introduce encapsulation to software • encapsulate lines of code into a structure one level higher • Levels of Encapsulation • Level 0 - raw code (no encapsulation) • Level 1 - subroutine • Level 2 - object • Higher Levels - grouped classes • Concept of Classes improves reusability

  4. Encapsulation by Grouping Classes • Horizontal Group • grouping by respective subject area • comprises classes from the same domain • packages • Vertical Group • grouping by business activity • usually come from several domains • components

  5. Design Criteria for Encapsulation • Traditional Structured Design vs. Object-Oriented Design • Criteria for interacting levels • structured programming - line to line • fan-out - reference to other procedures • cohesion - connection within procedure • coupling - connection between procedures • class cohesion - connection within class • class coupling - connection between classes

  6. Structured Design Criteria

  7. O-O Design Criteria

  8. Connascence • Original meaning - born together • Interdependence, Coupling • Definition of Connascence in Software • Varieties of Connascence • Contranascence • Connascence and Encapsulation Boundaries • Connascence and Maintainability • Connascence Abuses in O-O Systems

  9. Connascence in Software • Connascence between software elements A and B • change in A requires B to be changed • A and B need to be changed together • Software element needn’t communication in order to connascent • Connascence can be directional or nondirectional

  10. Static Connascence • Applied to the code of classes • Connascence of Name • variables in procedures or in classes • Connascence of Type or Class • types in declaration • Connascence of Convention • same constraints for several elements • Connascence of Algorithm • similar to connascence of convention • Connascence of Position • sequential, adjacent, argument order

  11. Dynamic Connascence • Based on the execution pattern of the running code (objects) • Connascence of Execution • dynamic equivalent of connascence of position • Connascence of Timing • mostly in real-time systems • Connascence of Value • arithmetic constraints • Connascence of Identity • object reference

  12. Contranascence • Connascence of Difference • Negative Connascence • Mostly Contranascence of Names • Specially Important for Multiple Inheritance

  13. Connascence and Encapsulation Boundaries • Object orientation eliminates some of the connascence in traditional modular systems • Encapsulatio is a check on connascence and contranascence

  14. Connascence and Maintainability • Offers guidelines for improving system maintainability • Minimize overall connascence and contranascence => encapsulation • Minimize any remaining connascence that crosses encapsulation boundaries • Mazimize connascence within encapsulation boundaries

  15. Connascence Abuses in Object-Oriented Systems • The friend function of C++ • violate encapsulation boundaries • Unconstrained inheritance • introduce raging connascence • Relying on accidents of implementation • ex. connascence of algorithm

More Related