14 ms·
Even if it's not usable for other, it could be a great resource as an example MEVN stack app for newer developers to learn from. Props to you guys for open sou
by atymic 7y ago
Even if it's not usable for other, it could be a great resource as an example MEVN stack app for newer developers to learn from.
Props to you guys for open sourcing it!
- PretzelFisch 7y agoHow would someone judge the code quality and architecture to say this repository is a good example and how? Wouldn't the general tutorial and training material be a better source then a startups ship it now code base?
- Jaygles 7y agoThe code itself doesn't have to be good to be a good example. One thing the average tutorial doesn't have is complexity. Picking apart how this code handles complexity could be a good lesson to people who are trying to learn how to architect good sized projects.
- dfcowell 7y agoOnly if the reader is discerning enough to notice when they’re looking at a bad implementation. Otherwise there’s a risk of learning bad practices.
- dfcowell 7y agoUnfortunately the repo has some truly awful antipatterns. The catalog service is a masterclass in how not to write Node.
- anonytrary 7y agoI think the controller/service abstractions are completely unnecessary and cause unwanted indirection. Otherwise, this looks like a typical CRUD service -- with custom logging, database model schemas, authentication, and routes that utilize all of the above.
- ozfive 7y agoSo fix it!!! It's open source. Put some work in, or your complaints fall on deaf ears.
- anonytrary 7y agoYou're assuming quite a lot. First, I'm not saying it's broken, so what is there to "fix"? Second, I'm not using this library, so why would you expect me to submit a PR? People aren't expected to contribute to libraries just because they noticed a smell in the code. Open source is about contributing to stuff you use. You don't have to (and shouldn't be expected to) fix everything you see broken in in the world.
- ozfive 7y agoAre you even going to write a line of code to fix any of the 'awful anti-patterns' you mention or am I just going to get downvoted on Hacker News. For Christ's sake, this is why open source is failing. You all like to complain more than you actually do anything at all to fix things. Exactly the reason I never open source a line of code. There is no true community it's just a bunch of wankers that would rather complain about anti-patterns then make things better. Fuck.
- preommr 7y agoseems pretty normal, what's so bad about it?
- dfcowell 7y agoThanks for the question - for clarity, this is the file I'm referring to in this reply: https://github.com/Viveckh/Veniqa/blob/develop/shopping-server/services/catalogService.js https://github.com/Viveckh/Veniqa/blob/develop/shopping-serv... 1. The service is a leaky abstraction, it knows about HTTP status codes and presumably the response body format. The point of separating concerns is to make code reusable, HTTP response codes don't make sense outside of a HTTP call. Similarly, any calling code needs to know that `sortRule` is expecting a MongoDB sort parameter. 2. The control flow is super unclear due to mixing async/await and Promise API coding styles. The `.catch()` call on the promise chain means that the `catch` block will never be hit and the API will always return OK, with the error object exposed to the client in the `responseData` - likely exposing implementation details about the server via the stacktrace on the error object. There are other nits I could pick, but those are the most important issues and my other criticisms are more a matter of preference.