SlideShare una empresa de Scribd logo
1 de 43
Descargar para leer sin conexión
2015/11/17
@kengoScal
Android Clean Architecture
for
Dummies
About Me
2
Self Introduction
name: Kengo Suzuki
twitter: @kengoScal
3
2011∼2014:Security Analyst
2014年11月: Joined MoneyForward
2014年11月∼2015年01月: iOS
2015年02月∼08月:Android
2015年09月∼10月 : Security Architect
2015年11月 : Security Architect/Management + Android
4
In Charge of New Android App!
Android Clean Architecture
5
What is it & Why using it?
6
What is it & Why using it?
7
Not Today.
Plenty of Good Entries(with source codes)
8
• English
• Architecting Android…The Clean Way?
• Clean Android Architecture
• MVP for Android: how to organize presentation
layer
• Japanese
• AndroidオールスターズでClean Architectureについて発
表してきた
• これからの設計の話をしよう
• AndroidではMVCよりMVPの方がいいかもしれない
Plenty of Good Entries(with source codes)
9
• English
• Architecting Android…The Clean Way?
• Clean Android Architecture
• MVP for Android: how to organize presentation
layer
• Japanese
• AndroidオールスターズでClean Architectureについ
て発表してきた
• これからの設計の話をしよう
• AndroidではMVCよりMVPの方がいいかもしれない
Big Picture
Source Code
Roles
Big Picture
Roles
Presenter
Right off the Bat?
10
訳: すぐに/直ちに
Need Endurance!
11
• Codes aren t self explanatory
• Lack of experience in using core liibraries could
be pain
• Don t know what goes where.
12
Architecure is About Intent, not Frameworks
13
by Robert Cecil Martin
With the Hope, no one gives up architecting
14
How to use it (Tutorial)
15
Primitive App
16
• Single Activity
• Single List View
• Horizontally aligned texts
• Fab
• click and fetch data
• Fetch MusicList(data)
• by Retrofit
• freemusicarchive.org
• DI and EventHub
• Under Construction
Click And Fetch Data Tutorial
17
The Goal
18
• Click Fab
• Run Retrofit to fetch data
• Not considering data response
19
What We Will Implement
• reference
• Architecting Android…The Clean Way?:
• これからの設計の話をしよう
Thing You Need To Implement
20
• MainActivity
• MusicListPresenter
• MusicListUseCase
• MusicListUseCaseImpl
• MusicListRepository
• MusicListRepositoryImpl
• MusicListEntity
Data
Domain
Presentation
Thing You Need To Implement
21
• MainActivity
• MusicListAdapter
• MusicListPresenter
• MusicListUseCase
• MusicListUseCaseImpl
• MusicListRepository
• MusicListRepositoryImpl
• MusicListEntity
Presentation - UserAction
22
• Main Activity & MusicListAdapter
• Render List View attaching adapter
• Initialize followings
• repository, usecase, presenter
• Pass FAB clicked event along with Main Thread Info
to Presenter
• MusicListPresenter
• Receive FAB clicked event from View
• Execute MusicListUseCase(Imp) Job
• Pass thread info to MusicListUseCas(Imp)
23
What We Just Implemented
• reference
• Architecting Android…The Clean Way?:
• これからの設計の話をしよう
Domain - User Action to Data Interface
24
• MusicUseCase
• Provide interface between Domain Layer &
Presentation Layer
• MusicUseCaseImp
• Ask MusicListRepository(Imp) for API(External
Resource)
• MusicListRepository
• Provide interface between Domain Layer &
Data Layer
25
What We Just Implemented
• reference
• Architecting Android…The Clean Way?:
• これからの設計の話をしよう
Data - Data Interface to DataSource
26
• MusicListRepositoryImp
• To Fetch external Data
• Declare and Execute Retrofit Http Client
• GET http://freemusicarchive.org/api?
key={key}
• MusicListEntity
• Parse Response and map to domain/model
• gson will handle it.
27
What We Just Implemented
• reference
• Architecting Android…The Clean Way?:
• これからの設計の話をしよう
That s it for Fetching Data
28
Now we want to Reflect Data
Reflect Data to View Tutorial
29
The Goal
30
• Pass back data just fetched
• Update View
31
What We Will Implement
• reference
• Architecting Android…The Clean Way?:
• これからの設計の話をしよう
Thing You Need To Implement
32
• MusicListRepository#MusicListFetchCallback
• MusicListUseCaseImpl
• MusicListUseCase#MusicListUseCaseCallback
• MusicListPresenter
• MusicListPresenter#MusicListViewCallback
• MainActivity
Presentation
Domain
Data
Thing You Need To Implement
33
• MusicListRepository#MusicListFetchCallback
• MusicListUseCaseImpl
• MusicListUseCase#MusicListUseCaseCallback
• MusicListPresenter
• MusicListPresenter#MusicListViewCallback
• MainActivity
Domain - Passing Data to User Interface
34
• MusicListRepository#MusicListFetchCallback
• MusicListUseCaseImpl
• Implement MusicListFetchCallback
• So that Main Threat can receive runnable
with command with fetched data
• MusicListUseCase#MusicListUseCaseCallback
• MusicListPresenter
• MusicListPresenter#MusicListViewCallback
• MainActivity
35
What We Just Implemented
• reference
• Architecting Android…The Clean Way?:
• これからの設計の話をしよう
Presentation - Updating View
36
• MusicListUseCase#MusicListUseCaseCallback
• MusicListPresenter#MusicListViewCallback
• MusicListPresenter
• Implement MusicListUseCaseCallback
• Execute methods in MusicListViewCallback
• MainActivity
• Implement MusicListViewCallback
• So that User Case can pass fetched data
• So that Activity can update adapter data
37
What We Just Implemented
• reference
• Architecting Android…The Clean Way?:
• これからの設計の話をしよう
That s it!
38
Lots of Room for Improvement
39
• Callback Repetition is quite Ugly
• Many Reinvent Wheel
• Not using Dagger, RxJava
• Not a big fun of passing thread around
• Tutorial itself wasn t thoroughly covered
Still, Worthwhile
40
Especially, in the team
Enjoy Clean Architecting!
41
Thank you!
References
43
• English
• Architecting Android…The Clean Way?: http://fernandocejas.com/
2014/09/03/architecting-android-the-clean-way/
• Clean Android Architecture: https://speakerdeck.com/richk/clean-
android-architecture
• MVP for Android: how to organize presentation layer: http://
antonioleiva.com/mvp-android/
• Japanese
• AndroidオールスターズでClean Architectureについて発表してきた: http://
tomoima525.hatenablog.com/entry/2015/08/13/190731
• これからの設計の話をしよう: http://www.slideshare.net/
shinnosukekugimiya/ss-50705888
• AndroidではMVCよりMVPの方がいいかもしれない: http://
konifar.hatenablog.com/entry/2015/04/17/010606

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Microservice Stategies - Scaling your API design workflow
Microservice Stategies - Scaling your API design workflowMicroservice Stategies - Scaling your API design workflow
Microservice Stategies - Scaling your API design workflow
 
