3 ms·
Synapse creates a non-trivial Class: https://github.com/bruth/synapse/blob/master/src/synapse.coffee https://github.com/bruth/synapse/blob/master/src/synapse.c
by oscilloscope 14y ago
Synapse creates a non-trivial Class:
https://github.com/bruth/synapse/blob/master/src/synapse.coffee https://github.com/bruth/synapse/blob/master/src/synapse.cof...
Here's the documentation, to get some context:
http://bruth.github.com/synapse/docs/#learn http://bruth.github.com/synapse/docs/#learn
Do you feel that this code would be significantly improved by using JavaScript's bare prototype pattern instead?
- activestylus 14y ago^ Thanks for sharing that. I hadn't heard of Synapse but its the most unobtrusive data-binding lib I've seen so far. Very cool indeed! As far as implementation goes, it still feels "wrong" to me. I love syntactic sugar when possible, but forcing one paradigm on another without measurable benefit (aside from one's comfort/preference) just seems superfluous to me. I would personally implement it using a modular FP pattern, you get constructors, private methods and all those juicy bits we love about OO, except we are in a completely functional state of mind. http://answers.oreilly.com/topic/2177-how-to-use-the-module-pattern-in-javascript/ http://answers.oreilly.com/topic/2177-how-to-use-the-module-... I'd much rather leverage the core strength of a language than try to force it to fit my own habits/patterns. That's just me though :)