4 ms·
I think people here are totally missing out on appreciating a very thoughtfully written post by focusing on the fact that he may be comparing programs written i
by adrianm 13y ago
I think people here are totally missing out on appreciating a very thoughtfully written post by focusing on the fact that he may be comparing programs written in his favorite language to your favorite language. He is not asking for Scala solutions to any problem - and he has not contrived a deceptive Scala solution to "prove" the superiority of his language of choice.
He's comparing the structure and design of programs between two great languages of similar capabilities (features) and philosophies. I think his point about lightweight data modeling is spot on - Clojure is a language that goes out of its way to make modeling your problems idiomatically painless and dramatically simpler than most other languages.
It's idiomatic in Clojure to use plain old maps to represent structures or entities in your program that you would otherwise represent with a class or equivalent construct in many Object Oriented languages. That isn't a code smell either - it's idiomatic and wonderful. Keywords (similar to Ruby symbols in both use and philosophy) are wonderful things that together with maps make enums as a language primitive irrelevant.
- lispm 13y agoIt's basically a kind of step back to the Lisp of the 60s and seventies. Unfortunately I don't think this approach scales well. For example I prefer to look in a debugger or inspector at an object and not at some other map.
- adrianm 13y agoI'm going to be honest - you are coming off as very contrarian for the sake of being contrarian. You seem to be consistently responding to my comments in this thread with the equivalent of "You're wrong, because I like to do things this way." That isn't an argument against any point I've made. Please show me some code and give me some context that will make me rethink my assumptions and arguments if you feel the need to point out my flawed thinking.
- lispm 13y agoNo, plain maps are nothing more like plain assoc lists (and similar stuff) in plain old Lisp. We were modelling key/value data structures like that from the earliest Lisp. Sure its easy to use. Up to a point. Lisp had an evolution. Things changed. I've seen quite a bit larger Lisp software over the years and the ones not using explicit classes turned out to be harder to maintain.
- weavejester 13y agoI'd contend that it's the one approach we know does scale well. The largest systems we've built, such as the web, are designed around bare data structures, rather than objects.
- dragonwriter 13y agoNo, large heterogenous systems like the web are built on serialization formats that different components within that same heterogenous system can (and do) interpret as either bare data structures, objects, or just unstructured streams of text (or binary data.)
- weavejester 13y agoSerialised data is still data - a sequence of bytes representing a JSON object is still semantically the same when it's decoded into a hash map. The information content remains the same.