(Unifying the coding methodology / pattern)
The choice of one language was just a start at the task of unifying this fledgling stack and once again we are going to start at the top. The mission now is to unify the coding methodology (or software patterns) throughout.
At the top of the stack all UI interaction in the browser’s DOM is transmitted by events. You subscribe to that click event and do something in response. To follow suite in browser and server the “PubSub” software pattern, offers a natural fit. The browser's DOM is full of events, and with this pattern we can keep the events propagating all the way through our application. PubSub.js is a small, nicely simple, implementation of custom events, that makes it easy to publishing them and subscribe to them.
See the Graphlet Project for a demo of a DOM click event publishing an event and a subscriber to that event.
PubSub.js is easily extended to subscribe to the DOM events, as well as orchestrate the logic of your web application. Then to communicate with the server, we’ll use the same pattern to publish an HTTP request out to a web server, and subscribe to its response. [[ Event are natural to the web, from the DOM to REST APIs...]]
Drilling down, we can keep the event programming model going. On the server its already built into Node.js. The event model is a core philosophy of Node.js. Server side events can handled with the built in EventEmiter or we can make a slight variation to PubSub.js to make it into a Node module.
Nodejs is easily wrapped as a pubsub subscribe and pubsub publishing to move into application logic.
Next into the the Data layer with MongoDB