Into to GraphQL
Into to GraphQLInto to GraphQL
Into to GraphQL
 
apidays LIVE Hong Kong 2021 - Less Data is More by Damir Svrtan, Netflix
apidays LIVE Hong Kong 2021 - Less Data is More by Damir Svrtan, Netflixapidays LIVE Hong Kong 2021 - Less Data is More by Damir Svrtan, Netflix
apidays LIVE Hong Kong 2021 - Less Data is More by Damir Svrtan, Netflix
 
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan KuštInfinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
 
API-first development
API-first developmentAPI-first development
API-first development
 
Standing out as a new grad candidate
Standing out as a new grad candidateStanding out as a new grad candidate
Standing out as a new grad candidate
 
apidays LIVE London 2021 - API Horror Stories from an Unnamed Coworking Compa...
apidays LIVE London 2021 - API Horror Stories from an Unnamed Coworking Compa...apidays LIVE London 2021 - API Horror Stories from an Unnamed Coworking Compa...
apidays LIVE London 2021 - API Horror Stories from an Unnamed Coworking Compa...
 
Taking Control of your Data with GraphQL
Taking Control of your Data with GraphQLTaking Control of your Data with GraphQL
Taking Control of your Data with GraphQL
 
How to GraphQL
How to GraphQLHow to GraphQL
How to GraphQL
 
Mikki Mesfin's Resume
Mikki Mesfin's ResumeMikki Mesfin's Resume
Mikki Mesfin's Resume
 
Blood, sweat, and creating an API handbook
Blood, sweat, and creating an API handbookBlood, sweat, and creating an API handbook
Blood, sweat, and creating an API handbook
 
