jinroh / kadoh

The Kademlia DHT in Javascript for Node.js and Browsers
http://jinroh.github.com/kadoh
Other
242 stars 31 forks source link

Organize as Classes #9

Closed alexstrat closed 12 years ago

alexstrat commented 12 years ago

Organize client side code as Classes with appropriate namespaces..

Find the appropriate framework that works both on client side and Node (for testing and benchmarking).

avoidusingcomplexdesignpatternsinwhichweneverknowwhatisThis

alexstrat commented 12 years ago

mis ce qu'il faut, je vais adapter le code pour te montrer

alexstrat commented 12 years ago

A part/module of KadOH shoul be declared like that :

(function(exports){
  var KadOH = exports;
//Dependencies
  var Class = KadOH.core.Class;

  KadOH.sub = {};
  KadOH.sub.module = Class({
    initialize : function() { .....},

    method1 : function(){ ......}

   });

})('object' === typeof module ? module.exports : (this.KadOH = {}));

See https://github.com/ded/klass

jinroh commented 12 years ago

C'est tout on il faudra rajouter des trucs pour le testing à la mode de socket-io.client ?

alexstrat commented 12 years ago

Je sais pas encore..

jinroh commented 12 years ago

Je l'implemente comme ca pour l'instant dans les fonctions déjà faites ou tu es peut être entrain de la faire ?

alexstrat commented 12 years ago

Non vas y !

alexstrat commented 12 years ago

Pffff.. Attends 2 sec, je pond un truc et tu me dis ce que tu en penses...

jinroh commented 12 years ago

Ah merde ... j'avais pas vu ... (!!)

alexstrat commented 12 years ago

Pas grave, j'ai besoin de réfléchir de toute manière et de ton avis en plus donc bon.. Je vais me chercher un macho je reviens ! ;)