←back to thread

249 points mattcollins | 9 comments | | HN request time: 1.005s | source | bottom
Show context
cutler ◴[] No.42190248[source]
OOP is an industry of its own which generates a ton of incidental complexity. See "Object-Oriented Programming is Bad" by Brian Wills (https://www.youtube.com/watch?v=QM1iUe6IofM) and most of Rich Hickey's excellent videos, especially his keynote at Rails Conf 2012 where he basically told the Ruby crowd they're doing it wrong (https://www.youtube.com/watch?v=rI8tNMsozo0).
replies(4): >>42190770 #>>42191094 #>>42191386 #>>42191490 #
chipdart ◴[] No.42191386[source]
> OOP is an industry of its own which generates a ton of incidental complexity.

I think you're confusing "OOP is used in projects and I've seen accidental complexity in projects" with "OOP generates accidental complexity".

The truth of the matter is that developers create complexity. It just so happens that the vast majority use OOP.

I challenge you to a) start by stating what you think OOP is, b) present any approach that does not use OOP and does not end up with the same problems, if not worse.

replies(3): >>42193090 #>>42193446 #>>42193844 #
1. nailer ◴[] No.42193844[source]
A. OOP as practically implemented for the last 25 years is glueing functions to state

B. Functions and structs.

replies(2): >>42195309 #>>42195764 #
2. corytheboyd ◴[] No.42195309[source]
In the real world, where many people of varying backgrounds and skill levels are editing the same code, if the OOP method becomes a mess, why wouldn’t the functional approach also become a mess? I think that is more the point OP was making. In a vacuum with a single perfect Adonian programmer, seems like the OOP and functional approaches would becomes the same level of maintainable, because we’re in a vacuum of perfection anyway.
replies(1): >>42195675 #
3. lioeters ◴[] No.42195675[source]
In my experience, the mess created using OOP is harder to untangle than the mess created using a functional approach. With the latter, it's simpler to replace a different function for any part of the logic, and the data is always just data; whereas with OOP the method is usually tied up with shared state and other functions.
replies(1): >>42195837 #
4. chipdart ◴[] No.42195764[source]
> A. OOP as practically implemented for the last 25 years is glueing functions to state

I see you opt to go with a huge amount of handwaving over the question.

> Functions and structs.

That's what a class is, and thus OOP, except it supports information hiding and interfaces. So your alternative to OOP is... OOP?

replies(2): >>42195882 #>>42196371 #
5. chipdart ◴[] No.42195837{3}[source]
> In my experience, the mess created using OOP is harder to untangle than the mess created using a functional approach.

OP complained about accidental complexity, not subjective takes on how hard it is to refactor code.

Even so, anyone who has any cursory experience with TypeScript projects that follow a functional style can tell you without any doubt whatsoever that functional style is incomparably harder to refactor than any "enterprise-grade" OOP.

replies(2): >>42196327 #>>42209066 #
6. Joker_vD ◴[] No.42195882[source]
I suspect "functions and structs" here meant "functions and structs, separately, instead of gluing functions together with structs into unholy amalgams". Basically, Wirth's "Algorithms + Data Structures = Programs" idea.

Compare e.g. to "What should a language have instead of Lua-like tables? Maps and vectors" — "But that's what a table is, so your alternative to tables is... tables?"

7. nineplay ◴[] No.42196327{4}[source]
> OP complained about accidental complexity, not subjective takes on how hard it is to refactor code.

The biggest problem with accidental complexity _is_ how hard it is to refactor code. Refactoring code is a huge part of software development.

8. nineplay ◴[] No.42196371[source]
>>> a) start by stating what you think OOP is

>> A. OOP as practically implemented for the last 25 years is glueing functions to state

> I see you opt to go with a huge amount of handwaving over the question.

I think the question was answered pretty clearly. You can't ask for an opinion ( "what do you think" ) and then criticize the response as 'hand-waving'.

9. nailer ◴[] No.42209066{4}[source]
> Even so, anyone who has any cursory experience with TypeScript projects that follow a functional style can tell you without any doubt whatsoever that functional style is incomparably harder to refactor than any "enterprise-grade" OOP.

My experience differs greatly. One can see functional style has taken off in the TS world, particularly with the popularity of React, so I suspect I'm not alone.