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
!Smelly code - The origins
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Alexandru Simonescu
June 17, 2016
Programming
0
97
!Smelly code - The origins
Some best practices we use to forget
Alexandru Simonescu
June 17, 2016
Tweet
Share
More Decks by Alexandru Simonescu
See All by Alexandru Simonescu
Software Architecture Journey
alxsimo
4
870
Serverless mobile applications with Firebase v2
alxsimo
4
260
Serverless mobile applications with Firebase
alxsimo
5
310
Cleaner code with Guava v2
alxsimo
5
530
Cleaner code with Guava
alxsimo
3
150
Low fat backends for mobile guys
alxsimo
0
110
GIT: what else?
alxsimo
1
120
Other Decks in Programming
See All in Programming
米国のサイバーセキュリティタイムラインと見る Goの暗号パッケージの進化
tomtwinkle
1
250
AI主導でFastAPIのWebサービスを作るときに 人間が構造化すべき境界線
okajun35
0
290
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
2k
kintone + ローカルLLM = ?
akit37
0
120
今から始めるClaude Code超入門
448jp
8
9.5k
並行開発のためのコードレビュー
miyukiw
2
2k
オブザーバビリティ駆動開発って実際どうなの?
yohfee
2
550
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
320
Event Storming
hschwentner
3
1.3k
ふん…おもしれぇ Parser。RubyKaigi 行ってやるぜ
aki_pin0
0
110
AI駆動開発の本音 〜Claude Code並列開発で見えたエンジニアの新しい役割〜
hisuzuya
1
320
今更考える「単一責任原則」 / Thinking about the Single Responsibility Principle
tooppoo
2
960
Featured
See All Featured
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.1k
Designing Experiences People Love
moore
144
24k
How Software Deployment tools have changed in the past 20 years
geshan
0
32k
Google's AI Overviews - The New Search
badams
0
920
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Amusing Abliteration
ianozsvald
0
120
Scaling GitHub
holman
464
140k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
160
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
130
Ruling the World: When Life Gets Gamed
codingconduct
0
160
Accessibility Awareness
sabderemane
0
68
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
110
Transcript
!smelly_code clean development @alexsimonescu
Coach better than teach
N-Layered Domain Oriented Architecture Guide
SOLID
what’s next?
GRASP
General Responsibility Assignment Software Patterns
(High cohesion) && (Low coupling)
Cohesion
High Cohesion - Methods of a class have much in
common
High Cohesion - Methods of a class have much in
common - Methods focus on same functionality
High Cohesion - Methods of a class have much in
common - Methods focus on same functionality - Higher cohesion between elements = better
High Cohesion - Methods of a class have much in
common - Methods focus on same functionality - Higher cohesion between elements = better - Lower cohesion can be disturbing; but not critical
Cohesion Types
Functional Cohesion Small units, work together and share same intention
/ function
Sequencial Cohesion Output of an element, serves as input for
another one
Informational Cohesion Different modules work with same data object
Procedural Cohesion Elements are grouped together in order to sequentially
execute a task
Temporal Cohesion Elements are executed at same moment of time
Logical Cohesion Logical elements are put together in same module
Loose Coupling
Loose coupling - Increase reusability
Loose coupling - Increase reusability - Low colateral effect when
changing collaborators
Patterns
Reuse / release equivalence - Libraries
Reuse / release equivalence - Libraries - You are the
consumer
Reuse / release equivalence - Libraries - You are the
consumer - You should not need to look at source code
Reuse / release equivalence - Libraries - You are the
consumer - You should not need to look at source code - Take care with semantic versioning
Common reuse principle - Tells how to organize packages
Common reuse principle - Tells how to organize packages -
The classes on a package are reused together
Common reuse principle - Tells how to organize packages -
The classes on a package are reused together - If you reuse one class from the package, you should reuse all
Acyclic dependencies - The dependency graph between packages should be
direct
Acyclic dependencies - The dependency graph between packages should be
direct - There must not be any cycles
Smells
Compound names
Long names
Comments
Long parameters list
Duplicated code
Conditional complexity
Large classes
Dead code
Temporary fields
Crime scene
Crime scene
Code Maat
Code Maat
None
None
None
Find the boss
Use cases
MVC
MVC
MVP
MVP
MVVM
MVVMP
Clean Architecture
None
None
None
None
Hexagonal
None
None
None
Thanks!