In the two examples above, simple unresolved processes are preferable for educational purposes : it is easier to explain, these authors do not need to explain OTP in order to convey what they want to learn, and it is important in any case to understand the concept of the process in Erlang. Even in a real application, according to OTP rules, not all processes are implemented using OTP behavior and are inserted into the observation tree.
The rule of thumb is quite simple. Determine if you want to follow OTP design principles by looking at what it brings (code changes, fault tolerance, etc.), or if you plan to integrate with OTP-compatible code. Follow the principles of OTP if you want any of the features it brings and avoid reusing the wheel.
If you adhere to the principles of OTP and therefore use the behavior of gen_* , you should make a simple spawn for any short-lived process that does not need to be supervised or updated . It will not live longer than the time to deploy the release (otherwise you will need soft_purge ). All other processes should be inserted into the observation tree and, possibly, implement the behavior of gen_ *.
source share