Replies: 6 comments 12 replies
-
i think giving DI over mongoose sounds great then we can use "mockingoose" library to mock a resource/model without ever touching production database |
Beta Was this translation helpful? Give feedback.
-
We had some previous discussion on Object Oriented too - @xoldd |
Beta Was this translation helpful? Give feedback.
-
I still think this will be a worthless endeavour. In graphQL servers dependency injection is accomplished using the graphql context that is available to every graphQL resolver and has the global lifetime of an http request. Although it is not an advanced all encompassing form of dependency injection, it gets the job done for most use cases.
This is certainly not true. Nest.js is only good as long as the packages and integrations it officially supports are being used. As soon as you introduce a non-supported dependency, you'll will have to do weird hacks and workarounds to make it work in the way nest.js wants things to work. Anyway, for a graphql server graphql-modules would be a better choice than nest.js. |
Beta Was this translation helpful? Give feedback.
-
I appreciate the vigorous, respectful discussion. It’s important to have debate, especially as we’re going to need to chart the medium term goals of the various apps in the near future. Remember the code of conduct. We are close to the line. |
Beta Was this translation helpful? Give feedback.
-
I plan to listen to the YouTube video to understand the context of OOP dissent. |
Beta Was this translation helpful? Give feedback.
-
The tone of the video gets progressively less extreme. He eventually has some common sense suggestions. In the beginning:
Then he makes the recommendation that if OOP is to be used, then simplify the code base by:
He then lists his recommendations, and these points were not mentioned earlier in the video
I'm not versed in the various Javascript flavors, and don't code in it. This is why I try to challenge you to justify your assertions to evaluate the merits. Based on the video, I don't see a compelling reason to migrate to a superset of Typescript. We already suffer from package deprecation fatigue. Exacerbating this by hiding complexity under abstraction doesn't seem to be wise. He admits that:
It's not a controversial approach. |
Beta Was this translation helpful? Give feedback.
-
Currently the structure of our code is not very rigid and testable. We are not facing too many problems because the number of external services are less. Like we are using only Mongoose which don't require Dependency Injection to test, but at the same time we have Redis which is not being tested because we don't have DI in our codebase. We expect the app will expand in future and more services will add to the codebase. Addition of more services and features can become messy if not tested. Unfortunately Nodejs don't provide a strong structure and hence DI is very tough in it. Packages like
tsyringe
are buggy. So I suggest to move to a move to a stronger framework used by many closed-sourced organizations like Nestjs. This framework is very similar to Node, therefore migration will not be that tough. It will provide OOPs and class based design pattern used by many big scaled organizations using java as backend. Maintenance, re-usability and testing would become easy by this.Beta Was this translation helpful? Give feedback.
All reactions