Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
SOLID/STUPID
Search
GBProd
February 20, 2017
Programming
370
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SOLID/STUPID
Base de cours autour des principes SOLID et STUPID
GBProd
February 20, 2017
More Decks by GBProd
See All by GBProd
Les tests en Symfony
gbprod
0
240
Make task runners great again
gbprod
2
340
Gilles, craftman from father to son
gbprod
0
200
DDD: Retour d'expérience
gbprod
0
53
Artisan développeur
gbprod
0
88
Other Decks in Programming
See All in Programming
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
460
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
950
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.6k
wkhtmltopdfの次どうするか問題2026
willnet
2
1.9k
contenteditable と日本語入力に向き合う
colorful12
0
180
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
250
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
690
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
3k
sbt 2.0: takeoff
eed3si9n
0
120
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.8k
すこし踏み込む CancellationToken
htkym
2
1.7k
dotNET_vulnclicker_intro.pdf
deka_morita
0
140
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
6.3k
Designing Powerful Visuals for Engaging Learning
tmiket
1
600
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
580
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
The Language of Interfaces
destraynor
162
27k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.3k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1k
Heart Work Chapter 1 - Part 1
lfama
PRO
10
37k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
690
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
420
Transcript
STUPID Code ! Make it SOLID
STUPID Code ! Make it SOLID
Principles, not laws
You’re code is STUPID !
S T U P I D
S T U P I D ingleton
Global State
Hidden dependencies
But not impossible Difficult to test
S T U P I D ight coupling
Interaction level between components
Difficult to change
Difficult to reuse
Difficult to test
Avoiding “new”
S T U P I D ntestability
Everything must be easy to test
If you can’t test, the problem is about design
S T U P I D remature Optimization
Premature optimization is the root of all evil
Optimize only if it’s necessary
Optimize timely
Don’t do it (yet) !
Readability > Optimization
S T U P I D ndescriptive naming
Name properly
Names came from your domain
Don’t abbreviate
Don’t prefix/suffix
The length of a variable name should be proportional to
its scope. The length of a function or class name is the inverse.
“You should name a variable using the same care with
which you name a first-born child.”
Programming languages are for humans, not for computers
Code > Comments
Code = How
Tests = What
Comments = Why
S T U P I Duplication
Be lazy Don’t Repeat Yourself
Be lazy Don’t Repeat Yourself
Most of time Copy/Paste is bad
Use a Copy/Paste Detector
Make it SOLID plz !
S O L I D
S O L I D ingle responsability
Every class should have a single responsibility
Never be more than one reason for a class to
change
God classes
Don’t make your controller be God Objects
Avoid Mutators
Ask yourself what is class responsablity
Keep it as small as possible
S O L I D pen/Close
Open for extension, but closed for modification
extend > modify
setup > modify
S O L I D iskov substitution
Objects should be replaceable with instances of their subtypes without
altering the correctness of the program.
A square is NOT a rectangle
The mouse case
S O L I D nterface segregation
Many clients > One Generic Client
Don’t over-interface
S O L I Dependency injection
High level modules should not depend on low level modules.
Both should depend on abstractions.
Abstractions should not depend on details. Details should depend on
abstractions.
Be pragmatic
Exercice
git clone https://github.com/gbprod/solid-stupid.git