Architecture: The data layer - MAD Skills

Architecture: The data layer - MAD Skills

Android Developers

2 года назад

74,826 Просмотров

With this episode of MAD skills we are starting a series of videos dedicated to architecture. In this video you'll learn about the data layer and its two basic components: repositories and data sources. We'll also cover data immutability, error handling, threading, testing and more tricks and recommendations with Developer Relations Engineer Jose Alcérreca.

Architecture Guide → https://goo.gle/mad-architecture
Kotlin Flows guide → https://goo.gle/360rqlh
Guide to background work → https://goo.gle/35U42WT

Catch more videos on the Architecture guide → https://goo.gle/Architecture
Watch more MAD Skills episodes → http://goo.gle/madskills
Subscribe to Android Developers → https://goo.gle/AndroidDevs

#Featured #Latest #MADSkills


Product: Android - General

Тэги:

#pr_pr:_Android #series:_MAD_Skills #type:_Screencast_(0-10min) #GDS:_Yes #mad_skills #modern_android_development #developer #developers #android_developer #android_developers #google_developers #android #google
Ссылки и html тэги не поддерживаются


Комментарии:

Levi Nuñez Marte
Levi Nuñez Marte - 04.05.2023 20:37

How do you test a repository with two different data sources (LocalDataSource and RemoteDataSource)? Should I create one interface and make local and remote data source classes implement this interface? –I saw this approach in one of Google's app samples, but I don't like it because you are forcing each class to implement methods they don't need– Or should I create two separate interfaces, one for local data source and another one for remote data source and then make the repository depend on these two interfaces? I would prefer the second approach, but honestly writing tests for 3 separate classes (Repository class, LocalDataSource class and Remote Data Source class) might be a bit of a hassle.

Ответить
Tadeusz Kurpiel
Tadeusz Kurpiel - 02.02.2023 03:40

Great! It is a lot of informatin! I think I have to watch this video many times, and deep dive into the additional documentation to fully understand all the topics mentioned here...

Ответить
#Mondoshawan
#Mondoshawan - 18.11.2022 01:25

📱🇨🇴🙋🏻‍♂️👍🏼🤝🏼

Ответить
Flora George
Flora George - 04.10.2022 07:33

I love this app for is a life best activity

Ответить
Life in {0&1}
Life in {0&1} - 23.09.2022 07:40

Is it good practice to update local database on separate thread with the data received from networkDataSource...?
suspend fun fetchNews(): List<Article> {
try {
val news = remoteNewsDataSource.fecthNews()
Thread { localNewsDataScource.updateNews(news) }.start()
return news;
} catch(ex: Exception) {
}
return localNewsDataSource.fetchNews()
}

Ответить
S R
S R - 26.08.2022 10:53

Very nice

Ответить
Rohan Manchanda
Rohan Manchanda - 08.08.2022 19:21

Hello from August 8, 2022.

Ответить
Mu Sa
Mu Sa - 05.05.2022 16:37

Perfect Architecture, but still after I have built many projects I don't believe we should always create "Repository per one Resource" and "Data Source per one Resource and Source Type".

Yes, as I said before it is perfect architecture, but I don't think this should be implemented for all projects, maybe only for large huge projects, right?

I used to create many many classes and files to follow previous architecture rules, and each time I wanted to refactor my data layer because of changing for example specific API Layer Data Source (which may responsible for 30% of all used APIs), this will cause to change many classes and files including their definitions, and in my opinion this is too much to do, there is no point of doing this.

In my point of view, we should separate Repositories and Data Sources only if we have "need" to do this otherwise even if that considered as good from an architecture point, but still it is not proper to be implemented until being really needed.

Any thoughts?

Ответить
Per-Erik Bergman
Per-Erik Bergman - 19.04.2022 11:32

What is the motivation behind moving business logic down to the data layer?

Ответить
Александра Пантелеева
Александра Пантелеева - 31.03.2022 15:10

Боольшое спасибо автору,классное видео)

Ответить
Ibrahim Disouki
Ibrahim Disouki - 25.03.2022 15:37

Thanks for the great video!
I hope you talking about error handling across all layers and which layer is responsible for what, with a simple example!

Ответить
Anqing MA
Anqing MA - 20.03.2022 10:56

I found a small inconsistency in the naming of the Repository. The naming convention in the documentation is `NewLocalDataSource`, but in the video it is named `LocalNewDataSource`, a correction is suggested. doc:

Ответить
Iván Sánchez
Iván Sánchez - 18.03.2022 08:27

Cool video

Ответить
View 2637 replies
View 2637 replies - 18.03.2022 06:00

Very good info. I started my architecting journey with MVP architecture. It could be an overwhelming experience, but totally worth the hassle.

Ответить
Peter Fischer
Peter Fischer - 17.03.2022 16:35

Thanks for the great video Jose!
I'm curious why did the Android team decide to have the data layer depend on the domain layer and not the other way around?

Ответить
Tunji Dahunsi
Tunji Dahunsi - 17.03.2022 16:23

What does the data layer say when it's initialized?

Data da daaaaaa!

Ответить
Don Turner
Don Turner - 17.03.2022 16:15

Great start to your modelling career, Jose

Ответить
Don Turner
Don Turner - 17.03.2022 16:11

Where does the MonsterRepository live?

In the data lair

Ответить
Nick Butcher
Nick Butcher - 17.03.2022 15:55

Jose is the MVP

Ответить
Muhammad Ammar
Muhammad Ammar - 17.03.2022 12:31

Good demonstration.I am waiting for the next <3

Ответить
SS Verma
SS Verma - 17.03.2022 10:38

Keeping separate model for Remote and Local data sources is good for long term ... Like: RemoteArticle and LocalArticle ... and expose "Article" domain object only from Repositories

Ответить
Kat Kuan
Kat Kuan - 17.03.2022 01:48

Nice overview Jose!! This video is a great "repository" of information! 😜

Ответить
Daniel M. Maendeleo
Daniel M. Maendeleo - 17.03.2022 01:26

Neat🤜

Ответить
Code with the Italians
Code with the Italians - 17.03.2022 01:23

Love the style 😎

Ответить
Vivek gupta
Vivek gupta - 16.03.2022 21:50

Eagerly waiting for next.

Ответить
sayyid basil
sayyid basil - 16.03.2022 21:19

Great 👍

Ответить
Maxwell Mapako
Maxwell Mapako - 16.03.2022 21:12

"This is out of the scope of this video" I see a joke that can be made here..


Kotlin coroutine scope 🤣

Ответить
Ookie
Ookie - 16.03.2022 20:22

Awesome video! Thanks for the detail!

Ответить
Rajeet Goyal
Rajeet Goyal - 16.03.2022 20:22

Great 🔥👏

Ответить
Elias Pujols
Elias Pujols - 16.03.2022 20:14

🔥🥂 Mad Skills

Ответить