Re:.NET 5.0 – New APIs
by kords on Wednesday September 23, 2020 @02:32AM
(#24563666)
Typically modules come with their own contracts. Even in the backend by itself, we see same class definition as a model, as an entity and as a business object.
OOP also had goals regarding reusability (see criticism section - https://en.wikipedia.org/wiki/Object-oriented_programming). Reusing the same code is hard.
[ Parent
| on HN ]
Re:.NET 5.0 – New APIs
by manigandham on Wednesday September 23, 2020 @02:42AM
(#24563714)
True, but it's much harder in some languages than others, and much much harder when crossing language boundaries.
Copying a C# class to use as a DTO from a database entity is way faster than trying to worry about serializing to a JSON structure while maintaining all the fidelity (like dates, big ints, binary data, etc).
Another example is reusing business logic like validation for data input. Blazor lets you use a single layer of logic instead of using JS-based simple validation on the form and more detailed checks on the server.