DEV Community

Discussion on: Do I really need to create classes in two places?

Collapse
 
cjbrooks12 profile image
Casey Brooks

There are a few languages that work both on the server and clients, which opens the possibility of sharing data models. Most notable here is C# with the Microsoft stack, but more recently Kotlin is working to be a universal language as well.

But in general, as everyone else has mentioned, it is a normal thing for the client and server to create their own models. However, that's not necessarily a bad thing. The server will typically send out much more data than a single client actually needs. You can make your client code cleaner by only including the fields the client needs to work with, and leave the rest out.