Sunteți pe pagina 1din 51

Please, rate this session at

http://speakerrate.com/talks/5743

BEYOND THE CORE CONCEPTS OF OOP

(S.O.L.I.D.)
Claudio Lassala

CODE Training
An EPS Company codemag.com/training

About the Presenter


Claudio Lassala
claudio@eps-software.com Blog: ClaudioLassala.wordpress.com twitter.com/ClaudioLassala

C# MVP Virtual Brown Bag host International Speaker and Writer Software Developer at

EPS Software Corp


www.eps-cs.com

VirtualBrownBag.com
Free Online Meeting Every Thursday at 12pm Central Time
Tips and Tricks, Experiences, Problems, Anything Who can talk at a VBB? Anybody!
C# Patterns WPF StructureMap IronRuby Silverlight TDD VS Tips and Tricks CodeRush Resharper Extension Methods Lambdas Learning Tests Cool iPhone apps Irony (parser) Tips for newbies Ndepend xUnit VS 2010 Tips and Tricks C# 4 Dynamic Features Action/Func Android DSL Technical Debt Reactive Extensions Clean Code AutoMapper Evernote Markup Extensions Refactoring Silverlight Mercurial GIT Powershell And more

Agenda
Quick review of main OOP principals S.O.L.I.D. principles Samples of the principles applied

The Core Concepts


Abstraction
I can only focus at one thing at a time

Encapsulation
keep your privates to yourself!

Inheritance
remember the is-a relationship?

Polymorphism
objects shapeshifting around

Changes do happen!
Practically the only constant in this industry is change Changes may force us to rebuild, retest, redeploy an application

Get S.O.L.I.D., dude!


The Principles
S O SRP OCP Single Responsibility Principle Open/Closed Principle

L
I D

LSP
ISP DIP

Liskov Substitution Principle


Interface Segregation Principle Dependency Inversion Principle

Single Responsibility Principle


A class should have one, and only one, reason to change. Each responsibility is an axis of change Responsibility = a reason for change Cohesion

Single Responsibility Principle

Open/Closed Principle
Software Entities (classes, functions, modules) should be open for extension, but closed for modification. You should be able to extend a class behavior, without modifying it.

Open/Closed Principle

Liskov Substitution Principle


Derived classes must be substitutable for their base classes.

Liskov Substitution Principle

ISP - Interface Segregation Principle


Make fine grained interfaces that are client specific.

ISP - Interface Segregation Principle

Dependency Inversion Principle


Depend on abstractions, not on concretions.

Dependency Inversion Principle

Better yet: use a good IoC container! Inversion of Control

More Resources
Robert C. Martins website Los Techies DimeCasts http://virtualaltnet.com/Recordings

Questions?
Blog: ClaudioLassala.wordpress.com twitter.com/ClaudioLassala claudio@eps-software.com Check out my blog for session material
Please, rate this session at

http://speakerrate.com/talks/5743
join me at the Virtual Brown Bag, every Thursday at 12pm Central

www.VirtualBrownBag.com

S-ar putea să vă placă și