Nuff.js, a shiny new javascript framework

Why Nuff.js

This framework is an attempt at a simpler communication for web applications that use a view management or templating framework, it was built to work especially well with React.js. The idea was born after I implemented flux first with vanilla js and then using Reflux. However the communication remained obscure and overcomplicated in my opinion for anyone joining a complex flux project.


Why the Model View Presenter pattern ?

When first working on this project I researched coding patterns that would fit what I had in mind and MVP was something that seemed to look like what I wished to accomplish. Nuff.js is thus a loose interpretation of the MVP pattern. The fact that React views only need data objects as presentation logic makes for very simple presenters. In this sense, binding presenter methods to views allows to completely decouple views from the rest of the application. The idea being that presenters are associated to models and collections, they organize data structures into the way they need to be presented for the view. The fact that React.js relies on a simple setState method to update its views allows us to easily rerender elements after change since the preseneter is made to have a reference of the view. This avoids needless pubsub communication. The view binds events, the presenter queries models and sets the views’ states accordingly.