SlideShare una empresa de Scribd logo
1 de 55
Descargar para leer sin conexión
為你的專案加點模組化
Kaohsiung
YungHan Chang ( Kenny Chang )
Freelancer Android & Backend
86%
work on multi-module
90%
would recommend considering.
Modularity of code is critical to managing
complexity, stability, readability, and
testability in an ever-growing codebase.
54%
dif
fi
cult to
fi
nd learning materials
95%
of
fi
cial materials are insuf
fi
cient!
綱要
● 特點
● Strategy
● Data domain presenter
● Feature
● Hybrid
● Dependency
● Gradle
● Library version control
● Now in android project
不包含
● Dynamic module
● Gradle syntax
● Benchmark
● Lint
模組化
What and why
顆粒度
Component
Class
function
Gradle project
顆粒度
Component
Class
function
Gradle project
顆粒度
● 過於精細
● 成本
● 建構複雜度
● 專案複雜度
● 過於粗略
● 變成另⼀個⼤模組,失去模組化優勢
Pros
● 只有模組化可以
● 模組可重⽤性
● 嚴格控制可⾒性
● 動態發布
● 模組化幫你增強
● 關注點分離
● 問責和單⼀權責
● 封裝
● 測試
● 建構時間
● 平⾏開發
“Nothing wrong with single module.”
App architecture
Layer seperation
Layer seperation
Layer seperation
Layer seperation
Benefit of layering
● Reducing scope of attention
● Increase testability
● Clearer responsibility
● One way direction dependency
But not good enough for modularization, because…
:UI
:Domain
:Data
What if by features?
:Store :Product :FeatureC
Store ui
Store view Model
Store repository
Store remote source
Store local source
What if by features?
:Store 20s :Product. 13s :FeatureC. 17s
:app. 5s
:Core. 4s
What if by features?
:Store :Product :FeatureC
Store ui
Store view Model
Store repository
Store remote source
Store local source
Product ui
Product view Model
Product repository
Product remote source
Product ui
Product remote source
Product local source
.
.
.
Why not depends on other feature?
:Store 20s :Product. 13s :FeatureC. 17s
:app. 5s
:Core. 4s
59S
Combining two strategy
:ui:Store
:domain:Store
:data:Store
:ui:Product
:domain:Product
:data:Product
:ui:C
:domain:C
:data:C
Challenge
● Gradle
● Circular Dependency
● Style
● Navigation
● DI
● Library version
Gradle incremental
Build
Using api v.s. implementation
● api configuration will be transitively exposed to consumers of the library.
● implementation will not be exposed to consumer, and not leak into the consumer’s
compile classpath.
Using api v.s. implementation
Source : Android modularization preps things to know before modularizing
Circular dependencies
Source : Android modularization preps things to know before modularizing
Library version
● BuildSrc module
● Version catalog
:app
Using gradle control library version
● BuildSrc module
● Version catalog
:app
Now in Android
App Architecture
Now in Android
modularization
Feature module
Core module
Data module
NowInAndroid Single feature
:feature:author
● Grade
:build-logic
● Grade
:build-logic gradle
:core:data
Using different module in app module
Kotlin project
KMM
KMM
模組化和抽象⼀樣,適度就好
沒有最好的架構,只有最適合的
It depends…
Resource
● Android
● https://android-developers.googleblog.com/2022/09/announcing-new-guide-to-
android-app-modularization.html
● https://developer.android.com/topic/modularization
● https://developer.android.com/topic/architecture
● https://developer.android.com/topic/modularization/patterns#types-of-modules
● https://www.droidcon.com/2022/02/15/android-modularization-preps-things-to-know-
before-modularizing-your-app/
● https://github.com/android/nowinandroid/blob/main/docs/
ModularizationLearningJourney.md
● https://www.youtube.com/watch?v=16SwTvzDO0A
Resource
● Modularization
● https://proandroiddev.com/the-abc-of-modularization-for-android-in-2021-
e7b3fbe29fca
● https://www.droidcon.com/2022/11/15/modularization-flatten-your-graph-and-get-the-
real-benefits/
● https://www.jetbrains.com/help/idea/dependencies-analysis.html#validate-
dependencies
● https://www.droidcon.com/2022/06/28/solid-modularization-untangling-the-
dependency-graph/
● https://markonovakovic.medium.com/clean-architecture-is-not-domain-data-
presentation-e368d7ff8579
● https://martinfowler.com/bliki/PresentationDomainDataLayering.html
Resource
● Library version
● https://proandroiddev.com/using-version-catalog-on-android-projects-82d88d2f79e5
● https://proandroiddev.com/stop-using-gradle-buildsrc-use-composite-builds-
instead-3c38ac7a2ab3
● https://quickbirdstudios.com/blog/gradle-kotlin-buildsrc-plugin-android/
● https://www.droidcon.com/2021/07/19/better-dependency-management-using-
buildsrc-kotlin-dsl/
● https://www.droidcon.com/2022/05/13/gradle-version-catalogs-for-an-awesome-
dependency-management/
● https://docs.gradle.org/current/userguide/platforms.html
Q&A

