(It's kind of like when people told me about "user defined data types" and I couldn't wrap my head around how you could create a new data type with all its associated syntax. Then when I learned that they were just bundles of existing data types, though 'oh is that all?')
The guy that invented OOP is on record as saying that.
[1] ftp://bitsavers.informatik.uni-stuttgart.de/pdf/borland/turbo_pascal/Turbo_Pascal_Version_5.5_Object-Oriented_Programming_Guide_1989.pdf
When I get that feeling, what's really happening 99% of the time is that the person trying to explain actually has no idea what they're talking about, but doesn't want to admit it.
If you understand a concept well enough, you can explain it simply and succinctly (barring things like really esoteric maths/physics, but nothing in computing is that difficult in my experience).
I think I struggle to learn a lot of functional programming concepts now because it's even more distant and abstract explanations.
I've come across this a lot. Some people (like you perhaps) view computing in terms of machines, and others in terms of mathematics and formalism. (I'm lazy and lack principle, so I will go with whatever interpretation is easiest.) FWIW, I've met at least one incredibly smart person from both camps.
If you're into compilers at all, you might appreciate this[1] - how the "machine tribe" and "lambda tribe" view the same thing.
[1] https://wingolog.org/archives/2011/07/12/static-single-assig...
Well, that's one way to put it. What's really going on is they are trying to describe an abstraction from a user's perspective. So you could say the point of abstraction is to be "deliberately obtuse" in a productive and healthy way.
It's also common for people to try and fail to abstract things. Bad abstraction can be a net negative. It's likely that was what happened here.
And, to agree with you, OOP as a taxonomy of physical objects is both a pervasive and a bad idea. The point of classes and objects is to group data and functionality together. The things you do with a "Rose" may or may not look like the things you do with a "Cactus". Forcing them into the same hierarchy of behaviors because they are both "Plants" is injecting extra requirements into the system.
All language constructs can be broken down into simpler ones, at the end of the day. We might talk about how subroutines are just overrated assembler macros. C++ isn't very clean so the fact that these fancy schmancy objects are just structs + function pointers is very obvious. But when done cleanly, I'd argue that an object is more powerful than the sum of its parts.
I think I agree with your assessment of C++. What languages do you feel deal cleanly with objects so they exceed the sum of the parts?
There are certain famous FP language implementers that should probably read what Guy Steele wrote in the topic, because listening to their talks I strongly get the impression they haven't.
I saw Guy's growing a language talk before, but I don't think he's ever chimed in on this debate before. Most people at his level simply except the world without much bias, and are comfortable using object and functional styles when necessary.
Can you explain more in depth why exactly? Is it because of e.g. http://stackoverflow.com/questions/5989734/effective-c-item-...? Or just not liking the syntax? Or private members?
I've been saying this for a while: of all C++/Java-style OOP we're mostly saving uniform function call syntax (cf. go, rust, nim, D and a bit C++17) !
You could have, through some convention, the inheritance tree encoded into structs, but that's true of every language feature really. At no point do mots language feature stop being "structs + functions", because that encodes data + code.
Structs and OO by contrast could be considered as premature composition. ;-)
Reducing things to just their primitives ignores how useful abstractions are for humans. Not everyone thinks it's a good use of their time to reinvent classes & objects or closures with structures and function pointers. Thus why those abstractions are part of so many programming languages (to answer the expressed bafflement one level above my initial reply).
Some C or assembly fans act like abstractions should end at that level, for some strange reason.
[1] Look for the instructions prefixed with FC = Floating-point Complex
https://developer.arm.com/docs/dui0801/latest/a64-simd-vecto...
There are lots of processors out there besides CPUs. You could even design a new processor or program an FPGA to do complex math. Fast Fourier transforms deal with imaginary math, for example. You can do those in a number of ways, including on a CPU or GPU, but it's not unheard of for companies to use either custom hardware or programmable hardware to meet performance needs.
class Complex {
double real;
double imaginary;
}
Or similar. Maybe template it so you can have a Complex<double> instead. It's still fundamentally a combination of existing types.That's very convenient when you want your complex numbers to work just like ints and floats.
> when I learned that they were just bundles of existing data types, though 'oh is that all?'
Uh-huh. When I learned how everything just translates to 0s and 1s in the end, I was also super "disappointed". Higher-level constructs and abstractions are new compositions of lower-level building blocks? How.. plain!
You don't have to use existing data types when defining your own if you really don't want to. It's not 'just' that, it's about setting up your own behavior.
I mean objects are structures with pointers in the same way that OS is just an RPC server and databases are lists of arrays. ;-)
What you see as "delusions of grandeur" I see as the elegance of two concepts which, while duals with each other, are much more general than bare function pointers.
(And yes, I understand very well how closures and objects are implemented using function pointers.)
This fact doesn't offer us any insight into the nature of language constructs, though.
Beware of the Turing tar-pit in which everything is possible but nothing of interest is easy.
A lot of people think about objects as a language feature, when they're really a design paradigm; and like all good design paradigms, you can use more or less of them depending on how well the paradigm fits a particular piece of code.
I agree though, when I dabble in C I often end up writing objecty code. Sometimes it's even a bit functional..
OO languages make this a lot more easy.
A JIT-ing interpreter, for example, doesn't have to use function pointers to implement objects.
Curious if this opinion extends to something like an Erlang process or a BSD thread.
Thanks btw for all your FreeBSD work :))
No layer is truer than another IMO, it's hard to say which matter the most.. the abstraction or the implementation.