value vs object orientation

I was trying to explain to a colleague the difference in outlook between value and object orientation. I find some references like C#'s 'value-objects' vs the more usual 'reference-objects' But these kinds of references are very OOP-tilted. OTOH there are a few writings eg by Peter Wegner argung that the millennial philosophy divide between 'rationalism' and 'empiricism' corresponds to the division in programming between FP and OOP. Im looking for some more middle ground stuff -- not too stuck on one technological platform and yet not overly philosophical

The work of Kumiko Tanaka-Ishii [1,2,3] might interest you.
In her book[1] she compares Haskell and Java
Pat
[1]
http://www.cambridge.org/us/academic/subjects/psychology/cognition/semiotics...
[2] http://french.chass.utoronto.ca/as-sa/ASSA-No20/Article1en.html
[3]
http://www.degruyter.com/dg/viewarticle/j$002fsemi.2006.2006.issue-158$002fs...
On 13 October 2014 04:36, Rustom Mody
I was trying to explain to a colleague the difference in outlook between value and object orientation.
I find some references like C#'s 'value-objects' vs the more usual 'reference-objects' But these kinds of references are very OOP-tilted.
OTOH there are a few writings eg by Peter Wegner argung that the millennial philosophy divide between 'rationalism' and 'empiricism' corresponds to the division in programming between FP and OOP.
Im looking for some more middle ground stuff -- not too stuck on one technological platform and yet not overly philosophical
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- This email originated from DIT. If you received this email in error, please delete it from your system. Please note that if you are not the named addressee, disclosing, copying, distributing or taking any action based on the contents of this email or attachments is prohibited. www.dit.ie Is ó ITBÁC a tháinig an ríomhphost seo. Má fuair tú an ríomhphost seo trí earráid, scrios de do chóras é le do thoil. Tabhair ar aird, mura tú an seolaí ainmnithe, go bhfuil dianchosc ar aon nochtadh, aon chóipeáil, aon dáileadh nó ar aon ghníomh a dhéanfar bunaithe ar an ábhar atá sa ríomhphost nó sna hiatáin seo. www.dit.ie Tá ITBÁC ag aistriú go Gráinseach Ghormáin – DIT is on the move to Grangegorman http://www.dit.ie/grangegorman

On Mon, Oct 13, 2014 at 3:46 PM, PATRICK BROWNE
The work of Kumiko Tanaka-Ishii [1,2,3] might interest you. In her book[1] she compares Haskell and Java Pat [1] http://www.cambridge.org/us/academic/subjects/psychology/cognition/semiotics...
[2] http://french.chass.utoronto.ca/as-sa/ASSA-No20/Article1en.html
[3] http://www.degruyter.com/dg/viewarticle/j$002fsemi.2006.2006.issue-158$002fs...
Thanks the book looks quite interesting; Ive to yet lay my hand son it! The article is on the other hand entirely java-centric.

There's a half-fun-and-full-earnest proverb: It is better to have one data type with 100 functions than ten data types with 10 functions each. I have some guidelines that I wrote up for a class this year: http://www.cs.otago.ac.nz/cosc326/resources/data.htm. They were given to students who have been trained in OOP, and the example is in Java, but my perspective was value orientation. One aspect of value orientation that's *not* brought out in those notes but really should be is that value orientation goes hand in hand with thinking of the values as elements of some *ALGEBRA* and a determination that the values and operations should combine in a way that MAKES SENSE and is as easy as practical to reason about. Just today I was looking at a mere 3 pages of OOP code (and in fact if you threw away the comments and test cases there was under 1 page of code) which left me completely baffled. It's basically a zipper, with operations canGoBackward, canGoForward, goBackward, goForward, and goTo, except that goTo adds an element, and a dummy element, and backs up over the dummy element. But if you add three elements in succession with goTo, and back up once, you get the 2nd element, not the 3rd. Presumably in the original context it *does* whatever the author wanted, but I can't figure out what it *means* and certainly would not be able to use it myself. The thing that has me jumping around shouting and looking for someone to bite is that the author *knew* what the intended semantics of the operations was but didn't think it would matter to his readers... Let me offer an example from the ANSI Smalltalk standard. <blockquote> 5.7.8.10 Message: copyReplaceFrom: start to: stop withObject: replacementElement Synopsis Answer a new collection conforming to the same protocols as the receiver, in which the elements of the receiver between start and stop inclusive have been replaced with replacementElement. Definition: <sequenceReadableCollection> This message can be used to insert, append, or replace. There are three cases: 1. If stop = start - 1, and start is less than or equal to the size of the receiver, then replacementElement is inserted between the elements at index stop and start. None of the receiver’s elements are replaced. 2. If stop = the size of the receiver and start = stop + 1, then the operation is an append, and replacementElement is placed at the end of the new collection. 3. Otherwise, the operation is a replacement, and each of the receiver’s elements in the given range is replaced by replacementElement. The parameters start and stop must be non-negative. Collections that by definition enforce an ordering on their elements are permitted to refine this message to reorder the result. <snip/> </blockquote> Now, as object-oriented definitions go, there's not much wrong with this. Cases 1 and 2 are really the same case, so the description is more complicated than it needs to be, but that's about it. You can either replace 1 or more existing elements with instances of a new one, or insert exactly 1 element at any position. From a value perspective, it's clear that there are two operations here: seq copyReplaceFrom: start to: stop withObject: newItem -- replace existing elements seq copyAdd: newItem beforeIndex: start -- insert one new element They have different validity conditions: 1 <= start <= stop <= seq size for the first 0 <= start - 1 <= seq size for the second They have different effects on the size: seq size = result size for the first seq size + 1 = result size for the second One is idempotent: if seq1 = seq copyReplaceFrom: a to: z withObject: x and seq2 = seq1 copyReplaceFrom: a to: z withObject: x (under the first reading), then seq1 = seq2 but the other is not: the sizes being different. Oops. I just told a lie. The first reading is NOT idempotent if the receiver is a collection that keeps its elements in sorted order. So it _is_ idempotent for some receivers and it is _not_ idempotent for others. Again, the value perspective would be unhappy with this. I suppose you could summarise it as - the value perspective asks "what does this value MEAN?" and has as its characteristic activity trying to reason about correctness - the object perspective asks "what does this object DO?" and has as its characteristic activity using a debugger.

