Sunday, March 04, 2007

What Colour do you like your Objects? Pink or Blue?

It's late and it's a Sunday, but I thought I'd just make a quick post to clarify a few things. What is OOP? Since Alan Kay's team coined the term 'Object Orientated' with the release of Smalltalk to the world in the early 80's OOP has become one of the most exploited marketing terms in programming.

It would be interesting to see when the term was first used. It wouldn't surprise me if the first published use of the term was in the original Byte Magazine article on Smalltalk in August 1981. So OOP was born with Smalltalk. Before Smalltalk Simula extended Algol to allow data structures to contain function pointers, but this was seen as an extension of data abstraction, and the term OOP wasn't used.

In Alan Kay's keynote speech at OOPSLA in 1997 he talks about a blue plane and a pink plane. The pink plane represents ideas which are an incremental improvement of existing ideas. The blue plane which runs orthogonal to the pink represents revolutionary ideas that break the old way of doing things, setting you off in a new direction.

Since the creation of C++, OOP has born these two identities. Firstly a pink identity, where OOP is seen as an extension of the existing thing, this was the view of Bjarne Stroustrup and what lead to C++ and ultimately Java. Secondly there is a blue identity, where OOP is seen as a new thing, which breaks with the old and has new requirements all of it's own. This second identity is most closely associated with Smalltalk and Self. It has also influenced other OO languages like CLOS, Ruby and Python.

These two identities so happen to deal with types differently, and the difference between the two is often referred to as static versus dynamic, but in truth, this dichotomy is a false one. The difference runs much deeper. The real difference between the two stems from their goals and their vision.

The C++ goal was to introduce OOP like constructs to C in an efficient way. To do this Stroustrup avoided the garbage collection, byte code, VM and late-binding of Smalltalk and went back to the much simpler and efficient model presented by Simula. The strength with this approach is that C++ is very efficient, the downside is that C++ is decidedly pink.

Self built on the platform of Smalltalk in an attempt to push further into the blue plane. The goals of Self were:

* Objects that are tangible just like physical objects in the real world
* Objects that share uniformity, just like physical objects do (everything is an object)
* Objects that exhibit liveliness, removing the modal nature of programming (no edit/build/run cycle)

All these goals are characteristics of Smalltalk, but Self wanted to take these characteristics much further, creating a fully graphical programming experience, where objects could be handled and manipulated from a visual palette, just like physical objects in the real world.

You can see that this 'blue' vision is very different from the pink one. One of the most obvious consequences is that with Smalltalk and Self there is no difference between graphical objects on the users desktop, and 'programmable objects' in the programmers IDE. In a sense the desktop becomes the IDE and the IDE becomes the desktop. Following from this the distinction between programmer and end user starts to blur. Also the distinction between object and application disappears all together. Each object is an application in it's own right, even the benign Number object '1' or '3' is an entity that can be manipulated at runtime through it's own GUI. The VM contains a large collection of such objects and becomes more than just a runtime, it becomes a Graphical Operating System.

Infact the object instance '1' is more than just an application. It also encapsulates it's own server with it's own synchronous message queue and it's own virtual processor. Adopting this semantic view of OOP means the runtime is now analogous to a NOS (Networked Operating System) spanning several virtual processing nodes. This is the semantic goal of blue OOP and why Alan Kay used the analogy of the encapsulated biological 'cell' in his keynote speech. I will expand on this blue OOP vision in a future post. But as you can see pink OOP is very different from blue OOP and the difference has very little to do with types.

Revised 06/03/07: Replaced 'Real Objects' with 'Physical Objects' in line with the terminology used by the Self team - Thanx Isaac

27 comments:

Alistair_Moir said...

So what color is OO under CLOS?

Paul said...

Hi Alistair,

Good question. In some ways, I would say CLOS is blue. After all you can meet all the goals of blue OOP using CLOS, also CLOS satifies the blue criteria of being a 'new thing'. Generic functions were definately new when invented, and give a new spin to OOP which is not based on the idea of mesage passing.

