MATLAB Answers

MATLAB is not a fully oop yet... why is this?

1 view (last 30 days)
Dear MATLAB community,
Could anyone tell me why some authors say that MATLAB is not a fully object-oriented programming language yet? They never argue.
Thank you!

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 4 Jan 2012
MATLAB OOP does not handle multiple inheritance.
Methods are chosen only based upon the first parameter, and not based upon the full signature.
There are some aspects of meta information and dynamic properties that are not really together yet.
Arrays of homogenous objects have to be derived from a specific class, and they have some clunky behaviours.
MATLAB OOP is also measurably slow.
At last glance, it looked like OOP support was not well advanced at all at the Mex level, but I might have misunderstood what I was glancing at.

  3 Comments

Ricardo Prada
Ricardo Prada on 4 Jan 2012
Thank you Walter. Your explanation helped me a lot.
James Tursa
James Tursa on 4 Jan 2012
FYI, OOP programming at the mex level is very inefficient. The only functions available, mxGetProperty and mxSetProperty, make copies of the properties instead of returning pointers to the properties. For large sized properties this can be a major issue. I have written a mxGetPropertyPtr routine (in the FEX) that solves part of the problem. Your comments remind me that I need to test and post the other routine I wrote, mxSetPropertyPtr, that solves the other half of the problem.
Ricardo Prada
Ricardo Prada on 6 Jan 2012
Dear James. Thank you very much for the additional information. I know this is not the right place to ask these kinds of things, but let me ask. Comparing Matlab with Python, which language do you think better deals with OOP, considering numerical computing not an issue?
Thank you.

Sign in to comment.

More Answers (1)

Titus Edelhofer
Titus Edelhofer on 4 Jan 2012
Another aspect: you might well stick to the functional programming paradigm in MATLAB, if you like. My personal view would be to call MATLAB in this sense a hybrid language (in some sense like C++ where you can also mix OOP and functional programming, it's neither nor to 100%).

  2 Comments

Sohail S
Sohail S on 4 Dec 2012
Comparing Matlab and C++ is not correct in this sense. C++ is hybrid, but in a different sense, with full ability and efficiency of different paradigms (OOP, generic (template based), structured progrming, system programming, etc). Matlab tries to emulate these practically. However, it doesn't mean either of C++ or matlab is always worse or better (I use matlab)

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!