Last active
August 29, 2015 14:19
-
-
Save SriMaddy/4888702be2e1cece7be4 to your computer and use it in GitHub Desktop.
Practical OOD in Ruby : Addison - Wesley
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Recognize Dependency : | |
-> A class has another class | |
-> calls method in another class | |
-> Args that message(method) requires. Gear knows Wheel.new | |
requires rim and tire as well as order of Args. | |
More coupling -> More dependency | |
Tightly coupled two objects act as single entity | |
Avoid message chaining on different objects | |
If you cannot remove dependency from class just isolate them. | |
Use wrapping method to isolate external dependency. | |
Dependency have direction : By reversing direction of dependency code can be optimized. | |
_________________________________________________ | |
| Abstract Zone | Danger Zone | /|\ Dependency More | |
|______________________|________________________| | | |
| Neutral Zone | Neutral Zone | | | |
|______________________|________________________| | Dependency Less | |
Change less Change more | |
--------------------------------------------------> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment