[erlang-questions] OO programming style in Erlang?

Logan, Martin <>
Tue Jan 23 20:30:47 CET 2007


And this I guess is the part I have a psychological problem with.
I am used to an idiom where data are hidden behind an interface
that operates on them. This decouples user of the module from
having to deal with internals of that module. But as you described
it, data are exposed in Erlang. So each time you want to change the
representation (add something because of one new function), you have
to revisit many of the existing functions that operate on that
representation. This seems more than a few changes to me...


No more so than you would with an object.  In both cases it depends on
what you are doing with your structure, are your changes backward
compatible.  Look at the dict module for a good example.  The only real
difference between that and an object called dict is the structure is
passed back and forth from the caller to the function operating on it.  

Martin




More information about the erlang-questions mailing list