5 ms·
This looks incredibly cool, but if there is one thing that I've learned, it's that less magic is generally better when building a real production application (v
by bunkat 14y ago
This looks incredibly cool, but if there is one thing that I've learned, it's that less magic is generally better when building a real production application (vs a weekend project). While typing something like 'sails generate model User' is nice, I literally have no idea what that just did. In the video it then shows a user creating new attributes on the model via a REST API - what??(he even mistakenly adds a bad attribute and then proceeds to just leave it there...).
After working with a few of these frameworks it always seems to lead to spaghetti code where the code I write weaves in and out of the framework at different pre-defined connection points (Sails calls them policies I think). I always take note of all the times the developer says 'automatically', these are all the places that will break when my requirements don't exactly match up with theirs.
- rane 14y ago$ sails generate model User $ git diff
- awj 14y agoIn my mind "I need to turn to my version control system to have a clue what just happened" is a great example of having too much magic for a production product.
- deleted 14y ago[deleted]
- methehack 14y agoIt's a generator. It generates files. Typing it out would be less magical, but then it wouldn't be a generator. To me, git diff seems like a fine way to see what it did, tbh.
- widblom 14y agoAgreed.
- sideproject 14y agoCouldn't agree more. On a different topic, I've been toying with various JS MVC frameworks, but a lot of them tries to do their "magic" without actually explaining why the magic is necessary. These so called "conventions" at times hide way too many things, it actually makes it frustrating to understand. In the end, my choice came back to Backbone, which is the minimalistic framework. Having said that, I'm trying to pick up NodeJS soon, what frameworks would you recommend to start off with? Express?
- andypants 14y agoYes, express is very simple, and easy to learn and write. It's also the most popular web framework for node.js. It's less like rails/django and more like sinatra/flask.
- mikermcneil 14y agoHey guys, I wrote Sails.js. The controllers are just sets of Express middleware. The reason I did it this way is that I wanted a conventional abstraction (MVC) without the burden of a new API. The only real "magic" here is how Sails handles Socket.io requests using the same controllers. Sails generates req/res objects for socket requests and allows you to handle WebSocket requests in the same code base as the rest of your app. If you need to do more custom stuff, you can still directly access Socket.io through sails.io, and each request object that came from a socket request contains req.socket, which gets you access to the socket which sent the message.
- nilliams 14y agoThe argument (as I see it) against choosing something like Backbone in order to avoid framework "conventions" is that you inevitably end up inventing your own conventions to fill in the gaps. Fine if you're a one-man team (although still arguably only in the short-term), but if not, all you've done is shifted the "conventions" problem onto your co-workers, only now they have to learn yours, rather than the (hopefully) well documented and worked-out conventions of the framework you tried to avoid to begin with. (I'm currently using Backbone by the way, but very conscious that it could be a short-sighted approach - basically I'm keeping a keen eye on Ember)!