The Node.js philosophy
suggest changeSmall Core, Small Module :-
Build small, single-purpose modules. That means a small scope, not only a small file.
a - "Small is beautiful"
b - "Make each program do one thing well."
The Reactor Pattern
The reactor pattern is the heart of Node's asynchronous design. One thread runs an event loop, which dispatches events to handlers.
libuv is the library that implements that loop and the thread pool for the I/O that cannot be done on the loop itself.
The Observer Pattern(EventEmitter) maintains a list of dependents/observers and notifies them
var events = require('events');
var eventEmitter = new events.EventEmitter();
var ringBell = function ringBell()
{
console.log('tring tring tring');
}
eventEmitter.on('doorOpen', ringBell);
eventEmitter.emit('doorOpen');
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents