Erlang hints from an CO junkie
Thu Aug 12 19:25:03 CEST 2004
> But abstract datatypes =/= objects. Objects have
> state, identity and associated methods, while ADTs are
> collections of functions that operate on and
> encapsulate concrete data (and where the
> implementation perhaps satisfies some laws formulated
> on the ADT).
Looking very strange to me.
Lets dig into definitions. The world-known OOP
definition consist of 3 properties:
ADT is all about 1 item. How do you call ADT (class)
or ADT instance (object) is not specified.
2 property in particular (but not only) means that
you must be able to define generic functions working
with any ADT conforming specified interface, in other
words it state that ADT instance must have a _value_,
so you could pass it as a parameter to a function.
Nothing is said about associated _methods_ - this is
just one of the names for ADT functions. In some terms
ADT interface functions are 'associated' with an instance -
yes, because in other case you will not be able to define
generic function on it (it receives only the _value_!).
This is the main issue.
Here is nothing said about identity and state in definition.
And it's correct, because these properties conflict with
referential transparency and in this case functional
languages cannot satisfy OOP definition at all.
I believe an 'object' is quite common and general
term for an ADT instance with _associated_ operations
(which sometimes called 'methods' and 'messages').
Yes, some _implementations_ may add more specific
properties to objects such as state and identity, but
terms 'class' and 'object' (class instance) has became
quite common in whole context of OOP and can be
hardly associated with a particular langugae now.
> Certainly objects and ADTs do share some properties,
> such as encapsulation; this is not so strange, because
> these are desirable properties for structuring
> software. But that doesn't make the two techniques the
Could you give a reference to the definition of object
you operating with?
More information about the erlang-questions