On the other hand, I would say that CLOS is pink. With CLOS there is no encapsulation and anyone can access the insides of Objects. This 'feature' of CLOS has more to do with backward compatibility with "the old thing" Lisp then it has to do with the new idea of Objects and OOP. Also CLOS has none of the Smalltalk/Self 'built-in' features needed to manipulate objects in a visual tangible way.

So in short I don't know. Perhaps someone else with a stronger knowledge of CLOS and Lisp may offer an answer.

If I was forced to give a single answer, I would say that CLOS can be both pink or blue depending on how you choose to use it. This fits in with the Lisp culture of allowing maximum flexibility for the programmer. Lisp prouds itself in being anything you want it to be :^).

Isaac Gouy said...

So OOP was born with Smalltalk.

Yet another Alan Kay quote -
... to quote Goethe, we should "share in the excitement of discovery without vain attempts to claim priority".
The Early History of Smalltalk


"An object is an instance of a class declaration."
Class and Subclass Declarations

Do we need to bother about whether the term object-orientation would have come about without Dahl and Nygaard's talk of classes and subclasses and instances and objects?


Maybe we should just extend Ole-Johan Dahl's common-sense statement:

"The importance of the OO paradigm today is such that one must assume something similar would have come about also without the Simula effort."
The Birth of Object Orientation: the Simula Languages

Isaac Gouy said...

* Create tangible objects as they exist in the real world
* Create objects that share uniform characteristics like objects do in the real world (everything is an object)



"The world does not consist of objects sending each other messages, and we would have to be seriously mesmerised by object jargon to believe that it does."

p6 Designing Object Systems

Paul said...

I believe the label OOP was born with Smalltalk, yes. I could be wrong though. At least Alan Kay has publicaly claimed that he coined the term 'Object Orientation'. So the term OOP may have been applied retrospectively to Simula. In his 1997 OOPSLA Keynote Alan Kay refers to three pre-Smalltalk systems that he considered Object Orientated, Simula was one of them.

I checked the date on the Simula paper you supplied and it is dated 2001. If you could find a reference to the label OOP prior to Smalltalk, say when Simula-67 came out in 1967, that would be definitative proof, and Alan Kay's claim would be false.

The reason why I'm getting so hung up about a label is because the term has come to mean different things to different people and has ruthlessly been exploited as a marketing tool.

Any concrete information you can supply is gladly received. I'm up for learning!

Paul said...
This comment has been removed by the author.
Paul said...

Whoops. I got the wrong quote.


"The world does not consist of objects sending each other messages, and we would have to be seriously mesmerised by object jargon to believe that it does."


I saw this one coming :^) The Self project wanted to give software objects some of the properties of real objects. They also noted that software objects had properties all of their own. This quote doesn't contradict what I am saying. The idea is to borrow traits and properties like direcntess, uniformity and liveliness from real world objects because it makes sense, and of course in a computer you can do things that you can't in the real world. After all a computer is a 'virtual world' :^).

I suggest you watch the Self video. Here is a link:

http://video.google.com/videoplay?docid=5776880551404953752

BTW. I'm more than happy to debate.

Isaac Gouy said...

I checked the date on the Simula paper ...
Have you checked the date of "Class and Subclass Declarations" ?


...Alan Kay's claim would be false.
The reason why I'm getting so hung up about a label...

I think you need to re-read the Goethe quote and Ole-Johan Dahl's comment.

Isaac Gouy said...

"real objects... real world objects"

What are they?

Paul said...
This comment has been removed by the author.
Paul said...

...The labels Class and sub Class are not the same as OOP. Self has no classes but is still OOP. I agree that Simula probably coined the terms Class and Sub Class back in 1967.

...The properties Self suggest that objects should take from the real world are:

* directness
* uniformity
* liveliness

All three terms are explored in the video.

What is your difficulty with these properties for software objects?

... I'm sure that you don't need me to tell you what a real object is :^)

I'm failing to see the point you are making. Please be specific. Your posts thus far have been quite terse.

Isaac Gouy said...

I agree that Simula probably coined the terms Class and Sub Class back in 1967.
And the terms object and instance used in that context, in the same paper?

Do we need to bother about whether the term object-orientation (or object-oriented) would have come about without Dahl and Nygaard's talk of classes and subclasses and instances and objects?


