SlideShare a Scribd company logo
Writing code
that lasts.
Rafael Dohms

@rdohms
photo: djandyw.com
#ocforphp
Writing code 

you won’t hate tomorrow.
Rafael Dohms

@rdohms
photo: djandyw.com
#ocforphp
Let me
introduce
you to
someone…
“Writing code that lasts” … or writing code you won’t hate tomorrow.
“Writing code that lasts” … or writing code you won’t hate tomorrow.
No Tests.
Wrote his own framework.
500 line methods.
Used Singletons!
shhh.. don’t tell Grumpy.
.. and used it.
.. and every other anti-pattern out there.
… not even methods, they were functions
photo: Rob Allen (@akrabat)
“Writing code that lasts” … or writing code you won’t hate tomorrow.
REWRITE
ALL THE CODE!
image: hyperboleandahalf
Real Developers,
SHIP STUFF.
photo: Glyn Lowe Photoworks
“Writing code that lasts” … or writing code you won’t hate tomorrow.
“Writing code that lasts” … or writing code you won’t hate tomorrow.
“Writing code that lasts” … or writing code you won’t hate tomorrow.
How do we find
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) scientific 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 flexible
Improve code
make it easier to comprehend
make it flexible
make it tested
Improve code
make it easier to comprehend
make it flexible
make it tested
make it easier to replace, refactor
Improve code
make it easier to comprehend
make it flexible
make it tested
make it easier to replace, refactor
make it not exist
Testing
photo by: jeffkrause
Good Design
Concepts
SOLID
Single Responsibility

Open and Close

Liskov substitution

Interface Segregation

Dependency Inversion
photo by j_regan
photo by lofink
STUPID
Singleton

Tight Coupling

Untestability

Premature Optimization

Indescriptive Naming

Duplication
Design Patterns
photo by halloweenstock
Composer
PIE
Proudly

Invented

Elsewhere
guzzlehttp/guzzle
HTTP client for RESTful API clients
photo by j_regan
league/tactician
A flexible CommandBus implementation
Readability
photo: Morgenland
paragraphs
photo: Trossachs Photography
whitespace
“Writing code that lasts” … or writing code you won’t hate tomorrow.
R&D Team for MIH/Naspers
São PauloCape 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
#1
Only one
indentation level
per method.
photo by: justinliew
#2
Do not 

use else
photo by: justinliew
“Writing code that lasts” … or writing code you won’t hate tomorrow.
“Writing code that lasts” … or writing code you won’t hate tomorrow.
“Writing code that lasts” … or writing code you won’t hate tomorrow.
#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 first 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
else’s code.
Share bite size
libraries.
Thank you.
http://slides.doh.ms
http://doh.ms
@rdohms
we are hiring!
http://tech.sym.bid/jobs
http://l.doh.ms/oc-material
Video recording
Slides
Books
Resources on 

Object Calisthenics

More Related Content

PPTX
PITCH DECK.pptx
PDF
PDF
Going Horizontal: The path to better organizations and a better society - Sam...
PDF
Freelancing industry growth and some successful models in different countries
PDF
Impact of Poor Basic Skills: The Employer Perspective
PPTX
Basics of Web Accessibility
PPTX
ArchitectNow - Migrating Legacy .NET Apps to Azure
PDF
UX Fundamentals for Beginners
PITCH DECK.pptx
Going Horizontal: The path to better organizations and a better society - Sam...
Freelancing industry growth and some successful models in different countries
Impact of Poor Basic Skills: The Employer Perspective
Basics of Web Accessibility
ArchitectNow - Migrating Legacy .NET Apps to Azure
UX Fundamentals for Beginners

What's hot (19)

