Object orgy
From CSSEMediaWiki
(Difference between revisions)
m |
|||
Line 1: | Line 1: | ||
+ | ---- | ||
+ | <div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;"> | ||
+ | ---- | ||
+ | =[http://awuhodynaro.co.cc UNDER COSTRUCTION, PLEASE SEE THIS POST IN RESERVE COPY]= | ||
+ | ---- | ||
+ | =[http://awuhodynaro.co.cc CLICK HERE]= | ||
+ | ---- | ||
+ | </div> | ||
This anti-pattern occurs when there is insufficient encapsulation in a system and objects just access each other's internals directly rather than going through a public interface. | This anti-pattern occurs when there is insufficient encapsulation in a system and objects just access each other's internals directly rather than going through a public interface. | ||
Revision as of 11:34, 24 November 2010
This anti-pattern occurs when there is insufficient encapsulation in a system and objects just access each other's internals directly rather than going through a public interface.
Liabilities
- Harder to find bugs because any part of the system could have potentially changed the state of an object to cause a bug so it is harder to determine where the problem occurred.
- Harder to reason about the behavior of an object because any part of the system can manipulate its internals.
- If many parts of the system access the internals of an object, the result is difficult to maintain Spaghetti code.
- It is harder to change the internal workings of a class because the change can effect many other parts of the system.
- Large public interfaces can make code hard to understand and obscure the original design.
Related design heuristics
- Information hiding
- Hide data within its class
- Minimal public interface
- Coupling and cohesion
- Don't expose mutable attributes
- Encapsulate that which varies
- Minimize accesses to variables