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
740
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
92
GIT: what else?
alxsimo
1
100
Other Decks in Programming
See All in Programming
Prompt Cachingは本当に効果的なのか検証してみた.pdf
ttnyt8701
0
530
What is Parser
yui_knk
9
4.1k
watsonx.ai Dojo #2 生成AIを使ったアプリ開発入門編
oniak3ibm
PRO
0
220
仮想ファイルシステムを導入して開発環境のストレージ課題を解消する
segadevtech
2
550
unique パッケージから学ぶ interning と weak reference @ Asakusa.go#3
karamaru
2
810
Swiftコードバトル必勝法
toshi0383
0
170
Desafios e Lições Aprendidas na Migração de Monólitos para Microsserviços em Java
jessilyneh
2
150
RAGの回答精度評価用のQAデータセットを生成AIに作らせた話
kurahara
0
250
Amazon Neptuneで始める初めてのグラフDB ー グラフDBを使う意味を考える ー
satoshi256kbyte
2
260
全部見せます! クラシルリワードのSwiftTesting移行プロジェクト
uetyo
0
210
Architecture Decision Record (ADR)
nearme_tech
PRO
1
690
いまから追い上げる、Jetpack Compose トレーニング
nyafunta9858
0
590
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
363
22k
Bootstrapping a Software Product
garrettdimon
PRO
304
110k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
157
15k
Faster Mobile Websites
deanohume
304
30k
Intergalactic Javascript Robots from Outer Space
tanoku
268
26k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
GraphQLの誤解/rethinking-graphql
sonatard
65
9.8k
Scaling GitHub
holman
458
140k
Fantastic passwords and where to find them - at NoRuKo
philnash
48
2.8k
Designing Experiences People Love
moore
138
23k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
1
55
How to train your dragon (web standard)
notwaldorf
85
5.6k
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!