|
|
|
|
|
by fetbaffe
3388 days ago
|
|
No, I don't want to share models between the client and the server. I want an API dependency between them, a code dependency is actually worse. Why should the frontend change when the backend changes it´s abstractions? I want to change them independently, because they have different constraints and dependencies. If you are implementering your database schema in the frontend, you´re doing it wrong. An API is a view against a domain, which in turn is an abstraction above the database. However the client is not aware of the entire domain and shouldn´t be. Only thing that is a good idea to share is the domain language and the API interface, but can be solved easily by other means than share code base. And as soon you throw in another client with an other programming platform, all the benefits is lost anyway. |
|
There may be technologies like protobuf to define those structures in one place, but i can still imagine there are cases where it could be useful ( business rules and validation, etc).