Hacker News new | ask | show | jobs
by nawitus 4060 days ago
"Since functions and data structures are completely different types of animal it is fundamentally incorrect to lock them up in the same cage."

The conclusion doesn't follow.

"In an OOPL data type definitions belong to objects. So I can't find all the data type definition in one place. In Erlang or C I can define all my data types in a single include file or data dictionary. In an OOPL I can't - the data type definitions are spread out all over the place."

That's not true, you can create a file which contains all the types as interfaces.

"In an OOPL I have to choose some base object in which I will define the ubiquitous data structure, all other objects that want to use this data structure must inherit this object."

You can implement an interface instead of inheriting a class.

2 comments

Yeah, I've read some good arguments against OO and this really isn't one.
In regards to the first quote, I find it helpful having both the data structures and algorithms in one "cage." I like having all relevant data in one easy to find location.
I agree, it's a family of closely-related implementation details.

You can also shrink the scope using visibility, get inherent namespace benefits for what would otherwise be loose functions, etc. The benefits are primarily organizational but organization in programming is a big deal.