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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
190
DDD: Retour d'expérience
gbprod
0
53
Artisan développeur
gbprod
0
79
Other Decks in Programming
See All in Programming
Loosening the Reins: Go Generics Get More Flexible
kuro_kurorrr
0
360
Claude Code全社展開のためにやったことn選~プラグイン302個・コミッター271人を支えるために~
kenchan
5
1.8k
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
180
高専、大学編入、そして未踏へ〜プロダクト開発とキャリアの歩み - Technical College, University Transfer, and On to “Mitou” / My Journey in Product Development and Career
pkmiya
0
120
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
1.6k
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
280
Hello, Hiroshima Geospatial Data! — Exploring DoboX with Python
ra0kley
0
150
Pythonの実行はどこまで賢くなったのか? CPythonとPyPyから見る最適化のしくみ
curekoshimizu
4
2.4k
異なる設計思想のフレームワークを経験して得た学び
amekuhideki
2
1.4k
T3DD26: From RAGs to Riches
martinhelmich
0
130
My Marp Sample
sinoue0108
0
140
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
3
460
Featured
See All Featured
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.9k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
440
GraphQLとの向き合い方2022年版
quramy
50
15k
What's in a price? How to price your products and services
michaelherold
247
13k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
910
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Technical Leadership for Architectural Decision Making
baasie
3
550
Designing for Timeless Needs
cassininazir
1
460
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
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