What is your difficulty with these properties for software objects?
"software objects"?
I've objected to objects as they exist in the real world and real world objects


... I'm sure that you don't need me to tell you what a real object is :^)
I don't know how to ask the question more directly - what are these "real objects" you keep mentioning?

Paul said...

Hi Isacc,

..I have been very specific. OOP is a label. It means different things to different people. For marketing people OOP means "goodness". The words object and instance haven't been exploited in the same way. Infact I'm sure the C reference manual uses the word "object" with no reference to OOP.

...I use the word real because that is exactly what I mean. They use the word real in the Self video about 10 times in the first 5 minutes.

I mean physical, tangible, solid objects. Which exhibit directness in the way you manipulate them, and are uniform in the sense that they all share common physical properties, and exhibit liveliness in the sense that they exhibit a single mode, the "alive" mode. They never go 'offline'.

Please suspend your pre-conceptions. Maybe you don't know what you think you do!

And how about watching the video?

Isaac Gouy said...

In fact I'm sure the C reference manual uses the word "object" with no reference to OOP.
And of course the difference is that in 1967 Dahl and Nygaard were talking about object and instance in the context of class and subclass - they were not talking about object files, they were explicitly talking about programming with objects ("an instance of a class declaration"). Why is that so hard to admit?

I mean physical, tangible, solid objects.
I guess the number 1 is not an object after all.

... exhibit liveliness in the sense that they exhibit a single mode, the "alive" mode. They never go 'offline'.
Grains of sand are alive? Rabbits are only ever alive? I don't think so.

Please suspend your pre-conceptions. Maybe you don't know what you think you do!
How ordinary - it's the other person who suffers from pre-conceptions and lack of knowledge.

"The world simply doesn't come all chopped up into nice neat
categories, to be selected among by peripatetic critters - as if
objects were potted plants in God's nursery, with the categories
conveniently inscribed on white plastic labels." Brian Cantwell Smith

Paul said...

Hi Isaac,

...You are not making much sense. I have conceeded that Simula is OOP, I'm saying that the term was coined much later with Smalltalk.

... No the reference to the term object I vaguely remember in C had to do with variables. I could be wrong so I won't dwell on it.

...I have said that the Self team noted that software objects aren't the same as real objects. In fact there is a neat clip at the end of the Self video where they demonstrate this :^)

What they do say is that it is desirable to borrow certain propeties from real world objects. Do you disagree?

...Finally, on the front of the paper you've quoted it says "Simulation Language" It doesn't say "Object Orientated Programming Language". You choose to ingore this evidence that suggests the term OOP came later :^)

...I take it that you still haven't watched the video. So I do not understand your interest. If you want to debate and exchange ideas fine. If something I've said has prompted an emotional reaction in you then...

Paul said...

Hi Isaac,

This exchange we have just had is a classic case of what Alan Kay calls instrumental reasoning. Your existing context of knowledge doesn't allow you to make the mental leap needed.

If I would have mentioned the 'desktop metaphor' and the idea of 'physical windows' and 'waste bins', and talked of 'killing a window', you wouldn't have a difficulty.

These same metaphors came from the desire for directness which the Self team wanted to bring to all software, not just the UI. These metaphors came from Xerox Parc and the Smalltalk team.

What I have suggested you do is keep an open mind and look at OOP afresh. None of the quotes you've cited contradict anything I have said. I am merely puting familiar ideas in a new context.

As for liveliness the meaning is clear. In the physical world there is no run and edit modes. You don't put your bed room in edit mode, freezing time whilst you 'edit', then start time running again once the room is nice and tidy!

Time never stops, and a dead Rabbit is an object that has come to the end of it's lifecycle and is waiting to be garbage collected :^)

steve said...

I have been having some thoughts about Alan Kay's idea of object 'liveliness'. I think he, and you, are stretching the metaphor too far. There certainly are 'edit' modes in the real world (you don't repair a car while it is moving, or make a bed while someone is lying in it).

