Click here to load reader
Upload
deon-meyer
View
114
Download
1
Embed Size (px)
Citation preview
CODE LIKE A NINJATHE DEPENDENCY INVERSION PRINCIPLE
SESSION RESOURCES
• Presentation session notes including link to this session, will be available on http://learningaboutfudge.blogspot.com
• All the source for this session is publically available at: https://github.com/SheepWorx/Training
• RSS Feed: http://learningaboutfudge.blogspot.com/feeds/posts/default?alt=rss
• Local Network: \\dmeyer-m\share\training\Code Like a Ninja
• Source was compiled using Visual Studio 2012
Single Responsibility PrincipleOpen/Close PrincipleLiskov’s Substitution PrincipleInterface Segregation PrincipleDependency Inversion Principle
DEFINITION
The Dependency Inversion Principle
High level modules should not depend upon low level modules. Both should depend upon abstractions
Abstractions should not depend upon details. Details should depend upon abstractions
WHY?
• DIP is used to alleviate badly designed code that is code that is
• Rigid, fragile and immobile
• DIP’s primary focus is to decouple tightly coupled classes
CODE
• We already covered this in the OCP code samples- revisit them again for this session
SESSION RESOURCES
• Presentation session notes including link to this session, will be available on http://learningaboutfudge.blogspot.com
• All the source for this session is publically available at: https://github.com/SheepWorx/Training
• RSS Feed: http://learningaboutfudge.blogspot.com/feeds/posts/default?alt=rss
• Local Network: \\dmeyer-m\share\training\Code Like a Ninja
• Source was compiled using Visual Studio 2012