A Simplified View of a GenServer
The most famous Actor Model implementation is Erlang Machine, also called BEAM. And OTP is one of the most exciting parts of BEAM. The GenServer is a very flexible and versatile abstraction provided by BEAM. Any server whose design is based on the server/client pattern can be implemented as a GenServer.
A GenServer consists of a mailbox, an event-loop, and a set of callbacks. The runtime concerns are abstracted away. We only need to focus on our solution. Then we pass that to the runtime as a set of callbacks. We are not involved with any concurrency-related concerns!
It sounds stupid to get excited over this. Nevertheless, giant industries rely on this abstraction - and BEAM because it is one of the most interesting cases for the Separation of Concerns principle. It’s like: the GenServer actor (it’s an actor) tells us, “I’ll take care of the runtime concerns (the concurrency stuff), and you take care of the business logic.” And yes, one could argue it is also a case of I
code is a liability and must be disposable
All the reduction in revenue comes from the code. All the lost opportunities and overdue time-to-market come from the code. The code causes long lead times. All the bugs come from the code. And for developers all the beautiful weekends, that you could be spent with your kids and your family, but weren't so, come from the code.
Code is a liability, not an asset. The functionality of it could be an asset, assuming you're building something that someone is willing to pay for it. If it was possible to have the functionality, without the code, that would be Nirvana! Unfortunately, that's not possible.
We know that if we want the functionality, we can not avoid the code. Yet, maybe we can try to make the code disposable. The presence of disposable code is less intrusive and you can get on more easily with your life.
There are two aspects to the code production process. First, it is possible to focus on the process of code generation, which nobody likes to talk about b
|defmodule PersianCalendar do|
|for converting persian calendar to/from gregorian calendar|