PPTX
chatgpt dalle.pptx
PDF
Serverless ddd
PPT
Selling To The C-Suite
PDF
Advanced Content Workflow Using GitHub and Markdown
PDF
Design System & Atomic Design
PPTX
User interface design: definitions, processes and principles
PDF
Selling Your Great Idea
PPTX
Usability Testing Report Template
PDF
Adapting JIRA For Scrum
PPTX
Freelancing presentation PowerPoint slides
PDF
What is UX, in 10 Slides
PPTX
The Design of Everyday Things
PPTX
What is portfolio website design | Why Need Portfolio
PPTX
What is Freelancing?
PDF
Ble android
PDF
How To Become... LORD OF THE SLIDES
PDF
UI/UX Courses
PPTX
Building a Case Management Application
PPTX
Different Roles in Machine Learning Career
chatgpt dalle.pptx
Serverless ddd
Selling To The C-Suite
Advanced Content Workflow Using GitHub and Markdown
Design System & Atomic Design
User interface design: definitions, processes and principles
Selling Your Great Idea
Usability Testing Report Template
Adapting JIRA For Scrum
Freelancing presentation PowerPoint slides
What is UX, in 10 Slides
The Design of Everyday Things
What is portfolio website design | Why Need Portfolio
What is Freelancing?
Ble android
How To Become... LORD OF THE SLIDES
UI/UX Courses
Building a Case Management Application
Different Roles in Machine Learning Career
Ad

Viewers also liked (20)

PDF
Startup Technology: Cheatsheet for Non-Techies
PDF
Five Tips To Help You Tackle Programming
PDF
Build Features, Not Apps
PDF
Sass Code Reviews - How one code review changed my life #SassConf2015
PDF
Visualising Data with Code
PPT
Introduction to Go programming
PDF
Montreal Girl Geeks: Building the Modern Web
PDF
GDGSCL - Docker a jeho provoz v Heroku a AWS
PDF
Keeping software development ecosystem healthy
PDF
Agile Product Management
PDF
Migration from Swing to JavaFX
PDF
Protocol-Oriented MVVM
PDF
QA in Agile World
PPTX
How to Make Great Software Estimates
PDF
Bridging the Gap Between Data Science & Engineer: Building High-Performance T...
PDF
Testing at Spotify
PDF
Introduction to Development for the Internet
PDF
Study: The Future of VR, AR and Self-Driving Cars
PDF
Hype vs. Reality: The AI Explainer
PDF
TEDx Manchester: AI & The Future of Work
Startup Technology: Cheatsheet for Non-Techies
Five Tips To Help You Tackle Programming
Build Features, Not Apps
Sass Code Reviews - How one code review changed my life #SassConf2015
Visualising Data with Code
Introduction to Go programming
Montreal Girl Geeks: Building the Modern Web
GDGSCL - Docker a jeho provoz v Heroku a AWS
Keeping software development ecosystem healthy
Agile Product Management
Migration from Swing to JavaFX
Protocol-Oriented MVVM
QA in Agile World
How to Make Great Software Estimates
Bridging the Gap Between Data Science & Engineer: Building High-Performance T...
Testing at Spotify
Introduction to Development for the Internet
Study: The Future of VR, AR and Self-Driving Cars
Hype vs. Reality: The AI Explainer
TEDx Manchester: AI & The Future of Work
Ad

Similar to “Writing code that lasts” … or writing code you won’t hate tomorrow. (20)

PDF
Writing code you won't hate tomorrow
PDF
“Writing code that lasts” … or writing code you won’t hate tomorrow.
PDF
Writing code you won't hate tomorrow
PDF
“Writing code that lasts” … or writing code you won’t hate tomorrow.
PDF
“Writing code that lasts” … or writing code you won’t hate tomorrow.
PDF
“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16
PDF
Writing code that lasts - JAB14
PDF
Writing Code That Lasts - #Magento2Seminar, Utrecht
PDF
Clean Code V2
PPTX
A sweet taste of clean code and software design
PDF
Test Driven Design - GDG DevFest Istanbul 2016
PDF
Test Driven Design
PDF
Keeping code clean
PDF
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
PPTX
Writing testable code
PDF
Save time by applying clean code principles
PPTX
Testing, a pragmatic approach
PDF
Deliver Fast with Confidence
PPT
Lessons Learned in a Continuously Developing Service-Oriented Architecture
PDF
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
Writing code you won't hate tomorrow
“Writing code that lasts” … or writing code you won’t hate tomorrow.
Writing code you won't hate tomorrow
“Writing code that lasts” … or writing code you won’t hate tomorrow.
“Writing code that lasts” … or writing code you won’t hate tomorrow.
“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16
Writing code that lasts - JAB14
Writing Code That Lasts - #Magento2Seminar, Utrecht
Clean Code V2
A sweet taste of clean code and software design
Test Driven Design - GDG DevFest Istanbul 2016
Test Driven Design
Keeping code clean
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
Writing testable code
Save time by applying clean code principles
Testing, a pragmatic approach
Deliver Fast with Confidence
Lessons Learned in a Continuously Developing Service-Oriented Architecture
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...

