[erlang-questions] When to catch (was: Module config data and functional programming)

Ulf Wiger ulf.wiger@REDACTED
Tue Sep 6 10:47:34 CEST 2011


On 6 Sep 2011, at 10:24, Joe Armstrong wrote:

> Programming *is* the art of understanding a problem - once you have
> complete understood the problem
> the program is in a sense "written" (at least in your head) - it
> remains to type it into the machine.
> Thus when the problem is not solved you will often not know what to do.

I completely agree. This also leads into the domain of "accidental complexity", where the answer to why you don't know what to do in a particular spot in your code, may well be that you shouldn't ever get there in the first place. The solution then could be to choose a simpler (or more adequate) overall approach.

This is very easy to fall into in concurrency programming, and I have given some examples, e.g. in my EUC 2005 talk [1], and later in the Death by Accidental Complexity talk [2]. This comment is an example similar to Joe's, but where the authors eventually figured out what to do - even if it was a "false answer":

%% Getting a ReleasePath when pending a Notify Released event is a bit
%% complicated. We need to check for which path the ReleasePath is for and
%% for which path the notify is for. If they are for different paths we are
%% in a dilemma since we only can be in pending for one of them. As a simple
%% way out we just treat this as an abnormal release for now.
<… code …>

The "can only be in pending for one of them" was, AFAIK, an consequence of the implementation, and not of the problem itself. The code in question was later rewritten and _much_ simplified - to the point where it could even be understood by more than one person...

[1] http://www.erlang.org/euc/05/1500Wiger.ppt
[2] http://www.infoq.com/presentations/Death-by-Accidental-Complexity

BR,
Ulf W

Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110906/f94ce6fa/attachment.htm>


More information about the erlang-questions mailing list