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
Alexandru Simonescu
June 17, 2016
Programming
0
87
!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
750
Serverless mobile applications with Firebase v2
alxsimo
4
250
Serverless mobile applications with Firebase
alxsimo
5
300
Cleaner code with Guava v2
alxsimo
5
510
Cleaner code with Guava
alxsimo
3
140
Low fat backends for mobile guys
alxsimo
0
94
GIT: what else?
alxsimo
1
100
Other Decks in Programming
See All in Programming
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
250
cXML という電子商取引の トランザクションを支える プロトコルと向きあっている話
phigasui
3
2.3k
Android 15 でアクションバー表示時にステータスバーが白くなってしまう問題
tonionagauzzi
0
140
外部システム連携先が10を超えるシステムでのアーキテクチャ設計・実装事例
kiwasaki
1
230
offers_20241022_imakiire.pdf
imakurusu
2
360
OpenTelemetryでRailsのパフォーマンス分析を始めてみよう(KoR2024)
ymtdzzz
4
1.6k
プロジェクト新規参入者のリードタイム短縮の観点から見る、品質の高いコードとアーキテクチャを保つメリット
d_endo
1
1k
Sidekiqで実現する 長時間非同期処理の中断と再開 / Pausing and Resuming Long-Running Asynchronous Jobs with Sidekiq
hypermkt
6
2.7k
デプロイを任されたので、教わった通りにデプロイしたら障害になった件 ~俺のやらかしを越えてゆけ~
techouse
52
32k
Why Spring Matters to Jakarta EE - and Vice Versa
ivargrimstad
0
1k
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
440
Honoの来た道とこれから
yusukebe
19
3k
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.8k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
GitHub's CSS Performance
jonrohan
1030
460k
Art, The Web, and Tiny UX
lynnandtonic
296
20k
Why Our Code Smells
bkeepers
PRO
334
57k
Designing for humans not robots
tammielis
249
25k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
3
370
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
The Invisible Side of Design
smashingmag
297
50k
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!