Published on

Things I liked about Ruby on Rails and Symfony2 that I sometimes miss in NodeJS


In the past couple of years I've had the luxury of playing around with a multitude of different languages and frameworks on a daily basis. From developing front-ends in vanilla javascript with a little bit of help from jQuery and frameworkless PHP sites to structured web-applications in Ruby on Rails, PHP Symfony2 and NodeJS with express and meteor.js. Switching to nodejs on the back-end has had a lot of advantages for me, being able to program both front-end and back-end code in the same language greatly reduces context switching and decreases the mental gap between front and back-end teams. NodeJS and javascript give great amounts of freedom of development style. NPM is a vast resources of starting points for any project, which massively improve productivity and allow you to get ideas working quickly.

I've found that this flexibility comes with a cost though. In the olden days of Ruby on Rails and Symfony2 the idea of convention over configuration helped create a structure for developers to organize their code. Even though there are plenty of frameworks that do similar things in nodejs, there simply isn't a singular "Rails way" of doing things like there used to be in the Ruby on Rails world. Creating an application in Symfony2 forced you to think in doctrine terms of entities, form validators, controllers and services and migrations. I agree, this kind of structure restricts you from doing fancy extraodinary things but for the bread and butter applications and API's it is such a relief to know exactly in which folder and file every piece of functionality will be.

Still, the advantages of nodejs outweigh these downsides and if you want to adhere to more opinionated styles of programming in nodejs there are frameworks such as Hapi.js and Sails.js that will allow you to structure your application in a similar way. The thing is that every nodejs developer is simply used to using thousands of different packages and everyone uses different patterns to ship stuff fast.

I'd be really interested to get a discussion going, how are you guys thinking about conventions in structuring web applications, should there be more of a generic "Node way" of building applications or should we just embrace the fact that we have a new library every day that allows us to create cutting edge functionality?