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
380
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
54
Artisan développeur
gbprod
0
100
Other Decks in Programming
See All in Programming
Seven New Principles of Software Engineering
yegor256
0
400
自作Discord音声botをLambda MicroVMsに移行した話 / Migrating My Discord Voice Bot to Lambda MicroVMs
akihisaikeda
0
220
Crash Auto Pipelines
veronikapj
1
270
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
200
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
270
Performance Optimization With LLMs
xleitix
0
230
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
310
続・コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions-again
handlename
0
160
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
7.1k
Web Framework Benchmark Battle 2026, Any%
a_matsuda
3
3.1k
高橋メソッドでCVE解説シリーズ 〜CVE-2026-112816〜
hakkadaikon
0
120
最近”作らせてる” ローカルAIアプリの話
akit37
0
530
Featured
See All Featured
ラッコキーワード サービス紹介資料
rakko
5
5.6M
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
650
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
350
Building Adaptive Systems
keathley
44
3.3k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
Darren the Foodie - Storyboard
khoart
PRO
4
4.1k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
550
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
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