Fwd: [erlang-questions] Re: What about making sense?

Nicholas Frechette zeno490@REDACTED
Mon Feb 22 19:57:47 CET 2010


---------- Forwarded message ----------
From: Nicholas Frechette <zeno490@REDACTED>
Date: Mon, Feb 22, 2010 at 1:56 PM
Subject: Re: [erlang-questions] Re: What about making sense?
To: David Mercer <dmercer@REDACTED>


And here is perfect proof of why, in most cases, I object to pattern books
and patterns in general: because most of the time, you don't need them. I
write C++ for a living and it pains (physically and mentally, as I have to
live every day with that code) me to see how abused the Singleton pattern is
abused. (Probably, _The_ most abused pattern)

When that book on OO patterns hit the world a few years back, I was doing
Java and boy did people love that book. Pretty soon they were being used
everywhere, and in far too many cases, they were being used where they
shouldn't have been. It is a human/programmer mistake to always try to
generalize everything when in reality, if you just need to get something
done knowing well the scope of things, a simple approach would be best.
Unfortunately, we all have a tendency to over plan and attempt to plan for
everything that could conceptually happen in the foreseeable future. (I for
one am guilty of this)

Please, do not write an erlang pattern book, ever. We already have
sufficient erlang patterns as it is, everything else can be worked up from
there. Give a man a hammer, and he'll soon see nails everywhere.

Do not get me mistaken, patterns are useful, just overly abused (as in the
example below where the behavior always starts simple and in using a
pattern, it over complicates things very quickly). Joe's book is fantastic
and together with the online documentation for the various erlang patterns,
it is sufficient imo. I started using erlang 6 months ago and am writing
production software with it as I write this. Armed with Joe's book and the
online documentation is more than one needs. Neither perfect, together
sufficient.

2cents to be taken with grain of salt.


On Mon, Feb 22, 2010 at 10:05 AM, David Mercer <dmercer@REDACTED> wrote:

> On Saturday, February 20, 2010, Joe Armstrong wrote:
>
> > When I write *any* process I always start with something like:
> >
> > loop(...) ->
> >     receive
> >          Any -> io:format("got:~p~n",[Any]),
> >          loop(...)
> >    end.
>
> Out of curiosity, why do you start with that and not:
>
>        -behaviour(gen_server).
>
>        init(_) -> {ok, []}.
>
>        handle_info(Info, State) ->
>                io:format("got:~p~n",[Info]),
>                {noreply, State}.
>
> Obviously, the semantics are different and all, but I'd have thought if I
> were creating a process, I may as well make it a gen-server process so I
> don't have to retrofit it into that framework later.
>
> Cheers,
>
> David
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


More information about the erlang-questions mailing list