[erlang-questions] Stuff that breaks when you move it

Mazen Harake mazen.harake@REDACTED
Tue Aug 4 16:43:17 CEST 2009


On what level is P-1 suppose to work?

Should I be able to move the erlang directory?
Should I be able to move the lib directory?
Should I be able to move the applications in the lib directory?
Should I be able to move the beams in the applications directory?
Should I be able to move the bytes around in the beams?

Basically you will give people that support convention a big head ache. 
I agree that some things you should be able to be moved without them 
breaking but you must DEFINE the units. When you say "Erlang", what 
exactly do you mean? You can't build anything using components without 
having either a convention or a mediator on how they should find each 
other.

If you choose convention then you by definition _can't_ move it around 
unless you define each unit that you can move, but then you need some 
convention to move the movable unit around and so on...... unless you 
are going to bake your whole system into one extreamly large binary blob 
you won't get away from the fact that things will break as soon as you 
have two entities... but even if you _do_ have a huge blob you still 
want to split it up and find information in it and voila (I believe that 
is how it is spelt) you are back to square one.

The only option (I believe) is to have a mediator that tells you where 
things are... and that mediator is the only thing that _all_ the 
units/enteties use to find other entities. And if something is moved, it 
can only be moved using that mediator and all calls have to go through 
this mediator (serialized) otherwise you have race conditions all over.

This pretty much kills P-1 and P-2....

P-3 and P-4 however make perfect sense and should be part of any system.

/Mazen

Joe Armstrong wrote:
> There's two kinds of stuff:
>
>     A) Stuff which doesn't break when you move it
>     B) Stuff which breaks when you move it
>
> Type A includes:
>     zip files,  PDF files, jpg files, mp3 files, ...
>
>
> Type B includes:
>      Erlang, HTML files, DRM protected files, erlang beam files, ...
>
>
> A good general principle is:
>
>     P-1 - "Stuff should not break if you move it to a new directory"
>
> A is good B is bad.
>
> Experiment:
>
>     # cd /usr/local/lib
>     # mv erlang globble
>     # globble/bin/erl
>     exec: 28: /usr/local/lib/erlang/erts-5.7.1/bin/erlexec: not found
>
> Thus Erlang is in B.
>
> But it doesn't have to be so - this is a bug not a feature
>
> Note: 1) This problem (stuff breaking when you move it) is
> a particular pain when you have to make something work
> that depends upon several different components and each one
> individually breaks when you move it.
>
> 2) Sometimes stuff cannot be moved to where the author wanted
> you to move it to. So if you have not got admin rights
> you *cannot* move your program to /bin (or whatever)
>
> So lets add:
>
>      P-2: It should be possible to move stuff to *any*
>           directory in the file system to which you have write access
>           without breaking it.
>
> And while we're on the subject:
>
>      P-3: We should be able to *remove* stuff without breaking
>      other stuff that is not dependent upon the stuff we have removed.
>
>  And
>
>      P-4: If we add stuff to the system and then remove it we should put
>      the system back to the state it was in before we added the
>      stuff that we removed. (Possibly we might change the state of the
>      system log to say that we have added and removed something,
>      but nothing else should happen)
>
> Very little software obeys principles P-1 to P-4.
>
> This is bad.
>
> Fix it.
>
> Cheers
>
> /Joe
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>   



More information about the erlang-questions mailing list