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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Alexandru Simonescu
June 17, 2016
Programming
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
!Smelly code - The origins
Some best practices we use to forget
Alexandru Simonescu
June 17, 2016
More Decks by Alexandru Simonescu
See All by Alexandru Simonescu
Software Architecture Journey
alxsimo
4
890
Serverless mobile applications with Firebase v2
alxsimo
4
270
Serverless mobile applications with Firebase
alxsimo
5
320
Cleaner code with Guava v2
alxsimo
5
540
Cleaner code with Guava
alxsimo
3
160
Low fat backends for mobile guys
alxsimo
0
120
GIT: what else?
alxsimo
1
130
Other Decks in Programming
See All in Programming
JavaDoc 再入門
nagise
1
360
ふつうのFeature Flag実践入門
irof
7
4k
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
140
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
140
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
540
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
270
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
180
Inside Stream API
skrb
1
730
Oxcを導入して開発体験が向上した話
yug1224
4
320
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
160
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
6
1.3k
スマートグラスで並列バイブコーディング
hyshu
0
150
Featured
See All Featured
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
How to Think Like a Performance Engineer
csswizardry
28
2.7k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.3k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
sira's awesome portfolio website redesign presentation
elsirapls
0
280
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
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!