3 ms·
I prefer languages with full OOP, ideally with multiple dynamic dispatch. What I'm not fond of are languages like Java that overuse OOP design patterns, force y
by jonathanstrange 3y ago
I prefer languages with full OOP, ideally with multiple dynamic dispatch. What I'm not fond of are languages like Java that overuse OOP design patterns, force you into them, or require lots of OOP boilerplate. If you have a class whose sole instance serves as a factory for other objects, you know you're on the wrong path. But I've never seen any coherent and sound arguments against OOP in general. Nobody forces you to use it, and, for example, it would be much easier to develop and deal with GUI frameworks in Go if it had classes with inheritance. As a rule of thumb, if for some reason your language drives you to emulate dynamic dispatch with explicit type switches on one or even multiple arguments, then it probably should have inheritance and dynamic method dispatch.
- mrkeen 3y ago> But I've never seen any coherent and sound arguments against OOP in general. How about arguments for OOP? Especially for things which can't be done better elsewhere.
- jonathanstrange 3y agoAs others have said, GUIs are the place where OOP shines. There are no things OOP does that can't be done elsewhere, what happens in practice is that programmers invent their own ad hoc object systems and start programming in an object-passing style (see e.g. Gtk).
- mrkeen 3y agoWhat is an object-passing style?
- jonathanstrange 3y agoWhatever it takes to emulate object-oriented programming in languages without objects and classes. Creating structs as objects and passing them as first arguments. But I also meant it to include using closures, function pointers, and type-switches to emulate dynamic dispatch, creating inheritance hierarchies by embedding higher classed object into structs in whatever way your language supports. Sometimes people also resort to code generation. Even explicit dynamic dispatch may be implemented, e.g. by storing class hierarchies explicitly. The hallmark of it is that "objects" are passed as first arguments to functions in languages that don't support syntactic sugar for methods.