Hacker News new | ask | show | jobs
by jerf 4181 days ago
You might be interested in trying Go's OO out, which privileges composition above inheritance. It's not often talked about on HN under the low-signal furor about generics, but it is a case of a small change that has a surprisingly profound effect on the language. I am becoming convinced that the current backlash against OO should really be against inheritance, not OO. Inheritance is a thing that is occasionally useful and often painful; composition is occasionally painful and often useful. The latter should be the syntactically-privileged default.
1 comments

By Go's OO you mean the interface-driven mechanics? I think those are quite nice.
No, the composition aspects. Go privileges composition over inheritance syntactically, which has a surprisingly large affect on the whole. Interfaces end up extending it in other interesting ways, but that's a different aspect.

The whole is still an imperative language in the end, but I've found that while it may not encourage composition and separation of concerns as much as I'd like, it fights me less than some other imperative languages.