Forgetting android v2

Post on 22-Jan-2018

890 views 1 download

Transcript of Forgetting android v2

Forgetting Android v.2Jorge Juan Barroso Carmona

jorge@karumi.com@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

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

Conclusion3

http://www.flickr.com/photos/inf3ktion/

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

Find meI am very social!

jorge@karumi.com@flipper83+JorgeJBarroso

Questions?