There is no doubt that the 'liveliness' of objects in, say, Smalltalk, is great for prototyping and experimentation and debugging, but I think it is questionable about how useful it is in deployed applications. One of Kay's examples of things staying live was the internet (or whatever it was called years back). He describes how it stayed working even though all the hardware and software. However, I think what this illustrates is the exact opposite of what Kay seems to think it does: it shows the value of fixed interfaces and protocols. The internet would never have got going without agreed pre-arranged standards that all software and hardware conformed to. Without these standards, it would have been impossible to simply swap in replacement components. This is the exact opposite of late binding: systems have to conform (and be shown to conform) to interfaces before they are plugged in. The internet is also relatively inflexible in some ways, as illustrated by the issues with introducing new protocols like IP6.

And as for the definition of OOP; well I have always used the following definition- a system is OOP if it includes inheritance, polymorphism and encapsulation. I know Kay's definition is different, but does that matter? Even though he coined the term, surely what matters is to have a definition that is useful now. Kay's description of OOP seems to me to be too close to 'Actor'-based programming to be useful - it is too limiting.

Paul said...

Hi Steve,

First thing to say... great comment. It is reasuring to see that people are still capable of thinking for themselves and original thought!

That said..

... Late-binding still requires standards. The difference is what you choose to standardise on. It comes down to the issue of dependency and coupling. The 'wider' your standard interface the greater the coupling between components in your system, and the more sensitive the interface becomes to change.

So the real issue with binding and coupling is how well it deals with change.

Mellor-Page Jones came out with a great book in the 80's on Structured Analysis and Design that gave an excellent treatment of the subject of coupling. The more bits of data you pass beween components the higher the coupling (dependency). Using this definition he went on to classify different types of coupling, stamp, temporal etc...

What the web does is create a generic (meta) interface in an attempt to reduce stamp coupling. Stamp coupling is where you put a large number of independent bits of data together in a common structure which is then passed across an interface.

REST has the idea of a Uniform connector that is used as a minimal interface. The HTTP Connector supports just 4 verbs (GET, POST, PUT, DELETE) all of which take a single parameter, a URL. The resource passed using this interface is self describing (mime-type, links, etc) so additional information can be gleamed from the document passed across the connector and does not need to be part of the connector interface. This additional data does not impact on the connector and is free to change at any time.

So with the web either the client understands the mime-type sent or it doesn't. If it does not then it, has the info on where to find a plug-in that does within the document passed (self describing).

The client can also use an agreed data representation to identify the structure of the document. The 'link' is the way the web navigates large data structures, again these structures are not fixed in by the connector interface, but self described in the document passed and changeable.

WSDL however is very different from REST. The structure of the data is defined in the Interface WSDL and is fixed. Should the data change, so must the WSDL Interface. So WSDL is very brittle.

Message passing works in a similar way as REST. Client and server agree a common generic messaging semantic: SEND(OBJECT, MESSAGE), the meaning of the message is part of the message itself. The server (OBJECT) either understands the message or it doesn't.

So the key to late-binding, is the creation of a loose coupled 'narrow' generic interface. This is the thing you standardise. The rest of the information needed to satisfy each request becomes part of the message itself and can change without impacting the messaging interface. If a receiver does not understand the message it can say so at runtime.

A poor description, but this is a deep issue.

Paul.

Paul said...

Hi Steve,
I found this wikipedia article on coupling. It describes stamp coupling and talks about messaging:

http://en.wikipedia.org/wiki/Coupling_(computer_science)

It covers the basics and helps explain what I was trying to say.

Paul.

Isaac Gouy said...

1) paul wrote No the reference to the term object I vaguely remember in C had to do with variables. I could be wrong so I won't dwell on it.
As you've already said that 'the C reference manual uses the word "object" with no reference to OOP', the puzzle is why you think mentioning that is relevant to a discussion of OOP.

You have conceeded that Simula is OOP; you have not conceeded that Dahl and Nygaard were using the terms object and instance in the same way that the terms would be used in Smalltalk.


2) paul wrote ... the Self team noted that software objects aren't the same as real objects. ... still haven't watched the video.

Previously paul wrote ... I use the word real because that is exactly what I mean. They use the word real in the Self video about 10 times in the first 5 minutes.

No Paul - "self; The Video" does not talk about real objects - you are completely wrong.

