ettore

A IoC / Dependency Injection Container for node.js

Ettore

Ettore is a node.js dependency injection container built using coffee-script.

It provides a project a huge boost in productivity, modularity, and overall testability and effeciency. By de-coupling all your components and allowing each dependency being managed not by it's used class or component but a system wide manager that it's job is that.

Your classes / components will not know how or where an object is coming from. It doesn't need to load or require anything. It just needs to use the object and get the job done.

When in testing mode, you can mock specific objects to your needs. Because many systems you want to test rely on or have dependencies themselves this makes testing extremely hard, as your not only testing that module but it's dependencies and how they work.

For example, let's say your testing a controller within a model-view-controller pattern. Your controller is of the following:

class App.ApplicationController extends DefaultController
 
    index: ->
        @readDatabase()
        @render 'someView'

You only want to test rendering through a controller and nothing else. Well here you have a problem. Your depending on the database to do some action; in this case, reading or fetching. You could instead create a Database mock that would remove any database action.

This is what you can do with Ettore.