Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Clean Architecture & Error Handling
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Ahtsham Abbasi
October 24, 2022
Technology
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Clean Architecture & Error Handling
Ahtsham Abbasi
October 24, 2022
Other Decks in Technology
See All in Technology
USB PDを使ってスマホを労わりたい
raspython3
0
180
サブエージェントと Claude Mods で作る独自 Advisor ツールの話
kenichiodo
2
160
脆弱性診断って、何をしているの? 〜弱点を見つけて、会社の改善につなげるまで〜
keeg
0
920
Optunaの最新リリースv5.0について
pfn
PRO
0
120
⾮構造化データを価値に変える AI エージェント基盤とその組織
ivry_presentationmaterials
0
190
"優秀な誰か"の下位互換にならないために
yut0naga1_fa
1
1.8k
今さら理解するウェブフォントver.2026
takanorip
3
810
アウトプット初心者、半年間のふりかえり
4o1sobblue
0
430
AIカンパニーへの転換を支えた、エンジニアの仕事の再定義
kworkdev
PRO
2
1.2k
「事実」を「計測」して、「解釈」する 〜AWS Lambdaのメモリ最適解の見つけ方〜
maimyyym
0
170
hackers_champloo_2026_tidb
makocchi
0
160
AI導入は済んだ。次は統制を作り替える番だ_AI×開発組織 Summit 2026
techtekt
PRO
0
230
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Done Done
chrislema
187
17k
For a Future-Friendly Web
brad_frost
184
10k
Raft: Consensus for Rubyists
vanstee
142
7.8k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Designing Experiences People Love
moore
143
24k
Between Models and Reality
mayunak
4
500
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
A Soul's Torment
seathinner
8
3.8k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.9k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
520
Transcript
Clean Architecture & Error Handling Ahtsham Abbasi Senior Android Developer
@ Mobiquity Consultant @ Rabobank mobiquity
Agenda 1. Clean Architecture 2. Domain Layer 3. Conclusion
#1 Clean Architecture What’s all the fuss about?
None
Why Architecture?
Why Clean Architecture? • Decouples the external components
Why Clean Architecture? • Decouples the external components • Works
with other architectures like MVP, MVC, MVVM
Why Clean Architecture? • Decouples the external components • Works
with other architectures like MVP, MVC, MVVM • Framework independent
What is Clean Architecture?
What is Clean Architecture? Clean code
What is Clean Architecture? Clean code
What is Clean Architecture? Clean code Onion arch. + Hexagonal
arch.
What is Clean Architecture?
Flow of Control
Flow of Control Use Case Controller DB IoC
Number of layers
Layers Entities Use Cases Repositories View Models User Interface Database
Rem ote API
Frontend app • Outer most circle • Notifications code •
Cookies • Displaying content
Backend app • Outer most circle • Database code •
Auth library • 3rd party services
Models Each layer must have its own models.
Dependency Injection Koin, Guice, Spring
#2 Domain Layer Implementation and error handling
Domain Layer
Components of Domain Layer • Use cases
Components of Domain Layer • Use cases • Models
Components of Domain Layer • Use cases • Models •
Interfaces
Use Cases
None
None
None
None
None
Structuring a Use Case • Scope
Structuring a Use Case • Scope • Structure
Structuring a Use Case • Scope • Structure • Inputs
/ Outputs
Outputs • Requirement • Exhaustive output • Easy to learn
• Easy to scale
Outputs • Requirement • Exhaustive output • Easy to learn
• Easy to scale • Different options considered • Kotlin Try • Monadic outputs • Arrow-Kt • Sealed classes
Example
Invocation
Pitfalls to avoid
Pifalls to avoid • Returning nulls
Pifalls to avoid • Returning nulls • Wrapping non-exhaustible data
in outputs
Pifalls to avoid • Returning nulls • Wrapping non-exhaustible data
in outputs • Callbacks
Pifalls to avoid • Returning nulls • Wrapping non-exhaustible data
in outputs • Callbacks • Exceptions
Pifalls to avoid • Returning nulls • Wrapping non-exhaustible data
in outputs • Callbacks • Exceptions • Base classes
Other Layers Entities Use Cases Repositories View Models User Interface
Database Rem ote API • Separate models • Aggregate outputs • Avoid exceptions
#3 Conclusions Learnings so far
Is it a good architecture for me?
It is for you, if you want to.. • Manage
complex and scaling business requirements
It is for you, if you want to.. • Manage
complex and scaling business requirements • Decouple the external components
It is for you, if you want to.. • Manage
complex and scaling business requirements • Decouple the external components • Share business logic across platforms
It is for you, if you want to.. • Manage
complex and scaling business requirements • Decouple the external components • Share business logic across platforms • Increase testability
It is for you, if you want to.. • Manage
complex and scaling business requirements • Decouple the external components • Share business logic across platforms • Increase testability • Have a framework independent architecture
Drawbacks
Drawbacks • Code duplication • Boilerplate code • Learning curve
• Not ideal for smaller projects
Final thoughts
Resources • Clean Architecture Book by Robert C. Martin •
https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html • https://elizarov.medium.com/kotlin-and-exceptions-8062f589d07 • https://pusher.com/tutorials/clean-architecture-introduction/
Thank you! Ahtsham Abbasi
[email protected]
https://www.linkedin.com/in/ahtabbasi/ mobiquity