You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.
I'm wondering in the scaffolding code, looking at articles for example, the controller might have something like exports.create = function(req, res) { which is good, but feels kind of functional opposed to object oriented, ie module.exports = function() { var ctrl = new Articles(); return ctrl; }
I'm curious to hear the reason the scaffolds do it this way opposed to new'ing up an object that that has public/privileged methods exposed?
The text was updated successfully, but these errors were encountered:
Check out this talk and see what Douglas Crockford thinks about using "new" and about OOP generally. Specifically, this pattern is consistent with the common usage of Express.js - and as such, we choose to prefer it over alternative styles.
I'm wondering in the scaffolding code, looking at articles for example, the controller might have something like
exports.create = function(req, res) {
which is good, but feels kind of functional opposed to object oriented, iemodule.exports = function() { var ctrl = new Articles(); return ctrl; }
I'm curious to hear the reason the scaffolds do it this way opposed to new'ing up an object that that has public/privileged methods exposed?
The text was updated successfully, but these errors were encountered: