Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
SOLID/STUPID
Search
GBProd
February 20, 2017
Programming
350
0
Share
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
230
Make task runners great again
gbprod
2
330
Gilles, craftman from father to son
gbprod
0
170
DDD: Retour d'expérience
gbprod
0
46
Artisan développeur
gbprod
0
65
Other Decks in Programming
See All in Programming
AI活用のコスパを最大化する方法
ochtum
0
370
「効かない!」依存性注入(DI)を活用したAPI Platformのエラーハンドリング奮闘記
mkmk884
0
300
Java 21/25 Virtual Threads 소개
debop
0
330
ファインチューニングせずメインコンペを解く方法
pokutuna
0
270
Radical Imagining - LIFT 2025-2027 Policy Agenda
lift1998
0
240
Nuxt Server Components
wattanx
0
250
Going Multiplatform with Your Android App (Android Makers 2026)
zsmb
1
330
Mastering Event Sourcing: Your Parents Holidayed in Yugoslavia
super_marek
0
150
Xdebug と IDE による デバッグ実行の仕組みを見る / Exploring-How-Debugging-Works-with-Xdebug-and-an-IDE
shin1x1
0
340
安いハードウェアでVulkan
fadis
1
910
Kubernetesでセルフホストが簡単なNewSQLを求めて / Seeking a NewSQL Database That's Simple to Self-Host on Kubernetes
nnaka2992
0
200
Strategy for Finding a Problem for OSS: With Real Examples
kibitan
0
140
Featured
See All Featured
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
190
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
250
Git: the NoSQL Database
bkeepers
PRO
432
67k
SEO for Brand Visibility & Recognition
aleyda
0
4.4k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
330
Mobile First: as difficult as doing things right
swwweet
225
10k
Designing for Timeless Needs
cassininazir
0
190
Building AI with AI
inesmontani
PRO
1
860
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.8k
The agentic SEO stack - context over prompts
schlessera
0
730
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
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