37 ms·
I happened to read this interview (http://www.codequarterly.com/2011/rich-hickey http://www.codequarterly.com/2011/rich-hickey) with Rich Hickey today which I'm
by jeremyjh 14y ago
I happened to read this interview (http://www.codequarterly.com/2011/rich-hickey http://www.codequarterly.com/2011/rich-hickey) with Rich Hickey today which I'm sure has been posted here before. I mention this because of this statement:
> When we drop down to the algorithm level, I think OO can seriously thwart reuse. In particular, the use of objects to represent simple informational data is almost criminal in its generation of per-piece-of-information micro-languages, i.e. the class methods, versus far more powerful, declarative, and generic methods like relational algebra. Inventing a class with its own interface to hold a piece of information is like inventing a new language to write every short story. This is anti-reuse, and, I think, results in an explosion of code in typical OO applications. Clojure eschews this and instead advocates a simple associative model for information. With it, one can write algorithms that can be reused across information types.
- Evbn 14y agoEh, An object can expose an array interface or whatever for use in efficient algorithms and reusable libraries. Simple example is how C++ strings have c_str() or whatever it is called.
- andrewflnr 14y agoI think a more interesting example is how every standard C++ container has the same iterator-based interface for iterating over it.
- Avshalom 14y agoWhich is interesting considering how often "write a DSL for every problem" is used as a selling point for lisps.
- nickik 14y agoDSLs still use normal data down below. Thats part of why it is so easy to write DSLs. You can write a Datalog DSL and it can work with almost everything. You can write a Prolog DSL and it can work with everything. You can still expose and send around all the data the DSL uses. The trick is not to mix up what is functinality and what data, witch is what standard OOP does. Many good OO Languages like Dylan or Common Lisp do not do that.