apidays LIVE Australia 2021 - Designing APIs: Just Enough is Perfect! by Dami...
apidays LIVE Australia 2021 - Designing APIs: Just Enough is Perfect! by Dami...apidays LIVE Australia 2021 - Designing APIs: Just Enough is Perfect! by Dami...
apidays LIVE Australia 2021 - Designing APIs: Just Enough is Perfect! by Dami...
 
Api First Design
Api First DesignApi First Design
Api First Design
 
SauceCon19: Fashionable XCUITest for iOS App
SauceCon19: Fashionable XCUITest for iOS App SauceCon19: Fashionable XCUITest for iOS App
SauceCon19: Fashionable XCUITest for iOS App
 
GraphQL vs BFF: A critical perspective
GraphQL vs BFF: A critical perspectiveGraphQL vs BFF: A critical perspective
GraphQL vs BFF: A critical perspective
 
API first approach for frontend developers
API first approach for frontend developersAPI first approach for frontend developers
API first approach for frontend developers
 
Writing Slack Bots in JavaScript
Writing Slack Bots in JavaScriptWriting Slack Bots in JavaScript
Writing Slack Bots in JavaScript
 
[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...
[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...
[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...
 
Pure APIs: Development workflows for successful API integrations
Pure APIs: Development workflows for successful API integrationsPure APIs: Development workflows for successful API integrations
Pure APIs: Development workflows for successful API integrations
 
Open Event API
Open Event APIOpen Event API
Open Event API
 

Destacado

Clean architecture: Android
Clean architecture: AndroidClean architecture: Android
Clean architecture: Android
intive
 
Design pattern in android
Design pattern in androidDesign pattern in android
Design pattern in android
Jay Kumarr
 
Clean architecture
Clean architectureClean architecture
Clean architecture
andbed
 
Lightning Talk - Clean Architecture and Design
Lightning Talk - Clean Architecture and DesignLightning Talk - Clean Architecture and Design
Lightning Talk - Clean Architecture and Design
Deivison Sporteman
 
Onion Architecture
Onion ArchitectureOnion Architecture
Onion Architecture
matthidinger
 

Destacado (20)

Clean architecture: Android
Clean architecture: AndroidClean architecture: Android
Clean architecture: Android
 
Clean architecture on android
Clean architecture on androidClean architecture on android
Clean architecture on android
 
Effective Android UI - English
Effective Android UI - EnglishEffective Android UI - English
Effective Android UI - English
 
Android cleanarchitecture
Android cleanarchitectureAndroid cleanarchitecture
Android cleanarchitecture
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
 
Design pattern in android
Design pattern in androidDesign pattern in android
Design pattern in android
 
Is Activity God? ~ The MVP Architecture ~
Is Activity God? ~ The MVP Architecture ~Is Activity God? ~ The MVP Architecture ~
Is Activity God? ~ The MVP Architecture ~
 
Introducing Clean Architecture
Introducing Clean ArchitectureIntroducing Clean Architecture
Introducing Clean Architecture
 
Clean architecture
Clean architectureClean architecture
Clean architecture
 
Android Design Principles and Popular Patterns
Android Design Principles and Popular PatternsAndroid Design Principles and Popular Patterns
Android Design Principles and Popular Patterns
 
Karumi Dojo: Kata Maxibon
Karumi Dojo: Kata MaxibonKarumi Dojo: Kata Maxibon
Karumi Dojo: Kata Maxibon
 
Android DevConference - Android Clean Architecture
Android DevConference - Android Clean ArchitectureAndroid DevConference - Android Clean Architecture
Android DevConference - Android Clean Architecture
 
Lightning Talk - Clean Architecture and Design
Lightning Talk - Clean Architecture and DesignLightning Talk - Clean Architecture and Design
Lightning Talk - Clean Architecture and Design
 
Dependency injection on Android
Dependency injection on AndroidDependency injection on Android
Dependency injection on Android
 
My way to clean android v2 English DroidCon Spain
My way to clean android v2 English DroidCon SpainMy way to clean android v2 English DroidCon Spain
My way to clean android v2 English DroidCon Spain
 
Onion Architecture
Onion ArchitectureOnion Architecture
Onion Architecture
 
World-Class Testing Development Pipeline for Android
 World-Class Testing Development Pipeline for Android World-Class Testing Development Pipeline for Android
World-Class Testing Development Pipeline for Android
 
Real Life Clean Architecture
Real Life Clean ArchitectureReal Life Clean Architecture
Real Life Clean Architecture
 
Software Design patterns on Android English
Software Design patterns on Android EnglishSoftware Design patterns on Android English
Software Design patterns on Android English
 
Upload a screenshot to Slack
Upload a screenshot to SlackUpload a screenshot to Slack
Upload a screenshot to Slack
 

Similar a Android Clean Architecture for Dummies

How We Fixed Our MongoDB Problems
How We Fixed Our MongoDB Problems How We Fixed Our MongoDB Problems
How We Fixed Our MongoDB Problems
MongoDB
 
Cloud-Native Workshop NYC - The Cloud-Native Landscape
Cloud-Native Workshop NYC - The Cloud-Native LandscapeCloud-Native Workshop NYC - The Cloud-Native Landscape
Cloud-Native Workshop NYC - The Cloud-Native Landscape
VMware Tanzu
 
Cloud-Native Landscape
Cloud-Native LandscapeCloud-Native Landscape
Cloud-Native Landscape
VMware Tanzu
 

Similar a Android Clean Architecture for Dummies (20)

Stuttgart Cloud-Native Landscape
Stuttgart Cloud-Native LandscapeStuttgart Cloud-Native Landscape
Stuttgart Cloud-Native Landscape
 
Cloud-Native Roadshow - Landscape - San Francisco
Cloud-Native Roadshow - Landscape - San FranciscoCloud-Native Roadshow - Landscape - San Francisco
Cloud-Native Roadshow - Landscape - San Francisco
 
Cloud-Native Roadshow - Landscape - Toronto
Cloud-Native Roadshow - Landscape - TorontoCloud-Native Roadshow - Landscape - Toronto
Cloud-Native Roadshow - Landscape - Toronto
 
Cloud-Native Roadshow - Landscape - St. Louis
Cloud-Native Roadshow - Landscape - St. LouisCloud-Native Roadshow - Landscape - St. Louis
Cloud-Native Roadshow - Landscape - St. Louis
 
Munich Cloud-Native Landscape
Munich Cloud-Native LandscapeMunich Cloud-Native Landscape
Munich Cloud-Native Landscape
 
How We Fixed Our MongoDB Problems
How We Fixed Our MongoDB Problems How We Fixed Our MongoDB Problems
How We Fixed Our MongoDB Problems
 
Cloud-Native Roadshow - Landscape - London
Cloud-Native Roadshow - Landscape - LondonCloud-Native Roadshow - Landscape - London
Cloud-Native Roadshow - Landscape - London
 
Landscape Cloud-Native Roadshow Los Angeles
Landscape Cloud-Native Roadshow Los AngelesLandscape Cloud-Native Roadshow Los Angeles
Landscape Cloud-Native Roadshow Los Angeles
 
Cloud-Native Landscape (Chicago)
Cloud-Native Landscape (Chicago)Cloud-Native Landscape (Chicago)
Cloud-Native Landscape (Chicago)
 
Cloud-Native Workshop NYC - The Cloud-Native Landscape
Cloud-Native Workshop NYC - The Cloud-Native LandscapeCloud-Native Workshop NYC - The Cloud-Native Landscape
Cloud-Native Workshop NYC - The Cloud-Native Landscape
 
Cloud-Native Landscape
Cloud-Native LandscapeCloud-Native Landscape
Cloud-Native Landscape
 
Cloud-Native Roadshow - Landscape - Dallas
Cloud-Native Roadshow - Landscape - DallasCloud-Native Roadshow - Landscape - Dallas
Cloud-Native Roadshow - Landscape - Dallas
 
Cloud-Native Roadshow - Landscape - Atlanta
Cloud-Native Roadshow - Landscape - AtlantaCloud-Native Roadshow - Landscape - Atlanta
Cloud-Native Roadshow - Landscape - Atlanta
 
Cloud-Native Roadshow - Landscape - Detroit
Cloud-Native Roadshow - Landscape - DetroitCloud-Native Roadshow - Landscape - Detroit
Cloud-Native Roadshow - Landscape - Detroit
 
Cloud-Native Roadshow – Landscape – Amsterdam
Cloud-Native Roadshow – Landscape – AmsterdamCloud-Native Roadshow – Landscape – Amsterdam
Cloud-Native Roadshow – Landscape – Amsterdam
 
Cloud-Native Roadshow Boston
Cloud-Native Roadshow BostonCloud-Native Roadshow Boston
Cloud-Native Roadshow Boston
 
Cloud-Native Roadshow - Landscape - DC
Cloud-Native Roadshow - Landscape - DCCloud-Native Roadshow - Landscape - DC
Cloud-Native Roadshow - Landscape - DC
 
Cloud-Native Roadshow - Landscape - Paris
Cloud-Native Roadshow - Landscape - ParisCloud-Native Roadshow - Landscape - Paris
Cloud-Native Roadshow - Landscape - Paris
 
Thoughts on Component Resuse
Thoughts on Component ResuseThoughts on Component Resuse
Thoughts on Component Resuse
 
Cloud-Native Roadshow - Landscape - Denver
Cloud-Native Roadshow - Landscape - DenverCloud-Native Roadshow - Landscape - Denver
Cloud-Native Roadshow - Landscape - Denver
 

Más de Kengo Suzuki

Más de Kengo Suzuki (6)

Androidのセキュア開発について考えてみた(明日、敗訴しないためのセキュアコーディング.ver2)
Androidのセキュア開発について考えてみた(明日、敗訴しないためのセキュアコーディング.ver2)Androidのセキュア開発について考えてみた(明日、敗訴しないためのセキュアコーディング.ver2)
Androidのセキュア開発について考えてみた(明日、敗訴しないためのセキュアコーディング.ver2)
 
第二回Android training4desinger 2
第二回Android training4desinger 2第二回Android training4desinger 2
第二回Android training4desinger 2
 
第一回Android training4desinger
第一回Android training4desinger第一回Android training4desinger
第一回Android training4desinger
 
Android Pen Test - Recon -
Android Pen Test - Recon -Android Pen Test - Recon -
Android Pen Test - Recon -
 
iOSアプリエンジニアの最近
iOSアプリエンジニアの最近iOSアプリエンジニアの最近
iOSアプリエンジニアの最近
 
俺が! 俺たちが! Androidチームだ!
俺が! 俺たちが! Androidチームだ!俺が! 俺たちが! Androidチームだ!
俺が! 俺たちが! Androidチームだ!
 

Último

notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 

Android Clean Architecture for Dummies

  • 3. Self Introduction name: Kengo Suzuki twitter: @kengoScal 3 2011∼2014:Security Analyst 2014年11月: Joined MoneyForward 2014年11月∼2015年01月: iOS 2015年02月∼08月:Android 2015年09月∼10月 : Security Architect 2015年11月 : Security Architect/Management + Android
  • 4. 4 In Charge of New Android App!
  • 6. What is it & Why using it? 6
  • 7. What is it & Why using it? 7 Not Today.
  • 8. Plenty of Good Entries(with source codes) 8 • English • Architecting Android…The Clean Way? • Clean Android Architecture • MVP for Android: how to organize presentation layer • Japanese • AndroidオールスターズでClean Architectureについて発 表してきた • これからの設計の話をしよう • AndroidではMVCよりMVPの方がいいかもしれない
  • 9. Plenty of Good Entries(with source codes) 9 • English • Architecting Android…The Clean Way? • Clean Android Architecture • MVP for Android: how to organize presentation layer • Japanese • AndroidオールスターズでClean Architectureについ て発表してきた • これからの設計の話をしよう • AndroidではMVCよりMVPの方がいいかもしれない Big Picture Source Code Roles Big Picture Roles Presenter
  • 10. Right off the Bat? 10 訳: すぐに/直ちに
  • 11. Need Endurance! 11 • Codes aren t self explanatory • Lack of experience in using core liibraries could be pain • Don t know what goes where.
  • 12. 12
  • 13. Architecure is About Intent, not Frameworks 13 by Robert Cecil Martin
  • 14. With the Hope, no one gives up architecting 14
  • 15. How to use it (Tutorial) 15
  • 16. Primitive App 16 • Single Activity • Single List View • Horizontally aligned texts • Fab • click and fetch data • Fetch MusicList(data) • by Retrofit • freemusicarchive.org • DI and EventHub • Under Construction
  • 17. Click And Fetch Data Tutorial 17
  • 18. The Goal 18 • Click Fab • Run Retrofit to fetch data • Not considering data response
  • 19. 19 What We Will Implement • reference • Architecting Android…The Clean Way?: • これからの設計の話をしよう
  • 20. Thing You Need To Implement 20 • MainActivity • MusicListPresenter • MusicListUseCase • MusicListUseCaseImpl • MusicListRepository • MusicListRepositoryImpl • MusicListEntity
  • 21. Data Domain Presentation Thing You Need To Implement 21 • MainActivity • MusicListAdapter • MusicListPresenter • MusicListUseCase • MusicListUseCaseImpl • MusicListRepository • MusicListRepositoryImpl • MusicListEntity
  • 22. Presentation - UserAction 22 • Main Activity & MusicListAdapter • Render List View attaching adapter • Initialize followings • repository, usecase, presenter • Pass FAB clicked event along with Main Thread Info to Presenter • MusicListPresenter • Receive FAB clicked event from View • Execute MusicListUseCase(Imp) Job • Pass thread info to MusicListUseCas(Imp)
  • 23. 23 What We Just Implemented • reference • Architecting Android…The Clean Way?: • これからの設計の話をしよう
  • 24. Domain - User Action to Data Interface 24 • MusicUseCase • Provide interface between Domain Layer & Presentation Layer • MusicUseCaseImp • Ask MusicListRepository(Imp) for API(External Resource) • MusicListRepository • Provide interface between Domain Layer & Data Layer
  • 25. 25 What We Just Implemented • reference • Architecting Android…The Clean Way?: • これからの設計の話をしよう
  • 26. Data - Data Interface to DataSource 26 • MusicListRepositoryImp • To Fetch external Data • Declare and Execute Retrofit Http Client • GET http://freemusicarchive.org/api? key={key} • MusicListEntity • Parse Response and map to domain/model • gson will handle it.
  • 27. 27 What We Just Implemented • reference • Architecting Android…The Clean Way?: • これからの設計の話をしよう
  • 28. That s it for Fetching Data 28 Now we want to Reflect Data
  • 29. Reflect Data to View Tutorial 29
  • 30. The Goal 30 • Pass back data just fetched • Update View
  • 31. 31 What We Will Implement • reference • Architecting Android…The Clean Way?: • これからの設計の話をしよう
  • 32. Thing You Need To Implement 32 • MusicListRepository#MusicListFetchCallback • MusicListUseCaseImpl • MusicListUseCase#MusicListUseCaseCallback • MusicListPresenter • MusicListPresenter#MusicListViewCallback • MainActivity
  • 33. Presentation Domain Data Thing You Need To Implement 33 • MusicListRepository#MusicListFetchCallback • MusicListUseCaseImpl • MusicListUseCase#MusicListUseCaseCallback • MusicListPresenter • MusicListPresenter#MusicListViewCallback • MainActivity
  • 34. Domain - Passing Data to User Interface 34 • MusicListRepository#MusicListFetchCallback • MusicListUseCaseImpl • Implement MusicListFetchCallback • So that Main Threat can receive runnable with command with fetched data • MusicListUseCase#MusicListUseCaseCallback • MusicListPresenter • MusicListPresenter#MusicListViewCallback • MainActivity
  • 35. 35 What We Just Implemented • reference • Architecting Android…The Clean Way?: • これからの設計の話をしよう
  • 36. Presentation - Updating View 36 • MusicListUseCase#MusicListUseCaseCallback • MusicListPresenter#MusicListViewCallback • MusicListPresenter • Implement MusicListUseCaseCallback • Execute methods in MusicListViewCallback • MainActivity • Implement MusicListViewCallback • So that User Case can pass fetched data • So that Activity can update adapter data
  • 37. 37 What We Just Implemented • reference • Architecting Android…The Clean Way?: • これからの設計の話をしよう
  • 39. Lots of Room for Improvement 39 • Callback Repetition is quite Ugly • Many Reinvent Wheel • Not using Dagger, RxJava • Not a big fun of passing thread around • Tutorial itself wasn t thoroughly covered
  • 43. References 43 • English • Architecting Android…The Clean Way?: http://fernandocejas.com/ 2014/09/03/architecting-android-the-clean-way/ • Clean Android Architecture: https://speakerdeck.com/richk/clean- android-architecture • MVP for Android: how to organize presentation layer: http:// antonioleiva.com/mvp-android/ • Japanese • AndroidオールスターズでClean Architectureについて発表してきた: http:// tomoima525.hatenablog.com/entry/2015/08/13/190731 • これからの設計の話をしよう: http://www.slideshare.net/ shinnosukekugimiya/ss-50705888 • AndroidではMVCよりMVPの方がいいかもしれない: http:// konifar.hatenablog.com/entry/2015/04/17/010606