Más contenido relacionado

Similar a DevFest 2022 - 為你的專案加點模組化.pdf

Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Nicolas HAAN
 
Angular patterns
Angular patternsAngular patterns
Angular patternsPremkumar M
 
The Modern Web with Microfrontends
The Modern Web with MicrofrontendsThe Modern Web with Microfrontends
The Modern Web with MicrofrontendsNikki Dingding
 
From Data Science to MLOps
From Data Science to MLOpsFrom Data Science to MLOps
From Data Science to MLOpsCarl W. Handlin
 
Evolving to Cloud-Native - Anand Rao
Evolving to Cloud-Native - Anand RaoEvolving to Cloud-Native - Anand Rao
Evolving to Cloud-Native - Anand RaoVMware Tanzu
 
iOS团队开发实践经验
iOS团队开发实践经验iOS团队开发实践经验
iOS团队开发实践经验Jiyee Sheng
 
Laravel vs CodeIgniter.pdf
Laravel vs CodeIgniter.pdfLaravel vs CodeIgniter.pdf
Laravel vs CodeIgniter.pdfWPWeb Infotech
 
Introduction to GCP
Introduction to GCPIntroduction to GCP
Introduction to GCPKnoldus Inc.
 
Conquer Architectural Challenges with End-to-End JavaScript - enterJS 2014
Conquer Architectural Challenges with End-to-End JavaScript - enterJS 2014Conquer Architectural Challenges with End-to-End JavaScript - enterJS 2014
Conquer Architectural Challenges with End-to-End JavaScript - enterJS 2014Alexandre Morgaut
 
Multiplier Effect: Case Studies in Distributions for Publishers
Multiplier Effect: Case Studies in Distributions for PublishersMultiplier Effect: Case Studies in Distributions for Publishers
Multiplier Effect: Case Studies in Distributions for PublishersJon Peck
 
Laravel vs Codeigniter, Which is Better PHP Framework_.pptx
Laravel vs Codeigniter, Which is Better PHP Framework_.pptxLaravel vs Codeigniter, Which is Better PHP Framework_.pptx
Laravel vs Codeigniter, Which is Better PHP Framework_.pptxElsner Technologies Pvt. Ltd.
 
King Tut Architecture
King Tut ArchitectureKing Tut Architecture
King Tut ArchitectureGary Pedretti
 
Decentralized APIs for Agile Businesses
Decentralized APIs for Agile BusinessesDecentralized APIs for Agile Businesses
Decentralized APIs for Agile BusinessesNuwan Dias
 
