Streams in squeak.

Lex Spoon lex at cc.gatech.edu
Wed Apr 20 20:43:42 UTC 2005


=?iso-8859-1?b?RnJhbudvaXM=?= THIMON <thimof at iutc3.unicaen.fr> wrote:
> Anyway, I think passing objects through streams has never really been a good
> idea : networks oriented apps should not be language dependant.
> What do you think about this?

Assuming we are talking about network streams, I agree.  Worse than the
language dependency is the hidden *version* dependencies.  You end up
tying your hands regarding future changes.  Adding an instance variable
here or there will make one end of the socket incompatible with the
other.  Trying to avoid adding instance variables is a real headache!

All the same arguments go for file formats, too.  Don't just serialize
your model into a file -- it will come back and cause you problems
later.

Now, all this said, you could temper your rule of thumb and say
something like, you should not directly pass objects out of your domain
model onto the network.  Instead, you should use some sort of carefully
engineered structured format, and you should maintain an explicit
encoding and decoding step within your code.  That structured format
might be XML or s-expressions, or else it might be some kind of
object-based format.

It costs time to add this layer of indirection, but it gives you a lot
more flexibility as your program inevitably changes over time.

-Lex



More information about the Squeak-dev mailing list