3

I've heard a lot of talk about using lightweight data modeling as of late. Especially in relation to the Clojure programming language. What is it and how it differs from traditional classes regarding long term maintainability and flexibility of the design that relies on it?

  • 1
    Essentially all data types are ADTs in FP though? – alternative Oct 18 '14 at 14:34
  • 1
    Not necessarily. You can do functional programming with objects. Or even with no data abstraction at all! Actually, since object-oriented data abstraction is all about behavioral abstraction, and in lambda-calculus, the only "building blocks" with which you can perform abstractions are functions (i.e. behavior), all data abstractions in lambda-calculus are necessarily object-oriented! (This astonishing fact was noted by William Cook.) In other words, the purest of all pure functional languages is at the same time the first object-oriented language! – Jörg W Mittag Oct 18 '14 at 15:58
  • @alternative: Oops, I got confused there. I was talking about Abstract Data Types. Where you talking about Abstract Data Types or Algebraic Data Types? I don't think all types are Algebraic Types in FP. Really, Algebraic Types are orthogonal to FP. You can easily model them with classical Java-style OO inheritance and generics, actually. (In fact, that's what Scala does.) Product types become containers with type parameters, sum types become sibling subtypes. – Jörg W Mittag Oct 18 '14 at 16:07
  • 1
    @user7610 I don't really care. All I said is that Scala isn't purely functional, which is completely true. Therefore, my statement does not apply to it... – alternative Oct 18 '14 at 19:31
  • 1
    @gnat I used Q: Functional Programming vs. OOP as a template. Your link suggests framing this as a design review question. I'll try to do that. If I can just avoid using all the trigger words like "pros and cons", hopefully this question will be sustained here. – user7610 Oct 20 '14 at 8:58