We've explored this area in the past and came to the conclusion that classes aren't a great fit to do data-modeling in general, and more especially in Javascript for the following reasons:
If you still think classes and decorators are a great fit, feel free to leave your opinion here š
(JS specific) Decorators are still experimental, so is reflection
That's why Angular 2+ uses them for over 3 years, as well as many apps deployed to productions :confused:
Database types canāt all be expressed by the language primitives. Meaning types need to be defined twice (eg: like TypeORM)
Fixable by simple transform plugin:
https://github.com/MichalLytek/typegraphql-reflection-poc
lack of multi-inheritance
Use class mixins and prefer composition over inheritance?
https://github.com/MichalLytek/type-graphql/tree/9af3077c94f11723615973838320285272634c2f/examples/mixin-classes
poor type-safety with TS
What do you mean?
We think this only works for small/simple applications, and we should encourage for better modularity from the start.
So Prisma2 is designed only for large teams with big enterprise apps? If there are people and teams that uses the TypeORM and TypeGraphQL pattern sucesfully, we should just skip them because they can't be right?
Pure objects are more idiomatic to JS + functional paradigm is becoming more popular
So why Photon is returning Promises instead of RXJS observables? :P
Easier API for higher level frameworks: Building dynamic objects is simpler than classes
Why not both? Have a simple API for building prisma2 from object and then allow for creating decorator API on top of that?
Most helpful comment
That's why Angular 2+ uses them for over 3 years, as well as many apps deployed to productions :confused:
Fixable by simple transform plugin:
https://github.com/MichalLytek/typegraphql-reflection-poc
Use class mixins and prefer composition over inheritance?
https://github.com/MichalLytek/type-graphql/tree/9af3077c94f11723615973838320285272634c2f/examples/mixin-classes
What do you mean?
So Prisma2 is designed only for large teams with big enterprise apps? If there are people and teams that uses the TypeORM and TypeGraphQL pattern sucesfully, we should just skip them because they can't be right?
So why Photon is returning Promises instead of RXJS observables? :P
Why not both? Have a simple API for building prisma2 from object and then allow for creating decorator API on top of that?