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
90
!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
830
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
98
GIT: what else?
alxsimo
1
110
Other Decks in Programming
See All in Programming
Laravel × Clean Architecture
bumptakayuki
PRO
0
120
Glue Studio Visual ETL実装時にハマったこと
kokitamura
0
100
ComposeでWebアプリを作る技術
tbsten
0
120
The Evolution of the CRuby Build System
kateinoigakukun
1
730
PHPバージョンアップから始めるOSSコントリビュート / how2oss-contribute
dmnlk
1
1.1k
note の Elasticsearch 更新系を支える技術
tchov
0
170
PHP で学ぶ OAuth 入門
azuki
1
220
Ruby's Line Breaks
yui_knk
3
1.8k
Browser and UI #2 HTML/ARIA
ken7253
2
140
タイムゾーンの奥地は思ったよりも闇深いかもしれない
suguruooki
1
750
DevOpsDaysTokyo2025社内副業で他部門へ_越境_して見えた価値再定義最大1か月のリードタイムを10分に短縮したDevOps実践.pdf
susumutomita
0
100
flutter_kaigi_mini_4.pdf
nobu74658
0
120
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
23
2.7k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.7k
4 Signs Your Business is Dying
shpigford
183
22k
Fontdeck: Realign not Redesign
paulrobertlloyd
84
5.5k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
[RailsConf 2023] Rails as a piece of cake
palkan
54
5.4k
Building Adaptive Systems
keathley
41
2.5k
Navigating Team Friction
lara
185
15k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
227
22k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Designing Experiences People Love
moore
142
24k
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!