• Save
SOLID Design Principles
Upcoming SlideShare
Loading in...5
×
 

SOLID Design Principles

on

  • 4,160 views

 

Statistics

Views

Total Views
4,160
Views on SlideShare
1,621
Embed Views
2,539

Actions

Likes
4
Downloads
0
Comments
0

5 Embeds 2,539

http://quickleft.com 2531
http://translate.googleusercontent.com 4
https://www.google.com 2
http://www.quickleft.com 1
http://webcache.googleusercontent.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

SOLID Design Principles SOLID Design Principles Presentation Transcript

  • SOLID Design Principles
  • What the heck is a principle?
  • What the heck is a principle?Guideline for creating softwarethat stands up well to iterativedevelopment
  • What the heck is a principle?Guideline for creating softwarethat stands up well to iterativedevelopmentStatements that can be madeabout your code’s design
  • What the heck is a principle?Guideline for creating softwarethat stands up well to iterativedevelopmentStatements that can be madeabout your code’s designFSM avoidance
  • Why should I care?
  • Why should I care?Uncle Bob Martin
  • Why should I care?Uncle Bob Martin - Old Dude
  • Why should I care?Uncle Bob Martin - Old Dude - Wrote tons of books
  • Why should I care?Uncle Bob Martin - Old Dude - Wrote tons of books - Knows a thing or two about writing software
  • Why should I care?Uncle Bob Martin - Old Dude - Wrote tons of books - Knows a thing or two about writing softwareThese things will make youbetter codes
  • Why should I care?Uncle Bob Martin - Old Dude - Wrote tons of books - Knows a thing or two about writing softwareThese things will make youbetter codes50% less Y U NO!!!
  • Principles vs. Patterns
  • Principles vs. PatternsAren’t patterns enough?
  • Principles vs. PatternsAren’t patterns enough?Who are you?
  • Principles vs. PatternsAren’t patterns enough?Who are you?SOLID Principles are the basisfor useful patterns
  • S.O.L.I.D.
  • S. Single ResponsibilityO.L.I.D.
  • S. Single ResponsibilityO. Open / ClosedL.I.D.
  • S. Single ResponsibilityO. Open / ClosedL. Liskov SubstitutionI.D.
  • S. Single ResponsibilityO. Open / ClosedL. Liskov SubstitutionI. Interface SegregationD.
  • S. Single ResponsibilityO. Open / ClosedL. Liskov SubstitutionI. Interface SegregationD. Dependency Inversion
  • Single Responsibility Principle
  • Single Responsibility Principlean Object should only have one“axis of change”
  • Single Responsibility Principlean Object should only have one“axis of change”as software requirements shift,refactoring is reflected throughchanges of responsibility in yourcode
  • Single Responsibility Principlean Object should only have one“axis of change”as software requirements shift,refactoring is reflected throughchanges of responsibility in yourcodecomplex code only gets morecomplex
  • Single Responsibility Principle
  • Single Responsibility Principleanti-pattern: watch out forlarge branching statements
  • Single Responsibility Principleanti-pattern: watch out forlarge branching statementsfavor method simplicity
  • Single Responsibility Principleanti-pattern: watch out forlarge branching statementsfavor method simplicityshould be apparent when practicingTDD
  • Open/Closed Principle
  • Open/Closed Principle“[objects] should be open forextension, but closed formodification”
  • Open/Closed Principle“[objects] should be open forextension, but closed formodification”makes code that’s more resilientover time
  • Open/Closed Principle“[objects] should be open forextension, but closed formodification”makes code that’s more resilientover timevery important for maintaininglarge, production codebases
  • Open/Closed Principle
  • Open/Closed Principleanti-pattern: modifying nativePrototypes in Javascript
  • Open/Closed Principleanti-pattern: modifying nativePrototypes in Javascriptused and violated in Backbone.js
  • Open/Closed Principleanti-pattern: modifying nativePrototypes in Javascriptused and violated in Backbone.jstest coverage alleviates some ofthe pain that open/close want toshield you from
  • Liskov Substitution
  • Liskov Substitutionderived types should becompletely substitutable fromtheir base types
  • Liskov Substitutionderived types should becompletely substitutable fromtheir base typesabout preserving expectations whencreating classes and subclasses
  • Liskov Substitutionderived types should becompletely substitutable fromtheir base typesabout preserving expectations whencreating classes and subclassesOften this is a built inlanguage feature
  • Interface Segregation
  • Interface Segregationfavor many specific interfacesover a single, “fat” interface
  • Interface Segregationfavor many specific interfacesover a single, “fat” interfacean api should only contains themethods its caller needs
  • Interface Segregationfavor many specific interfacesover a single, “fat” interfacean api should only contains themethods its caller needsleading cause of FSM, tightlycoupled code
  • Interface Segregation
  • Interface SegregationjQuery is written as a series ofseparate interfaces with acommon core
  • Interface SegregationjQuery is written as a series ofseparate interfaces with acommon coreincreases performance, sanity
  • Interface SegregationjQuery is written as a series ofseparate interfaces with acommon coreincreases performance, sanity“no client should be forced todepend on code it does not use”
  • Interface SegregationjQuery is written as a series ofseparate interfaces with acommon coreincreases performance, sanity“no client should be forced todepend on code it does not use”another consequence of TDD
  • Dependency Inversion
  • Dependency Inversion“depend on abstractions, not onconcretions.”
  • Dependency Inversion“depend on abstractions, not onconcretions.”create high-level software that isdecoupled from low-level softwarethrough abstraction
  • Dependency Inversion“depend on abstractions, not onconcretions.”create high-level software that isdecoupled from low-level softwarethrough abstractionallows for saner, more flexibleresources
  • Dependency Inversion
  • Dependency InversionActiveRecord allows Rails toabstract database interface awayfrom users
  • Dependency InversionActiveRecord allows Rails toabstract database interface awayfrom usersSizzle, $.ajax allows jQuery toabstract low level DOM methods
  • What does it mean?
  • What does it mean?You don’t create re-usable codeby accident.
  • What does it mean?You don’t create re-usable codeby accident.You experience these principlesevery day
  • What does it mean?You don’t create re-usable codeby accident.You experience these principlesevery dayCreates a good checklist of“objective refactoring” statements
  • S. Single ResponsibilityO. Open / ClosedL. Liskov SubstitutionI. Interface SegregationD. Dependency Inversion