APIdays Zurich 2019 - Decentralized API Management for Agile Enterprises Nuwa...
APIdays Zurich 2019 - Decentralized API Management for Agile Enterprises Nuwa...APIdays Zurich 2019 - Decentralized API Management for Agile Enterprises Nuwa...
APIdays Zurich 2019 - Decentralized API Management for Agile Enterprises Nuwa...apidays
 
5 Pillars of Building Enterprise0grade APIs
5 Pillars of Building Enterprise0grade APIs5 Pillars of Building Enterprise0grade APIs
5 Pillars of Building Enterprise0grade APIsWSO2
 
Modern Web Cloud Architecture based on Google Technologies
Modern Web Cloud Architecture based on Google TechnologiesModern Web Cloud Architecture based on Google Technologies
Modern Web Cloud Architecture based on Google TechnologiesMichael Ludwig
 
WSO2 User Group Bangalore Meetup
WSO2 User Group Bangalore MeetupWSO2 User Group Bangalore Meetup
WSO2 User Group Bangalore MeetupWSO2
 

Similar a DevFest 2022 - 為你的專案加點模組化.pdf (20)

Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
 
Angular patterns
Angular patternsAngular patterns
Angular patterns
 
The Modern Web with Microfrontends
The Modern Web with MicrofrontendsThe Modern Web with Microfrontends
The Modern Web with Microfrontends
 
From Data Science to MLOps
From Data Science to MLOpsFrom Data Science to MLOps
From Data Science to MLOps
 
Evolving to Cloud-Native - Anand Rao
Evolving to Cloud-Native - Anand RaoEvolving to Cloud-Native - Anand Rao
Evolving to Cloud-Native - Anand Rao
 
iOS团队开发实践经验
iOS团队开发实践经验iOS团队开发实践经验
iOS团队开发实践经验
 
Laravel vs CodeIgniter.pdf
Laravel vs CodeIgniter.pdfLaravel vs CodeIgniter.pdf
Laravel vs CodeIgniter.pdf
 
RealDay: Angular.js
RealDay: Angular.jsRealDay: Angular.js
RealDay: Angular.js
 
Introduction to GCP
Introduction to GCPIntroduction to GCP
Introduction to GCP
 
Conquer Architectural Challenges with End-to-End JavaScript - enterJS 2014
Conquer Architectural Challenges with End-to-End JavaScript - enterJS 2014Conquer Architectural Challenges with End-to-End JavaScript - enterJS 2014
Conquer Architectural Challenges with End-to-End JavaScript - enterJS 2014
 
Multiplier Effect: Case Studies in Distributions for Publishers
Multiplier Effect: Case Studies in Distributions for PublishersMultiplier Effect: Case Studies in Distributions for Publishers
Multiplier Effect: Case Studies in Distributions for Publishers
 
Laravel vs Codeigniter, Which is Better PHP Framework_.pptx
Laravel vs Codeigniter, Which is Better PHP Framework_.pptxLaravel vs Codeigniter, Which is Better PHP Framework_.pptx
Laravel vs Codeigniter, Which is Better PHP Framework_.pptx
 
King Tut Architecture
King Tut ArchitectureKing Tut Architecture
King Tut Architecture
 
Decentralized APIs for Agile Businesses
Decentralized APIs for Agile BusinessesDecentralized APIs for Agile Businesses
Decentralized APIs for Agile Businesses
 
APIdays Zurich 2019 - Decentralized API Management for Agile Enterprises Nuwa...
APIdays Zurich 2019 - Decentralized API Management for Agile Enterprises Nuwa...APIdays Zurich 2019 - Decentralized API Management for Agile Enterprises Nuwa...
APIdays Zurich 2019 - Decentralized API Management for Agile Enterprises Nuwa...
 
THE FUTURE OF ANGULAR JS
THE FUTURE OF ANGULAR JSTHE FUTURE OF ANGULAR JS
THE FUTURE OF ANGULAR JS
 
Angular best practices
Angular best practicesAngular best practices
Angular best practices
 
