7 guests


Introducing CocktailJS

Written by elmasse
Apr 28 2013

CocktailJS is a small yet powerful library for NodeJS. It is mainly intended to explore some concepts in Javascript such as annotations, traits and talents.

CocktailJS Site


As I said the main idea is to explore some concepts. First, Annotations, they are intended to keep Objects and Classes more semantically and abstract the concepts of inheritance, and other mechanisms outside them. As in many other libraries for instance, extends is a method attached to each class. I wanted to move that outside. Yes, many other implement the extend mechanism as an util method - as node does - but I consider that is another problem. Utils are usually reflecting a language or design issue. But this is another story.
Another value added to annotations is they can be used not only when defining classes. In this way we can for instance, use annotations to declare Models without having to extend from a "framework base model".

Traits and Talents

Traits are not new. There are many traits libraries implementations for nodejs and browser as well. I just wanted to explore them a bit differently. The CocktailJS way. We have as well Talents, which are some sort of Traits that can be applied to Objects so you don't need to create a new class to add behaviour.

Read More

Go and visit CocktailJS site. You can find documentation and guides there as well to get you started on CocktailJS , annotations, traits and talents!


7 guests
*/ ?>