Semantic compression (2014)(caseymuratori.com) |
Semantic compression (2014)(caseymuratori.com) |
OOP is fine. And DRY (what the core idea of the article is getting at) applies in OOP paradigms as much any another. The arguments the author makes are orthogonal to OOP.
The author seems to not enjoy planning before writing code, which I guess is more necessary for OOP than other paradigms?
Or the author's experience (which is extensive) has led to the conclusion that all that planning you want to do at the beginning rarely gets you the proper abstractions.
I suppose they're going for the "wow, are you God?" effect, but when it's a miss, it just makes them look silly.
I think it's helpful to think of nearly all the content produced by Muratori and Blow as a branding exercise. They want you to think they are enfant terrible style geniuses who represent the vanguard of the profession. As silly as their strawmen are, this frame of "civilization is in decline because it fails to recognize my unique genius" is much more silly, and makes each video/rant seem both one note and self aggrandizing.
Edit: I would love others, who have read the above mentioned book, to weigh in with your anecdotes.
What distinguishes the approach from what is presented in this blog post, can you provide a summary for those of us who haven't read the book? I am sincerely interested.
The book furthermore teaches a design recipe which comes in handy when you are stuck with a problem. Basically it teaches you to write examples first so that you understand the problem instead of jumping onto the editor to write code first. The examples help you structure your data. The rest of the code follows from it.
Instead of a Manager class inheriting Employee and Contractor (which in turn inherit Person, which in turn may inherit other classes...), you'd separate employee and contractor into traits/interfaces and define distinct manager classes that implement the two traits. Of course, ultimately it's all classes and inheritance in C++ because there are no traits, but it's organized differently.
This article really helped me put things I had believed for years into words when I first read it. It's pretty amazing.
https://news.ycombinator.com/item?id=17090319 - May 17, 2018 (41 comments)
There are others with 1-2 comments but no other discussions beyond that that I can find.
What’s going on in this article is refactoring towards a very specific goal. That goal is reaching an architectural style that could also have been achieved earlier in the development process, and it’s that style that is, AIUI, the point of the article.
Prompting you to make the changes allows you to cognitively keep up in lockstep with the code changes. Further, it has no concept of your present/future intent, so perhaps not all of its suggestions apply.
Nice read, though. Very approachable.
I think the newish thing is traits such as in Rust.
Of course, there is some object-orientedness to it, the author even calls part of his new code "objects". I guess some people would call that OOP, but it's certainly not traditional OOP.
Rust does a really nice job of making that the first obvious thing to reach for (simple structs, traits and generics), and making the slower stuff like dyn traits (v-table indirection) more annoying and less desired. Reducing indirection and abstractions makes it easier to reason about code.
> Normally, I would probably not make these member functions, but since The Witness is a more C++-ish codebase than my own, I thought it was more consistent with the style (and I don’t have a strong preference either way)
My interpretation of this is that normally he'd make plain C structs and functions that operate on them. So quite far from anything people would normally describe or think of as object oriented.
> But despite the fact that many programmers out there have gone through bad phases like this and eventually come to smart conclusions about how to actually write good code efficiently, it seems that the landscape of educational materials out there still overwhelmingly falls into the “objectively bad” category.
So his frustration here is that there's tons of educational material that focuses on inheritance even when that's not what most experienced programmers are doing.
His frustration is pretty clearly that OOP, as a whole, whether by composition or inheritance, is "a load of horseshit" in his words.