dataflow / class diagram duality

Apr 10, 2013 06:36

Class diagrams in UML (for my purposes) have boxes, two kinds of arrows (isa and hasa) between boxes, and methods, which are essentially strings, inside the boxes. Class diagrams correspond to object-oriented code in that each box probably has a section of code corresponding to it, each method probably has a section of code corresponding to it, and ( Read more... )

Leave a comment

darius April 12 2013, 04:48:49 UTC
I'm toying with maybe preparing a talk for Hacker School about functional and OO programming. "The lambda calculus: the first object-oriented language." The link I was thinking of emphasizing was, in LC, the only thing you can do with a function is to call it; while in OO, I mean the really pure version of it like Actors, all you can do with an object is send it a message. For the 'things' in either system, you are what you do.

So in either, it's natural to use polymorphism instead of if-thens. To use transparent forwarders and adaptors. They both profit from tail-call optimization. They should encourage a design style distributing knowledge and responsibility, with clarity about who does what ('trained animals' do the jobs). (OTOH Steve Yegge wrote this missive "Execution in the Kingdom of Nouns" blaming Java's bureacratic doubletalk style on object orientation, just what I'm claiming should nudge writers toward clarity, so I'm not sure. I think he misdiagnosed the problem, but then I don't read much Java and I'm not even sure how bad the problem is.)

OTOH, both formalisms in their really pure form get awkward on problems that get easier when you can look inside a thing, like with pattern matching, or any of a bunch of other language features that do exist for reasons.

I like the point about looking for one-method classes, and sketching algorithms for compiling either way. (Actually I'm leaning towards just focusing mainly on how to compile call-by-value lambda calculus and not trying to make the above parallels power a whole talk.)

Reply

darius April 12 2013, 06:36:11 UTC
P.S. writing that out prodded me to read http://www.cs.utexas.edu/~wcook/Drafts/2009/essay.pdf which turns out to say practically all of what I had in mind, down even to the title (section 5.4 ends "the untyped lambda-calculus was the first object-oriented language.")

Reply


Leave a comment

Up