sark02 wrote:
I don't think there's much serious debate on whether or not OO has value for projects of significant size and complexity. "Object Oriented" is a point of view - an abstraction model - a way of breaking down a system into pieces and then understanding the relationships between those pieces. It's what software engineers do every day, and it's not scary.
This is what bothers me. Windows and their components as well as real life objects which can be categorized are ideal candidates for OOP. However, to expect programmers to view
every aspect of programming as a collection of objects only serves to detract from the value of OOP languages in general since it is implied that a procedural approach is impossible.
Wrapping variables inside a
struct or
class does not automatically make something an object. For example, in database records, a struct is simply a convenient way of organizing the information contained in that datase. It doesn't make the record resemble some physical object. And in a class like
java.lang.Math, would anybody seriously call that an object instead of a collection of maths functions?
Once it is realized that one can still adopt a procedural approach and use objects where naturally convenient, the value of using an OO language becomes more apparent.
sark02 wrote:
This thread was about Object Oriented dispatch - a language neutral topic, so this car has veered way, way of the road. The core question from the poster was as relevant, I think, as the implementation of Forth's NEXT primitive. It is the sequence of operations needed to call a class-specific method, and is at the very core of an OO implementation. So, what is the best way to implement a class-specific vtable or similar object-type-specific jump table on the 65816? If anyone is still interested in that question, I would suggest reading the first message of the thread.
The OP was discussing ways to implement jump tables and indirect pointers to functions on the 65816. This of course is necessary if you want "polymorphism" (where a pointer to one type of object is made to point to a descendant of that object) since you may not know until run time what type of object the pointer will end up pointing to.
Me? I still like pushing the destination address on the return stack and executing RTS. It works a treat on the '02 but there may be better ways on the 65618 with its 16 bit index registers and relocatable Z-page.
This discussion shows that OOP has some slowdown factor because you can't make direct function calls from an object. That may be a consideration in a system where timing is critical. The C code equivalent that I posted above still allows direct function calls. You could probably still implement polymorphism in C (with a similar degradation in performance).