Mapping a Domain Model to a Network Entity on Android

Mapping a Domain Model to a Network Entity on Android

CodingWithMitch

3 года назад

18,088 Просмотров

Ссылки и html тэги не поддерживаются


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

shiva Dee
shiva Dee - 28.02.2023 22:22

It's a good idea on design phase for protect your UI layer and for any purpose. I will suggest to mapping object for each layer following this sample if you design the object good enough and you have time to maintenance it. I found this pattern is hell for me on my side job (maintenance the existing object from the other)because they create multiple object with same properties and each object can change into the another Obj. It cause to updating more than 20file after add field just from 1 endpoint. Hope this helpful for someone.

Ответить
Sheth Milan
Sheth Milan - 31.01.2023 15:25

Thanks mitch you're always the best mentor for me in this universe. Day by day I always learn new things from you. You're really a gem man.

Ответить
chubbaka17
chubbaka17 - 30.12.2022 10:24

En-ti-ti

Ответить
Electrical Programmer
Electrical Programmer - 22.06.2022 14:36

Great job

Ответить
Bianca Cionca
Bianca Cionca - 06.04.2022 19:00

thank you for the video, it was great as usual!
I was a bit disappointed for not having the English subtitles.

Ответить
Bitwise DEVS
Bitwise DEVS - 28.02.2022 03:06

Is mapper part of domain or data layer? I want to make sure they are in correct package. Thanks

Ответить
Osezele John
Osezele John - 12.01.2022 00:52

thanks for this Mitch, still seeing this in 2022

Ответить
danyel sh
danyel sh - 24.12.2021 18:31

awesome but where is the English subtitle? |:

Ответить
Vanosuperhero
Vanosuperhero - 18.11.2021 18:51

Thanks!

Ответить
Bharath Kumar
Bharath Kumar - 16.11.2021 07:51

Just an Engagement.

Ответить
Frenzel Timothy
Frenzel Timothy - 20.09.2021 16:17

I found this video is quite helpful, but I have one question.. In what case will we use the domain to entity mapping? Entity to domain mapping is understandable because domain model should only contain what it needs. But how about entity to domain? What if we have 8 attributes in our entity and just 5 in our domain model? Thanks in advance.

Ответить
rvScript
rvScript - 13.09.2021 00:13

Some engagement: this is engaging.

Ответить
Vipul Saluja
Vipul Saluja - 07.09.2021 14:44

I might be a little bit late but really liked your tutorials :) engagement :)

Ответить
tom
tom - 22.08.2021 07:11

Thanks

Ответить
Shashank Daima
Shashank Daima - 16.08.2021 01:12

Although I am late in this course but still "THIS IS YOUR ENGAGEMENT✨✨✨" .Keep it safe.

Ответить
Zialagiaza
Zialagiaza - 13.07.2021 10:24

how to map to domain for single data or not List?

Ответить
Red Fox
Red Fox - 07.07.2021 00:33

Спасибо! Very helpful!

Ответить
Nono Carballo
Nono Carballo - 15.05.2021 18:40

Thanks for the video, I also prefer custom mapper mechanism to the automatic one, but I prefer to do the map as extensions functions on business and network entities.

Ответить
Carson H
Carson H - 08.05.2021 16:36

I don't really like the idea of the mapper interface. I think it confusingly suggests that each network model has a single corresponding domain model

Ответить
Pejman Azad
Pejman Azad - 04.05.2021 23:06

Why not use extention functions for mappers?

Ответить
Yogen P
Yogen P - 28.03.2021 02:56

I'm following this course just after 3 months it was released, and so much has changed in just 3 months.
Need to follow the course and doc simultaneously.
Damn you Android

Ответить
Timofey Tenushko
Timofey Tenushko - 21.03.2021 21:10

That's kind of weird that domain layer should know anything about network layer and it's models. Converters are required but they should be placed in a layer that requires it, and that is definitely not domain.

Ответить
Prakhar Agarwal
Prakhar Agarwal - 03.03.2021 13:30

Thanks a lot @CodingWithMitch

Ответить
Aleef Muhammed
Aleef Muhammed - 30.01.2021 10:06

engage engage...

