In the old days i had,
Currently the specifiacations are way too big for any mortal to understand anymore.
Bloated like rust.
Currently the specifiacations are way too big for any mortal to understand anymore.
Bloated like rust.
Absolutely can be done in C. Qt, GTK a few other "frameworks" do just that. Generic "GObject" is a structure, "my new object" extends GObject so GObject* and MyObject* work.I think, one thing is OO programming style as you described it, concentrating on objects, other the OOP languages. The languages are the tools. Perhaps this "sub-typing polymorphism" could also be achieved in C, although its type strength may be an obstacle.
Is there a performance penalty inherent in OOP complexity?
YesOnly used for event driven non OO programming?
While OOP is (in theory) zero-cost at the implementation level, it tends to promote designs which are not efficient concering, e.g., cache usage.Not necessarily. OOP in C++ is covered by its zero-cost abstraction promise for it. Virtual functions with runtime dispatch are a different matter of course. But the alternative to those would be chains of if-statements so it is hard to say whether that represent a slowdown due to OO. Multiple inheritance is zero-cost.
In Common Lisp you could have similar zero-cost OOP, but in practice the popular OO system CLOS rarely reaches that. That's a reason why I rarely used it.
Abstraction is the whole point, the origin core motivation for every HOL.Only interesting paragraph for me:
Abstraction
to me it shows you are trying to grasp certain concepts by freeing it from the abstraction.Perhaps OO languages offer ways to structure data in memory?
In 95% of cases (even 98%) "pointers to structures in C" are enough.Sure, the theory looks nice. I do understand that it may have advantages, encapsulating code, making some order,
but I have the feeling it is an exaggeration. If I have to program, I have no idea how to begin using that.
Are eventually pointers to structures in C not enough?
Definitely, there is. Mostly from object constructors (and destructors). Imagine a 10000-iteration loop with 5 local objects some of which contain other objects with constructors. 50,000-100,000 constructor methods are called "invisibly".Is there a performance penalty inherent in OOP complexity?
Well my first experience programming was with the pseudo machine language of old programmable calculators, then FORTRAN IV. In spite of never again programming with that, it remained something like my mother tongue, I program C like FORTRAN. The other low level source was just one course on computer architecture, with Hill Peterson's book, perhaps from the end of the 1970s, no microprocessor, a variant of APL used for circuit design. I do understand and like abstraction, it is definitively necessary, but for me it loses its sense when one loses the connection to the ground.On the other hand, if you are versed in assembler, you always may think of how things may look like in the machine.
While this may help on certain debugging issues it counteracts the idea of abstraction.
Without any abstraction this was programming in machine languages, only. Not to imagine where we were today if we had nothing else but assembler languages, only.I do understand and like abstraction, it is definitively necessary, but for me it loses its sense when one loses the connection to the ground.
I like the way Golang took a pragmatic rather than dogmatic approach to it. It's classless, so it favours composition over inheritance.
You can achieve this with type embedding.I dunno. If I'm supposed to do OO programming then I want full inheritance with code, and multiple inheritance at that. Code reuse matters to me.
IMHO, the most complex side of multiple inheritance is to find situation where you need it.I dunno. If I'm supposed to do OO programming then I want full inheritance with code, and multiple inheritance at that. Code reuse matters to me.
Car & Plane -> BatmobileIMHO, the most complex side of multiple inheritance is to find situation where you need it.
Go's interfaces are not as nice as Haskell's type classes. At one point I had the idea of proposing specifying axioms as part of a Go interface but I refrained as doing it right would require some thought. The axioms put constrains on behavior of interface functions but that may require more compile/link time machinery. Example for a Stack interface:I like the way Golang took a pragmatic rather than dogmatic approach to it. It's classless, so it favours composition over inheritance.
Even multiple inheritance diamond graphs have their use; I once managed to get a team of really good computer scientists (not programmers, everyone in the group has a CS PhD) to accept using it in a large and production-ready C++ code base.Car & Plane -> Batmobile
Lazy much? Most of the pages are source code that demonstrates the concept. It wouldn't hurt to do a few exercises and run the stuff and solve problems. I spent first two years of my college career learning Java and how to use it to problem-solve. Had to buy 4 textbooks worth in aggregate 2000 pages. And I still have those books. C++ scared me away, though.About 878 pages, only for starting? No, I will not read that!
I strive to write code in OO fashion whenever I can, for two reasons:I have just learned a little of Javascript, some principles, what objects are, prototypes, inheritance, constructors.
I played a little with node.js
I also read once about the tcl extension tclOO for object oriented programming, but forgot everything.
Sure, the theory looks nice. I do understand that it may have advantages, encapsulating code, making some order,
but I have the feeling it is an exaggeration. If I have to program, I have no idea how to begin using that.
Are eventually pointers to structures in C not enough?
What is your opinion / experience?