Live data from Hacker News

Moving Beyond the OOP Obsession

prog21.dadgum.com

51–60 of 72 posts

Re: Moving Beyond the OOP Obsession

#51
post #14

A value, with a type. Nothing else. Stop highjacking everything into your OO religion. If you take everything of a value that originated elsewhere, there will be nothing left in the OOD.

Okay, now give me some collection like object, who can handle everything. No, don't use void*. There are some benefits if everything is an object, like generics.

Ever seen STL? It is as anti-OOP by design as it gets.

Re: Moving Beyond the OOP Obsession

#52

Okaaaaaaay, so if we left everything what OOP gived us (properties^1, generics, lot of good patterns^2, lot of abstractions for generic things, like interface^3, events, higher level datastructures, delegates, namespaces, modules^4 etc.) then we get C? Omg, thank you Captian Obvious! Learn OOP first. What a bullshit article. 1) C++ for OO example? Seriously, why??? Grab a modern language who have properties at least.…

Generics got 100% nothing to do with OOP.

Re: Moving Beyond the OOP Obsession

#53
Not sure I understand the point of this article, especially in the context of C++ where encapsulation with classes helps avoiding things like memory leaks, dangling pointers and co. If you feel you need to code C style, use C, with all the problem it might incur.

Re: Moving Beyond the OOP Obsession

#54
post #46
post #40

Earlier quoted context omitted.

Are you saying all these outlets (labels, text box, buttons) are inheriting from a base FormObject that can be rendered? That would work without OOP. Make a FormRender component that manages that logic (being rendered in a form) and other components, one that manages a keyboard, other that can be clicked and handle hover, touch states, etc.

Sure, but routing get's complex in your solution. The point was OOP is a natural fit for collections of different types in some context ex:GUI, Simulation, etc. The classic OOP case is probably a MUD where OO code ends up being very straightforward. IMO, the problem is it works really well in so many contexts that people end up trying to use it everywhere.

OO in MUDs seemed so natural to me, I think, because they're closer to the actor model that OO was really designed for. Instead of "methods", many objects in MUDs (depending on the system, I used to know more when I was research writing a MUD engine in erlang), respond to messages in more of a smalltalk-style.

Re: Moving Beyond the OOP Obsession

#55
post #27
post #23

Earlier quoted context omitted.

A struct is an object. Even a plain integer is an object, considering the referred article was talking about C++. (Yes, you cannot inherit all kinds of objects – but you definitely can inherit any kind of struct, POD or not.)

Well, if everything is an object, I guess everything is an object. Usually when people are talking about OO objects they mean data+behaviour.

> when people are talking about OO objects they mean data+behaviour

The distinction between behavior being "a set of methods defined inside a class", and "a set of methods whose first param is a particular type of struct" is not that important.

Re: Moving Beyond the OOP Obsession

#56
post #33

Earlier quoted context omitted.

> Without inheritance, as soon as you want to cast mixer to something else, you're either relying on binary wizardry by the compiler Why would you want to cast mixer to something else? What real-life task does it solve? > If we assume we have both a hardware mixer and a soft mixer which both have the set volume method, we wan't polymorphism so we can treat them equally. Polymorphism isn't OOP feature. You can have ov…

> Why would you want to cast mixer to something else? Did you ever heard about interfaces? You can have a IMixer interface, a Mixer baseclass and some concrete mixer classes depending on your task. Like null-mixer for mocking, software mixer for legacy computers, hardware mixer with GPU support, etc. Use your imagination, Luke!

Or you could just have data. The behavior of mixing is not going to change because of those things.

Re: Moving Beyond the OOP Obsession

#57
post #12

>Now here's what this would look like in C++ without using objects: mixer_set_volume(m, 0.8); What is m, if not an object?

The point is not a lack of objects but a lack of OOP. Yes, there are "objects" but there is also a separation between objects and methods etc.. The issue with m->set_volume(.08) is it becomes difficult to tell what happens inside set_volume() because in the method scope you have access to the internals of the "m" object, not just the interface. With mixer_set_volume(m, .08) you have ".08" and "m" but only the interfa…

Can you expand on this? I'm not sure I follow, but maybe there's something particular to C++ here that I don't get as I'm not well-versed in it.

>> The issue with m->set_volume(.08) is it becomes difficult to tell what happens inside set_volume()

Isn't that the point? That you shouldn't have to care what happens inside set_volume? If mixer was designed and implemented well, then set_volume (along with the rest of its interface methods) should consistently and correctly handle its internal state.

Re: Moving Beyond the OOP Obsession

#58

Earlier quoted context omitted.

Exactly. OOP is: a) A code naming/organisational issue b) Some formalisation of structure, so that developers can specify what is/isn't allowed in their code. Both of thise have advantages and disadvantages, and the structure can be over-formalised and made too complex. But this doesn't make OOP bad. It makes bad design bad.

Well yes, when you redefine "OOP" to mean "well-organized code," then all well-organized code is object-oriented. That's not what people mean when they refer to OOP though -- they're talking about data+behavior encapsulation, inheritance, message-passing, etc.

OOP is not "well-organized code". It is a specific kind of code organization that derives a good part of its value from being universal.

Re: Moving Beyond the OOP Obsession

#59
post #51

Earlier quoted context omitted.

Okay, now give me some collection like object, who can handle everything. No, don't use void*. There are some benefits if everything is an object, like generics.

Ever seen STL? It is as anti-OOP by design as it gets.

Hello, it's 2016. Did you heard Java or C#? Or even Delphi?

Re: Moving Beyond the OOP Obsession

#60

Okaaaaaaay, so if we left everything what OOP gived us (properties^1, generics, lot of good patterns^2, lot of abstractions for generic things, like interface^3, events, higher level datastructures, delegates, namespaces, modules^4 etc.) then we get C? Omg, thank you Captian Obvious! Learn OOP first. What a bullshit article. 1) C++ for OO example? Seriously, why??? Grab a modern language who have properties at least.…

Modules, namespaces, interfaces, many other things on your list, also have nothing to do with OOP.
Post reply on HN