Hello :wave:, quick question about data mapping? W...
# announcements
f
Hello đź‘‹, quick question about data mapping? What would you use to map an object (eg: a
RemoteUser
received by a backend to a
User
object used by the business logic inside an app)? I used to do it via Interface + Implementation
Copy code
interface IUserMapper {
    fun remoteToEntity(remote: RemoteUser): User
}
, what is the real benefit than doing it directly with an extension function ?
Copy code
fun RemoteUser.toUser() = 
...
(except mocking) 🤔
âž• 1
g
except mocking
Well, it’s only part of it, it just an abstraction, which allows you to replace implementation (mocking is one of such use cases), and itэы your decision, do you want more abstract and flexible code or you want it more simple
đź‘Ť 1