5 Pillars of Building Enterprise0grade APIs
5 Pillars of Building Enterprise0grade APIs5 Pillars of Building Enterprise0grade APIs
5 Pillars of Building Enterprise0grade APIs
 
Modern Web Cloud Architecture based on Google Technologies
Modern Web Cloud Architecture based on Google TechnologiesModern Web Cloud Architecture based on Google Technologies
Modern Web Cloud Architecture based on Google Technologies
 
WSO2 User Group Bangalore Meetup
WSO2 User Group Bangalore MeetupWSO2 User Group Bangalore Meetup
WSO2 User Group Bangalore Meetup
 

Último

priority interrupt computer organization
priority interrupt computer organizationpriority interrupt computer organization
priority interrupt computer organizationchnrketan
 
A brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision ProA brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision ProRay Yuan Liu
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Sumanth A
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Communityprachaibot
 
22CYT12 & Chemistry for Computer Systems_Unit-II-Corrosion & its Control Meth...
22CYT12 & Chemistry for Computer Systems_Unit-II-Corrosion & its Control Meth...22CYT12 & Chemistry for Computer Systems_Unit-II-Corrosion & its Control Meth...
22CYT12 & Chemistry for Computer Systems_Unit-II-Corrosion & its Control Meth...KrishnaveniKrishnara1
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...gerogepatton
 
Secure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech LabsSecure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech Labsamber724300
 
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...IJAEMSJORNAL
 
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptxTriangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptxRomil Mishra
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
Javier_Fernandez_CARS_workshop_presentation.pptx
Javier_Fernandez_CARS_workshop_presentation.pptxJavier_Fernandez_CARS_workshop_presentation.pptx
Javier_Fernandez_CARS_workshop_presentation.pptxJavier Fernández Muñoz
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfBalamuruganV28
 
Forming section troubleshooting checklist for improving wire life (1).ppt
Forming section troubleshooting checklist for improving wire life (1).pptForming section troubleshooting checklist for improving wire life (1).ppt
Forming section troubleshooting checklist for improving wire life (1).pptNoman khan
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSneha Padhiar
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
Theory of Machine Notes / Lecture Material .pdf
Theory of Machine Notes / Lecture Material .pdfTheory of Machine Notes / Lecture Material .pdf
Theory of Machine Notes / Lecture Material .pdfShreyas Pandit
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewsandhya757531
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 

Último (20)

priority interrupt computer organization
priority interrupt computer organizationpriority interrupt computer organization
priority interrupt computer organization
 
A brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision ProA brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision Pro
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Community
 
22CYT12 & Chemistry for Computer Systems_Unit-II-Corrosion & its Control Meth...
22CYT12 & Chemistry for Computer Systems_Unit-II-Corrosion & its Control Meth...22CYT12 & Chemistry for Computer Systems_Unit-II-Corrosion & its Control Meth...
22CYT12 & Chemistry for Computer Systems_Unit-II-Corrosion & its Control Meth...
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
 
Secure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech LabsSecure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech Labs
 
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
 
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptxTriangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptx
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
Javier_Fernandez_CARS_workshop_presentation.pptx
Javier_Fernandez_CARS_workshop_presentation.pptxJavier_Fernandez_CARS_workshop_presentation.pptx
Javier_Fernandez_CARS_workshop_presentation.pptx
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdf
 
Forming section troubleshooting checklist for improving wire life (1).ppt
Forming section troubleshooting checklist for improving wire life (1).pptForming section troubleshooting checklist for improving wire life (1).ppt
Forming section troubleshooting checklist for improving wire life (1).ppt
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
Theory of Machine Notes / Lecture Material .pdf
Theory of Machine Notes / Lecture Material .pdfTheory of Machine Notes / Lecture Material .pdf
Theory of Machine Notes / Lecture Material .pdf
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overview
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 

DevFest 2022 - 為你的專案加點模組化.pdf