Ответить
JanFranco
JanFranco - 19.01.2021 13:57

Great work, thanks!

Ответить
Stefan O.
Stefan O. - 09.01.2021 22:49

I aprecciate how you always go back to a whiteboard to explain the concepts at a higher level before you deep dive into code. It's very easy to follow your reasoning.

Ответить
Maryam Alhuthayfi
Maryam Alhuthayfi - 05.01.2021 16:04

some ENGAGEMENT

Ответить
Armando Avila
Armando Avila - 16.12.2020 16:01

Some engagement

Ответить
Emil Frilund Andersen
Emil Frilund Andersen - 14.12.2020 22:17

Quick tip, that has ended up saving me a lot of time: If you have the curser on a word in the code, you can press Ctrl + J, and it will highlight subsequent instances of the word, one per time you press the shortcut. Then, when you highlighted all the words you want, you can edit them all at once, and finally press escape to exit "multi line editing". When I saw you changing all the "entity" objects to "domainModel" one at a time, I thought to mention it. Maybe you already know, but here it is :) Thanks for the amazing content

Ответить
mehdi parsaei
mehdi parsaei - 14.12.2020 10:35

RecipeDtoMapper implements DtoMapper, RecipeEntityMapper implements EntityMapper, and so on. What is your idea?

Ответить
mehdi parsaei
mehdi parsaei - 14.12.2020 10:15

DtoMapper<Dto,Model> for net - EntityMapper<Entity,Model> for database(local)

Ответить
Alex Rusanovschi
Alex Rusanovschi - 13.12.2020 21:22

Some ENGAGEMENT left...

Ответить
Rafif Aditya
Rafif Aditya - 13.12.2020 07:54

I use lombok plugin for my model, well this is interesting if combining

Ответить
Muhammad Naveed
Muhammad Naveed - 13.12.2020 01:36

Always Like before watching videos. enough engagement with Mitch.

Ответить
Shehram Jamil
Shehram Jamil - 13.12.2020 01:01

Well that is good piece of code.
I did the same thing using for each loop for transforming from one model into another. Map serves the same purpose.
Good work

Ответить
DevWithGeraud
DevWithGeraud - 13.12.2020 00:38

Great video as usual Mitch. Thanks

Ответить
Letrix
Letrix - 13.12.2020 00:08

Is that really needed? I'm working fine with a simple POJO. It could be useful if you want to change the way the API returns the data and make it easy to adapt without changing the UI.

Ответить
Mahmoud Hesham
Mahmoud Hesham - 12.12.2020 23:12

Greate tutorial, can't wait for the next episode .... I'm just a little bit confuse about were should I put my logic code like if I am making a mathematical operation should it be in view model on in a repository

Ответить
Aliton Oliveira
Aliton Oliveira - 12.12.2020 22:19

Why should we use interface() instead of simple methods in the activity?

Ответить
Sam Ha
Sam Ha - 12.12.2020 21:46

The BEST android courses in the world confirmed

Ответить
Bardya Momeni
Bardya Momeni - 12.12.2020 21:12

You could name your network model RecipeDTO, DTO is abv for Data Transfer Object

Ответить
Ramakrishna Joshi
Ramakrishna Joshi - 12.12.2020 20:55

Mitch, I feel that mappers are used to inject business logic to the Entity Data so that we show refined data in the UI. I also feel that the fields in Domain Model should be non-null as they would be used by UI. Am I right?

Ответить
Soothing Life
Soothing Life - 12.12.2020 19:00

i didn't quire understand what does entity mapper and network mapper do , i could understand the conversion between both but why do we need mappers here , thank you for the answer in advance

Ответить
Alon Shlider
Alon Shlider - 12.12.2020 18:37

Why don't you just create a static method inside the view's model class that constructs that model from a different model (say a network model)?

Ответить
Felipe Gouveia
Felipe Gouveia - 12.12.2020 18:32

Nice video! Do you think that adding a video for testing the mapper class would be useful? Although straightforward, I think the content could fit for the beginners audience and it's something you would do in a real project.

Ответить
suresh
suresh - 12.12.2020 18:10

Waiting for this thanks Mitch please make a video on scopped storage using jetpack compose

Ответить