forgetting android v2
TRANSCRIPT
Forgetting Android v.2Jorge Juan Barroso Carmona
[email protected]@flipper83+JorgeJBarroso
Android expert
Basho. Poet
Karumi is the beauty of ordinary things spoken of in a simple way.
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.Martin Fowler
1 Solid
Single responsibility principle
Open/closed principle
Liskov substitution principle
Interface segregation principle
Dependency inversion principle
Clean Architecture2
A good architecture allows you to defer framework decisions. A good architecture allows frameworks to act as plugins to the app.Robert Martin
“The database is a detail, a hardware detail. We would not use one at all if all our data could fit in memory for ever”
UI
ExternalInterfaces
Db
Push
Network
Storag
e
Inte
rface
s
Inte
rface
s
BusinessModel
Interactors
Interactors
UILayer
UILayer
UIData Model
Data Mapper
Interactor
BussinesData Model
DataStorage
TestStorage
Data Mapper
Data Mapper
StorageData Model
TestData Model
FeedViewModel
FeedBoundary
FeedListFragment
FeedProvider
GetFeed GetFeedImp
List<Hipster>
UserDataSource
Net
Use
rDat
aSou
rce
Like
Dat
aSou
rce
LikeDataSource
Parse
API
UserApi
API
Retrofitapi
Parseapi
UI Layer Domain Layeruse Cases
or Interactors Data sources
FeedViewModel
FeedListFragment
FeedPresenter GetFeed
Hipsters
UserRepository
LikeRepository
Use
r Dat
a so
urce
UserApi
Like
DS
Retrofitapi
DbView
Syncronous
LikeApiRetrofitapi
Parse
UserDBParse
Parse
UI Layer / MVPDomain Layer
Use cases Data sources
HipstersRead only
Good Layer Responsabilites
Easy to test and mock
Easy to add or modify code
Easy to hide implementations
Easy to find smells
Async code
Duplicate data model
Change your mind
Not silver bullets