More from Rafael Dohms (20)

PDF
The Individual Contributor Path - DPC2024
PDF
Application Metrics - IPC2023
PDF
How'd we get here? A guide to Architectural Decision Records
PDF
Architectural Decision Records - PHPConfBR
PDF
Application Metrics (with Prometheus examples)
PDF
Application metrics - Confoo 2019
PDF
Writing code you won’t hate tomorrow - PHPCE18
PDF
Application Metrics (with Prometheus examples) #PHPDD18
PDF
Application metrics with Prometheus - DPC18
PDF
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
PDF
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
PDF
Composer The Right Way - 010PHP
PDF
Composer the Right Way - PHPSRB16
PDF
Composer the Right Way - MM16NL
PDF
Composer The Right Way - PHPUGMRN
PDF
Composer the Right Way - PHPBNL16
PDF
A Journey into your Lizard Brain - PHP Conference Brasil 2015
PDF
Journey into your Lizard Brain - PHPJHB15
PDF
Composer The Right Way #PHPjhb15
PDF
Composer the right way - DPC15
The Individual Contributor Path - DPC2024
Application Metrics - IPC2023
How'd we get here? A guide to Architectural Decision Records
Architectural Decision Records - PHPConfBR
Application Metrics (with Prometheus examples)
Application metrics - Confoo 2019
Writing code you won’t hate tomorrow - PHPCE18
Application Metrics (with Prometheus examples) #PHPDD18
Application metrics with Prometheus - DPC18
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
Composer The Right Way - 010PHP
Composer the Right Way - PHPSRB16
Composer the Right Way - MM16NL
Composer The Right Way - PHPUGMRN
Composer the Right Way - PHPBNL16
A Journey into your Lizard Brain - PHP Conference Brasil 2015
Journey into your Lizard Brain - PHPJHB15
Composer The Right Way #PHPjhb15
Composer the right way - DPC15

Recently uploaded (20)

PDF
Nekopoi APK 2025 free lastest update
PDF
System and Network Administraation Chapter 3
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Transform Your Business with a Software ERP System
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
AI in Product Development-omnex systems
PDF
medical staffing services at VALiNTRY
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
Introduction to Artificial Intelligence
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Digital Strategies for Manufacturing Companies
PPTX
L1 - Introduction to python Backend.pptx
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Understanding Forklifts - TECH EHS Solution
Nekopoi APK 2025 free lastest update
System and Network Administraation Chapter 3
VVF-Customer-Presentation2025-Ver1.9.pptx
How Creative Agencies Leverage Project Management Software.pdf
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Transform Your Business with a Software ERP System
Navsoft: AI-Powered Business Solutions & Custom Software Development
PTS Company Brochure 2025 (1).pdf.......
AI in Product Development-omnex systems
medical staffing services at VALiNTRY
Design an Analysis of Algorithms II-SECS-1021-03
Introduction to Artificial Intelligence
Operating system designcfffgfgggggggvggggggggg
Wondershare Filmora 15 Crack With Activation Key [2025
Digital Strategies for Manufacturing Companies
L1 - Introduction to python Backend.pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Odoo Companies in India – Driving Business Transformation.pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Understanding Forklifts - TECH EHS Solution

“Writing code that lasts” … or writing code you won’t hate tomorrow.