You are on page 1of 69

Writing code

tha! last".
Rafael Dohms
@rdohms
photo: djandyw.com
Writing code
yo# wo$! hat% tomorrow.
Rafael Dohms
@rdohms
photo: djandyw.com
Let me
introduce
you to
someone
No Tests.
Wrote his own framework.
500 line methods.
Used Singletons!
photo: Rob Allen (@akrabat)
REWRITE
ALL THE CODE!
Real Developers,
SHIP STUFF.
photo: Glyn Lowe Photoworks
How do we nd
balance?
photo: Kalexanderson
Code has an
expiration date
photo: CarbonNYC
Code is
perishable, it rots.
photo by: massdistraction
Code Evolves
photo by: kevin dooley
Languages evolve.
photo by: raneko
You evolve.
photo by: Kaptain Kobold
Complexity
kills
Comprehension
photo: osbornb
Bad Design
photo: miskan
Bad specs
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) scientic work that has not been
invented or produced in Germany, Switzerland, or Austria.
source: Urban dictionary
photo by: John 'K'
The Solution
photo: Ian Sane
Improve code
Improve code
make it easier to comprehend
Improve code
make it easier to comprehend
make it exible
Improve code
make it easier to comprehend
make it exible
make it tested
Improve code
make it easier to comprehend
make it exible
make it tested
make it easier to replace, refactor
Improve code
make it easier to comprehend
make it exible
make it tested
make it easier to replace, refactor
make it not exist
Good Design
Concepts
SOLID
Single Responsibility
Open/close
Liskov substitution
Interface segregation
Dependency inversion
STUPID
Singleton
Tight Coupling
Untestability
Premature Optimization
Indescriptive Naming
Duplication
Composer
PIE
Proudly
Invented
Elsewhere
guzzle/guzzle
HTTP client for RESTful API clients
morrisonlevi/ardent
A library of collections for PHP
Readability
photo: Morgenland
paragraphs
photo: Trossachs Photography
whitespace
R&D Team for MIH/Naspers
So Paulo Cape Town
Object
Calisthenics
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.
photo by: boston_public_library
Its about perception,
not rules or standards
photo by: david_a_l
Sunday
12:00
Voyager Room
#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.
photo by: justinliew
Your turn.
Improve
yourself!
Read lots of
code!
Write simple
code.
Try Object Calisthenics
for a month.
Use someone
elses code.
Share bite size
libraries.
Thank you.
http://slides.doh.ms
http://doh.ms
@rdohms
http://l.doh.ms/oc-links
Video recording
Slides
Books
Resources on
Object Calisthenics

You might also like