Thanks Richard for your thoughts, especially I suppose you could summarise it as
- the value perspective asks "what does this value MEAN?" - the object perspective asks "what does this object DO?"
[I usually formulate it as the understanding focus vs the doing focus; probably not much difference] However when you say
and has as its characteristic activity using a debugger.
I am amused. In a sense it is correct I guess but it still seems a tad harsh.

On 15/10/2014, at 4:20 AM, Rustom Mody wrote:
Thanks Richard for your thoughts, especially
I suppose you could summarise it as - the value perspective asks "what does this value MEAN?" - the object perspective asks "what does this object DO?"
[I usually formulate it as the understanding focus vs the doing focus; probably not much difference]
It's interesting that the "semiotics" paper that someone already mentioned also identifies "being -vs doing" as the key question, but to my mind has it backwards. That paper identifies "being" with *internal structure* and "doing" with *interface* (in the Java sense) and to my way of thinking seriously misapplies the term "abstract data type" and makes some criticisms on the basis of a straw man bad design. Let me clarify here that the value perspective is NOT about knowing (still less about _having_ to know) the structure of things. You think about the value (the state of) a thing *represents*, not its implementation. One of my biggest gripes with Java is that students learning it never seem to get the hang of encapsulation; they'll make _everything_ public by default, which means that such an "object" is at the mercy of the whole world and cannot be said to represent anything other than its parts. Maybe that's what formed the perspective of that paper.

On Wed, Oct 15, 2014 at 8:25 AM, Richard A. O'Keefe
On 15/10/2014, at 4:20 AM, Rustom Mody wrote:
Thanks Richard for your thoughts, especially
I suppose you could summarise it as - the value perspective asks "what does this value MEAN?" - the object perspective asks "what does this object DO?"
[I usually formulate it as the understanding focus vs the doing focus; probably not much difference]
It's interesting that the "semiotics" paper that someone already mentioned also identifies "being -vs doing" as the key question, but to my mind has it backwards. That paper identifies "being" with *internal structure* and "doing" with *interface* (in the Java sense) and to my way of thinking seriously misapplies the term "abstract data type" and makes some criticisms on the basis of a straw man bad design.
Heh! I get into arguments on the python list on the same account. Python has an 'is' operator which is basically pointer-equality. I find it silly and inappropriate that a purportedly high level language needs to conflate ontological being with machine representations [On the whole though python is nice (with a few such exceptions) for supporting in an even-handed way, imperative and declarative thinking]
Let me clarify here that the value perspective is NOT about knowing (still less about _having_ to know) the structure of things. You think about the value (the state of) a thing *represents*, not its implementation.
Yes One of my old favorites is Bird and Wadler (1988 Miranda edition) - concrete types define values - abstract types are defined around operations And then without more ado the book sticks to concrete types. I was looking for something similar but not couched in the framing of FP stlll less some FP language
participants (3)
-
PATRICK BROWNE
-
Richard A. O'Keefe
-
Rustom Mody