[erlang-questions] The gen server simplified (how it works)
Joe Armstrong
erlang@REDACTED
Wed Apr 20 12:16:26 CEST 2011
On Wed, Apr 20, 2011 at 10:59 AM, Samuel Rivas
<samuel.rivas@REDACTED>wrote:
> > Things become problematic when you do not entirely understand the
> > abstraction.
> > Maybe the abstraction is inappropriate for your needs. I have seen many
> > examples
> > of code where the gen_server *is* inappropriate. The acid test is "does
> the
> > gen_sever code look like spaghetti" if the answer is yes then all you
> have
> > done
> > is shoe horn the applications into an inappropriate form. In this case
> > you should ditch the gen_server and roll-your own.
>
> Another problem I often see is that newbies tend to regard gen_server
> as something that does magic, and fail to understand how the code runs
> in the server and the clients (since that code lives in the same
> module, usually).
>
> They end up in solutions with parts of the gen server sending messages
> back and forth, putting receives that spoil the abstraction
> intercepting messages that gen_server code should be handling,
> throwing exits in server code and attempting to catch them in the
> client code, blocking servers with heavyweight operations, ...
>
> I really consider advising against using gen_server (or any other
> abstraction) until one is able to write a client-server and a
> supervisor tree without them so that you can understand what's
> happening under the hood of gen_server (which, as you say, it's not
> rocket science).
> Absolutely.
>
> I think the problem stems from the use of IDEs - in eclipse/Xcode etc you
> click on
> a "new project" button and the system automatically generates a load of
> crap files
> full of incomprehensible undocumented nonsense. This leads to a mentality
> of "using stuff without understanding it" - All I ever use is emacs, make
> and a shell.
> Usually I put all the files in one directory. I want to understand
> *everything*
>
> As IDEs get more and more complex and help you more and more
> it gets harder and harder to understand what's really going on.
>
> Graphics programming used to be easy - anybody remember Borlands turbo
> graphics?
> - but now it's far more difficult since you have to fight with all the
> tools and
> frameworks that get in the way and make life difficult.
>
> /joe
>
>
>
> Cheers
> --
> Samuel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110420/ce3a8eee/attachment.htm>
More information about the erlang-questions
mailing list