3 ms·
Objects do too much to live in a heterogeneous world. We'd do better serializing maps (JSON is popular, of course, but EDN is better) and operating on them usin
by Zak 14y ago
Objects do too much to live in a heterogeneous world. We'd do better serializing maps (JSON is popular, of course, but EDN is better) and operating on them using generic functions rather than trying to bind functionality to data. It's easy enough to serialize the properties of a UI widget when the functionality is data-driven and lives elsewhere.
- jes5199 14y agoI think you're probably right? I mean, with the tools available in 2013, I certainly agree that the Clojure way is the least crazy. But I miss some OOP stuff when I'm doing that - like, I kinda like the organizational qualities of OOP; lots of the time I wish I had ruby-style polymorphism (on immutable structures?) instead of having to put all the logic in one function. Maybe that means I should just learn how to use defprotocol. But I guess that still doesn't give you an event model - what's the EDN equivalent of onClick ?
- Zak 14y agoYou should learn how to use records, protocols and hierarchies if you want to organize things that way in Clojure. You'll have to be a bit more ad-hoc about the same kinds of things when you're sending them to Javascript or storing them in a database.