Skip to content

Instantly share code, notes, and snippets.

@joejag
Last active December 15, 2015 17:29
Show Gist options
  • Save joejag/5296587 to your computer and use it in GitHub Desktop.
Save joejag/5296587 to your computer and use it in GitHub Desktop.
SOLID Ruby - Jim Weirich

http://confreaks.com/videos/185-rubyconf2009-solid-ruby

How do you recognise a good design? Use telephone interview question. (picture of a tap near a plug socket) Buring of London - recreation was agile. Through out designs by Wren and built incrementally.

SOLID. Bob wanted priciples for design. So we can objectively judge code. All about dependencies. To build maintainable code you have to manage dependencies. Engine doesn't know about a Car. Car depends on Vehicle though inheritance.

Why is this important? If I change X which has links to 5 other classes. Deps tell you who's affected by a change. A lot of pressure to not change X. invert the dep. J -> k -> L on what can be affected by change. How can we manage this?

dynamic vs static

Bob was mainly dealing with statically typed languages. Static languages have stronger dependencies than dynamic.

SRP

Class you only have one reason to change (based off responsibilities). Splitting things up gives you a lot more flexibility to compose your code. Even important in ruby. Easy way to tell if SRP, ask if it says AND/OR.

Open Closed Principle

VIDEO DIED!!!

You should be able to extend a class's behaviour, without modifying it (bertrand myer - effiel)

http://www.youtube.com/watch?v=FR95rp-9Oo4

How confident are you in teh code that your write? Want to deploy to prod now? How you going to sleep?

Books that changed how I develop: XP, Refacotoring, Writing Solid Code, OO Software construction, Software tools.

Cool feature in Eifell: Design by contract.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment