3 ms·
My favorite red flag, a class with a name as generic as 'Object', indicating the ultimate not-invented-here case. https://github.com/fastmail/overture/blob/mas
by lpghatguy 9y ago
My favorite red flag, a class with a name as generic as 'Object', indicating the ultimate not-invented-here case.
https://github.com/fastmail/overture/blob/master/source/foundation/Object.js https://github.com/fastmail/overture/blob/master/source/foun...
Or better, 'Class':
https://github.com/fastmail/overture/blob/master/source/core/Core.js#L424 https://github.com/fastmail/overture/blob/master/source/core...
JavaScript has classes! What are you doing?
- chrismorgan 9y agoWhen writing data binding systems, you tend to need to have a generic base class to provide the basic magic functionality; it can’t be done any other way unless you strictly separate functionality from data (perhaps using an immutable data approach) which tends to makes the library less usable. So this ain’t NIH; it’s a legitimate and very popular architectural pattern. On a more flippant note: the name Object is a bit unfortunate due to its collision with the builtin global Object; we used to write `O.Object` everywhere, but now we’re using imports for such things we’re calling it Obj everywhere else, so I intend to rename it to Obj altogether one of these days. For Class: yes, JavaScript has classes now. It didn’t five years ago. On of my experiments involves removing the magic from Class (moving it into the Obj constructor), leaving it just a shell, with class syntax available for use. But even then, class syntax isn’t perfect; prototypal inheritance is really pretty cool and lets you do some very nice things that class syntax doesn’t let you do (I’m planning a conference talk about prototypal inheritance, including some of Overture’s magic that is possible because JavaScript uses prototypes rather than classes); because of that, we may not adopt native class syntax.