[erlang-questions] Server which spawns an additional server for each call

Mihai Balea mihai@REDACTED
Wed Apr 20 15:30:29 CEST 2011


On Apr 20, 2011, at 6:52 AM, Dave Challis wrote:

> 
> To be honest, the main examples of non-trivial erlang code that I've seen have come from the Erlang and OTP in Action book.  It frequently uses gen_server as a base for applications or functionality, so I assumed that it was good practice to do so.

It is good practice to have your app structured according to OTP principles and using standard OTP behaviours is an easy way to do it. You'll get a solid, time-tested scaffolding, other people will have an easier time understanding your code and various tools depend on things being set up in a certain way.

That being said, it pays to be aware of what's going on under the hood and what the limitations are.

You can find a large selection of non-trivial Erlang code in the wild, of various degrees of quality. Search Github for RIak, it's just one example of well designed, OTP compliant codebase.

> A resource containing common design patterns for erlang would be ideal, but I'm not sure if such a thing exists yet!

The OTP behaviours encapsulate common patterns, but I suspect you're referring to higher level design. 
I am not aware of any such resource, but it would be a Good Thing!

Mihai





More information about the erlang-questions mailing list