Randall Smith carefully says "physical world" "physical objects" "physical objects" "physical objects" "physical objects" "physical world" "physics of the real world" "physical world" ... "principles borrowed from the physical world" "physical world metaphor".


3) paul wrote ... choose to ingore this evidence that suggests the term OOP came later
I have no dispute with Alan Kay's claim to have invented the term object oriented programming.

You are the one who is "getting so hung up about a label" not me.

Paul said...

Hi Isaac,

Well done! So you watched the video. Fantastic!

The word physical is a much better choice then the word real for what I was trying to describe. I'll update the post.

If this was your point, then thanks for the feedback.

BTW. What did you think about the video?

Paul.

Isaac Gouy said...

steve wrote There certainly are 'edit' modes in the real world (you don't repair a car while it is moving, or make a bed while someone is lying in it).

You are right - we don't change the engine while the car is in motion. But you are wrong to suggest that activity represents the kind of edit mode discussed by Randall Smith and David Ungar.

If there was an edit mode then we'd step from the world into edit mode, the car would cease to exist, we'd edit the specification and then we'd step out of edit mode back into the world and create a new car with the new engine. That's what they mean by an edit mode.


steve wrote There is no doubt that the 'liveliness' of objects in, say, Smalltalk, is great for prototyping and experimentation and debugging...

also-known-as programming?


steve wrote definition of OOP ... I know Kay's definition is different, but does that matter? Even though he coined the term, surely what matters is to have a definition that is useful now.

More than that - what matters is to have a definition that is useful for what /you/ are trying to achieve (that might be different to what Alan Kay is trying to achieve).

Isaac Gouy said...

paul wrote This exchange we have just had is a classic case of what Alan Kay calls instrumental reasoning. Your existing context of knowledge doesn't allow you to make the mental leap needed

paul wrote What I have suggested you do is keep an open mind and look at OOP afresh.

Those comments are a classic case of arrogance - your presumptions about my knowledge are crass.

I went to see Randall Smith demo this stuff in the early '90s during the 10 years I was a professional Smalltalk developer.

Paul said...

Isaac,

My goal is to communicate and exchange ideas.

I went to see Randall Smith demo this stuff in the early '90s during the 10 years I was a professional Smalltalk developer.

Given your experience wouldn't it be a good idea to share it, and tell us what you think?

Throwing stones is easy. And given your tone so far I don't think its a good idea mentioning arrogance :^)

Seriously, why not tell us all what you think about my blue/pink distinction, and contribute in a positive way?

steve said...

Isaac - I am talking about 'edit mode' in a general sense. I have to admit I am not familiar with Smith and Ungar. As I understand it, Kay's motivation for active objects with messaging was that 'systems should not have to shut down'. So what I described would seem to be to be the kind of editing implied by Kay - changing live objects. I am not convinced of the safety of working this way.

And, I don't think prototyping and experimentation is the same as programming in general. It is just one particular stage of it. I don't want things so flexible after deployment.

You make a good point about what we want to achieve. The think is, even after following his work for a long time, I really am not sure what Kay wants to achieve!

Isaac Gouy said...

steve wrote ... what I described would seem to be to be the kind of editing implied by Kay - changing live objects.
Exactly! They are examples of not stepping into an edit-mode. Stopping a car to repair it is just one of the things we can do in the physical world - we don't step into an edit-mode to do it.

The question they asked is what might software development be like if we did enough magic to maintain the illusion that there was no edit-mode and no compile.


steve wrote I am not convinced of the safety of working this way.
Seems like you are using safety as a FUD scare-word - the programmer's version of bogey-man


steve wrote I don't want things so flexible after deployment.
Why? Which probably leads us back to - what do you mean by safety? ;-)


steve wrote ... I really am not sure what Kay wants to achieve!
Happily only people involved in Alan Kay worship need to bother about that - we can stick with figuring out what we are trying to achieve.

Isaac Gouy said...

Paul wrote And given your tone so far ...
Given /your/ tone so far ...

Paul wrote ... why not tell us all what you think about my blue/pink distinction...
/Your/ distinction?
My mistake, I thought the video showed Alan Kay applying Arthur Koestler's distinction to the origin's of OOP.