I understand how a process works. And I understand how to implement OTP behaviours such as gen-server, etc.
But It's not clear to me when I would chose one approach over the other.
For instance, Cesarini et. al., in Erlang Programming, implement the database server on p 240 by spawning a process, writing a loop function, etc. Joe Armstrong's chat client on p 196 in Programming Erlang also spawns a process.
Why wouldn't these be better implemented as OTP gen-servers? Is it for educational purposes? Or are there sound technical reasons?
In other words, what rules of thumb would guide me to implement one approach over the other?
Many thanks.