by PaulStatezny · 3y ago · 0 comments
> You could build a chatbot that supports Discord, Slack, and IRC dynamically at runtime...
As a counter-point, OOP isn't necessary for dynamic dispatch.
None of these dynamic features you describe are necessarily any harder in non-OOP languages — or easier in OOP languages.
You can do the same kind of dynamic dispatch in Elixir, Go, etc.
OOP really is a preference, not a differentiator.
Source: I cut my teeth on OOP and used it for many years. Been using Elixir for the last half a decade, and have zero loss of ability to do things like this.
Polymorphism (including dynamic dispatch and duck typing) is a game changer, in that it encourages simple, stable interfaces, enables testing, encourages encapsulation, etc. It's a key technique for building big projects.
Inheritance is a tool for reducing the amount of code written by a human, among many others (things like code generation and composition) I haven't seen it unlock other important conceptual domains the way polymorphism does.
Unfortunately many undergraduate curriculums get overly excited about inheritance when teaching OOP. I guess animal-cat-dog is an easy example (though totally unrealistic), but the problems polymorphism solves don't often show up in classroom-sized projects.
However, I'm not really sure why your comment is framed as a counterpoint to mine. I explained what it took for me to grok OOP, but I never said OOP alone provides composition and dynamic dispatch. It seems needlessly antagonistic to make this some kind of programming paradigm pissing contest when that has nothing to do with anything I said.