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
840
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
140
Low fat backends for mobile guys
alxsimo
0
99
GIT: what else?
alxsimo
1
110
Other Decks in Programming
See All in Programming
TypeScript LSP の今までとこれから
quramy
0
120
TSConfig Solution Style & subpath imports to switch types on a per-file basis
maminami373
1
180
Javaのルールをねじ曲げろ!禁断の操作とその代償から学ぶメタプログラミング入門 / A Guide to Metaprogramming: Lessons from Forbidden Techniques and Their Price
nrslib
1
300
Doma で目指す ORM 最適解
nakamura_to
1
160
「兵法」から見る質とスピード
ickx
0
200
❄️ tmux-nixの実装を通して学ぶNixOSモジュール
momeemt
1
120
Efficiency and Rock 'n’ Roll (Really!)
hollycummins
0
600
Perlで痩せる
yuukis
1
660
Parallel::Pipesの紹介
skaji
2
870
MLOps Japan 勉強会 #52 - 特徴量を言語を越えて一貫して管理する, 『特徴量ドリブン』な MLOps の実現への試み
taniiicom
2
570
TVer iOSチームの共通認識の作り方 - Findy Job LT iOSアプリ開発の裏側 開発組織が向き合う課題とこれから
techtver
PRO
0
710
がんばりすぎないコーディングルール運用術
tsukakei
1
180
Featured
See All Featured
Side Projects
sachag
454
42k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
32
5.8k
Site-Speed That Sticks
csswizardry
7
590
Designing Experiences People Love
moore
142
24k
Raft: Consensus for Rubyists
vanstee
137
7k
Optimizing for Happiness
mojombo
378
70k
We Have a Design System, Now What?
morganepeng
52
7.6k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
6
660
Building Adaptive Systems
keathley
41
2.6k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
15
890
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
VelocityConf: Rendering Performance Case Studies
addyosmani
329
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!