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
0
330
SOLID/STUPID
Base de cours autour des principes SOLID et STUPID
GBProd
February 20, 2017
Tweet
Share
More Decks by GBProd
See All by GBProd
Les tests en Symfony
gbprod
0
220
Make task runners great again
gbprod
2
320
Gilles, craftman from father to son
gbprod
0
140
DDD: Retour d'expérience
gbprod
0
39
Artisan développeur
gbprod
0
59
Other Decks in Programming
See All in Programming
「App Intent」よくわからんけどすごい!
rinngo0302
1
100
AIともっと楽するE2Eテスト
myohei
8
3k
Python型ヒント完全ガイド 初心者でも分かる、現代的で実践的な使い方
mickey_kubo
1
240
LT 2025-06-30: プロダクトエンジニアの役割
yamamotok
0
870
dbt民主化とLLMによる開発ブースト ~ AI Readyな分析サイクルを目指して ~
yoshyum
3
1.1k
ISUCON研修おかわり会 講義スライド
arfes0e2b3c
1
470
The Modern View Layer Rails Deserves: A Vision For 2025 And Beyond @ RailsConf 2025, Philadelphia, PA
marcoroth
2
730
DMMを支える決済基盤の技術的負債にどう立ち向かうか / Addressing Technical Debt in Payment Infrastructure
yoshiyoshifujii
3
410
顧客の画像データをテラバイト単位で配信する 画像サーバを WebP にした際に起こった課題と その対応策 ~継続的な取り組みを添えて~
takutakahashi
4
1.3k
iOS 26にアップデートすると実機でのHot Reloadができない?
umigishiaoi
0
140
ソフトウェア品質を数字で捉える技術。事業成長を支えるシステム品質の マネジメント
takuya542
2
15k
オンコール⼊⾨〜ページャーが鳴る前に、あなたが備えられること〜 / Before The Pager Rings
yktakaha4
2
990
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.6k
The World Runs on Bad Software
bkeepers
PRO
70
11k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
Testing 201, or: Great Expectations
jmmastey
43
7.6k
A designer walks into a library…
pauljervisheath
207
24k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.5k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
282
13k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
750
Reflections from 52 weeks, 52 projects
jeffersonlam
351
21k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.9k
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