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
82
!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
700
Serverless mobile applications with Firebase v2
alxsimo
4
240
Serverless mobile applications with Firebase
alxsimo
5
290
Cleaner code with Guava v2
alxsimo
5
500
Cleaner code with Guava
alxsimo
3
140
Low fat backends for mobile guys
alxsimo
0
83
GIT: what else?
alxsimo
1
98
Other Decks in Programming
See All in Programming
Effectで作る堅牢でスケーラブルなAPIゲートウェイ / Robust and Scalable API Gateway Built on Effect
yasaichi
7
1.2k
ServerAction で Progressive Enhancement はどこまで頑張れるか? / progressive-enhancement-with-server-action
takefumiyoshii
6
510
ソースコードを美しくたもつために ~コードレビューの認知限界を突破し、年間400リリースを達成する~
kotauchisunsun
1
770
Go製Webアプリケーションのエラーとの向き合い方大全、あるいはやっぱりスタックトレース欲しいやん / Kyoto.go #50
utgwkk
6
2k
“Seeing Like a Programmer”—Resiliency, Limits, and Moral Hazards in Software Engineering (LambdaConf 2024)
chriskrycho
0
430
freeeのエンジニアが 就活で出そうな コーディングテストを 解説してみる
freee
1
170
AppRouter Panel Talk
yosuke_furukawa
PRO
1
520
戦略的DDDは重いのか? / Is strategic DDD heavy?
pictiny
3
2.1k
TypeScriptのパフォーマンス改善
yajihum
14
5.1k
RailsConf 2024: Riffing on Rails: sketch your way to better designed code
kaspth
1
220
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
1
130
slow types ってなんだろう?
karad
0
210
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
660
120k
Web development in the modern age
philhawksworth
203
10k
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
188
16k
10 Git Anti Patterns You Should be Aware of
lemiorhan
649
58k
How To Stay Up To Date on Web Technology
chriscoyier
782
250k
The Language of Interfaces
destraynor
151
23k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
12
1.1k
YesSQL, Process and Tooling at Scale
rocio
165
13k
Making Projects Easy
brettharned
109
5.5k
Product Roadmaps are Hard
iamctodd
45
9.8k
What's new in Ruby 2.0
geeforr
338
31k
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!