Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
!Smelly code - The origins
Search
Alexandru Simonescu
June 17, 2016
Programming
0
93
!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
860
Serverless mobile applications with Firebase v2
alxsimo
4
250
Serverless mobile applications with Firebase
alxsimo
5
300
Cleaner code with Guava v2
alxsimo
5
520
Cleaner code with Guava
alxsimo
3
150
Low fat backends for mobile guys
alxsimo
0
100
GIT: what else?
alxsimo
1
120
Other Decks in Programming
See All in Programming
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
370
tparseでgo testの出力を見やすくする
utgwkk
1
190
AIコーディングエージェント(skywork)
kondai24
0
160
ゲームの物理 剛体編
fadis
0
330
Navigation 3: 적응형 UI를 위한 앱 탐색
fornewid
1
300
大体よく分かるscala.collection.immutable.HashMap ~ Compressed Hash-Array Mapped Prefix-tree (CHAMP) ~
matsu_chara
1
220
ViewファーストなRailsアプリ開発のたのしさ
sugiwe
0
440
エディターってAIで操作できるんだぜ
kis9a
0
710
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
9
1.1k
FluorTracer / RayTracingCamp11
kugimasa
0
230
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
200
Microservices Platforms: When Team Topologies Meets Microservices Patterns
cer
PRO
1
1k
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
76
5.2k
Why Our Code Smells
bkeepers
PRO
340
57k
Thoughts on Productivity
jonyablonski
73
5k
Building Adaptive Systems
keathley
44
2.9k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.3k
Navigating Team Friction
lara
191
16k
For a Future-Friendly Web
brad_frost
180
10k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3k
Statistics for Hackers
jakevdp
799
230k
A better future with KSS
kneath
240
18k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.3k
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!