Hacker News new | ask | show | jobs
by H4ZB7 1201 days ago
"java trying to force its world view" is the correct way to design a programming language, just java is a bad language, and only half way forces its world view when it has to be 100% for this idea to work. in the sense that there shouldn't be things like int32 in a high level language.

also the OOP paradigm makes no sense and is just pseudoscience. i can't even think of a valid reason to use objects once you get past the cat/dog/animal example which only makes no sense because the proposed problem has no concrete requirements. there are no small examples where objects make sense, and for any big example it would require days of analysis to reach a conclusion. there are lots of invalid reasons, like some syntactic convenience of x.fff().zzz(), this example being invalid because that syntactic benefit can be better achieved by a composition operator like in bash: x | fff | zzz

if i look at any OOP codebase the first thing ill see is someone pointlessly loads up some data into an object and calls obj.method() which then just unloads the data as if they were just parameters to that function. why did you even make the object in the first place? because OOP braindamage, simple. you've been trained that this is somehow the ethically correct way to do things.

the idea that objects provide some new type of abstraction is just nonsense. those constructs were already doable in ML as well as by convention in C or any imperative language, which is how most such languages are in fact written. all OO adds is interfaces which are done better by many other languages, and inheritance which is just a joke.

2 comments

> if i look at any OOP codebase the first thing ill see is someone pointlessly loads up some data into an object and calls obj.method() which then just unloads the data as if they were just parameters to that function.

nope, never seen that.

it seems you have only ever looked at bad code. or maybe only ever written it?

> i can't even think of a valid reason to use objects once you get past the cat/dog/animal example

Because you have internalized the braindamage you claim others have. If you think "an object in code corresponds to an object in the real world" then you are victim of the object=noun method=verb braindamage.

An object is just a tuple. A method is just a procedure with an implicit param. OO is a way to factor code into pieces and to name and reuse those pieces. inheritance is for liskov substitution.

inheritance is NOT for liskov substitution, and not even OOP fans will argue that as most even consider inheritance a mistake. inheritance is specifically to make a subclass with the same methods and allow overriding a select few. it's basically just a syntactic shortcut. you get the added bonus that it of course still satisfies the interface of the parent, which is the semantic part, but this is a vanishingly small benefit