TypeScript, but for Elixir?

I think the way OO is taught in school is a mistake. The “a dog and a cat are both animals so we can inherit” makes people think that “the thing” about OO is inheritance. Really, thing about OO is encapsulation of state through the combining of behaviour and data. I haven’t used inheritance in my OO work in many years. In my professional life I’ve worked on ecom, procurement, warehouse management, and scheduling systems and none of those have ever lent well to inheritance. I think it makes sense for something like a video game where you have a lot of characters who all have common characteristics—like health, mana, a walk cycle, etc. But in an ecom system, I’m not going to have Milk, Bread, Egg that all inherit from Product, I’m just going to have a Product with a name. As I’ve heard mentioned several times: “Functional excels when you have more behaviour than you have things, and you are mostly adding more behaviour than things—OO excels when you have more things than you have behaviour, and you can mostly adding new things.”

There is a lot to respond to in what you wrote, but my dog is barking for attention :dog:

4 Likes