3 ms·
Thanks for the suggestions, but a lot of the things you dislike were choices made very purposefully. 1. POJOs are ugly and you must revert back to using Object
by keithwhor 11y ago
Thanks for the suggestions, but a lot of the things you dislike were choices made very purposefully.
1. POJOs are ugly and you must revert back to using Object.create() for inheritance, breaking the design pattern of using ES6's class syntax.
2. PascalCase class <-> camelCase instance <-> underscore_filename <-> underscore_tablename is a standard borrowed from Rails and easily managed through the npm inflect module (i).
3. It's just a shortcut. You can use normal CommonJS require(), you'll just have to resolve the relative path yourself.
4. Thanks! :)
5. Models can exist without database connections and with manually defined schemas. If you check through the commit history, I used to keep database and model completely separate but there was way too much code reuse / smell (passing in a db as a parameter on every function call).
6. The alternative is setting properties with ClassName.prototype.value = 'xyz'; or ClassName.value = 'abc'; Static methods provide an easy to read + concise way to do this for you (and take care of additional functionality). Also borrowed from Rails.
7. Chose that pattern because it is very explicit / ordered. How do I determine what order the routes are hit when I specify them per Controller? And if I define them on the Controller, that means I need to load all Controllers globally on Application start.
8. I'm happy with how clean the code is now. :)