If you like this presentation – show it...
photo: djandyw.com Writing code that lasts. #ocforphp Rafael Dohms @rdohms
photo: djandyw.com Writing code you won’t hate tomorrow. #ocforphp Rafael Dohms @rdohms
Let me introduce you to someone…
No Tests. shhh.. don’t tell Grumpy. Wrote his own framework. .. and used it. Used Singletons! .. and every other anti-pattern out there. 500 line methods. … not even methods, they were functions
photo: Rob Allen (@akrabat)
REWRITE ALL THE CODE! image: hyperboleandahalf
photo: Glyn Lowe Photoworks Real Developers, SHIP STUFF.
photo: Kalexanderson How do we ﬁnd balance?
photo: CarbonNYC Code has an expiration date
photo by: massdistraction Code is perishable, it rots.
photo by: kevin dooley Code Evolves
Languages evolve. photo by: raneko
photo by: Kaptain Kobold You evolve.
photo: osbornb Complexity kills Comprehension
photo: miskan Bad Design
photo by: John 'K' NIH source: Urban dictionary
photo by: John 'K' NIH | nɒt ɪnˈventɪd hɪə | Not Invented Here —The German art of humiliating any technology, agricultural product, or (medical) scientiﬁc work that has not been invented or produced in Germany, Switzerland, or Austria. source: Urban dictionary
photo: Ian Sane The Solution™
make it easier to comprehend Improve code
make it ﬂexible make it easier to comprehend Improve code
make it ﬂexible make it tested make it easier to comprehend Improve code
make it ﬂexible make it tested make it easier to comprehend Improve code make it easier to replace, refactor
make it ﬂexible make it tested make it easier to comprehend Improve code make it not exist make it easier to replace, refactor
Testing photo by: jeffkrause
Good Design Concepts
photo by j_regan SOLID Single Responsibility Open and Close Liskov substitution Interface Segregation Dependency Inversion
photo by loﬁnk STUPID Singleton Tight Coupling Untestability Premature Optimization Indescriptive Naming Duplication
photo by halloweenstock Design Patterns
PIE Proudly Invented Elsewhere
photo by j_regan guzzlehttp/guzzle HTTP client for RESTful API clients
league/tactician A ﬂexible CommandBus implementation
Readability photo: Morgenland
photo: Trossachs Photography paragraphs
Cape Town São Paulo R&D Team for MIH/Naspers
Object Calisthenics photo by: boston_public_library
photo by: boston_public_library Calisthenics /ˌkaləsˈTHeniks/ Calisthenics are a form of dynamic exercise consisting of a variety of simple, often rhythmical, movements, generally using minimal equipment or apparatus.
Its about perception, not rules or standards photo by: david_a_l
photo by: justinliew #1 Only one indentation level per method.
photo by: justinliew #2 Do not use else
photo by: justinliew #3 Wrap primitive types, if they contain behavior
photo by: justinliew #4 Only one -> per line
photo by: justinliew #5 Do not abbreviate.
photo by: justinliew #6 Keep your classes small.
photo by: justinliew #7 Limit your instance variables to less then 5
photo by: justinliew #8 Use ﬁrst class collections
photo by: justinliew #9 Use getters and setters.
photo by: justinliew #10 Document your code.
Read lots of code!
Write simple code.
Try Object Calisthenics for a month.
Use someone else’s code.
Share bite size libraries.
http://tech.sym.bid/jobs we are hiring! Thank you. @rdohms http://doh.ms http://slides.doh.ms
Video recording Resources on Object Calisthenics Books Slides http://l.doh.ms/oc-material