MATLAB is not a fully oop yet... why is this?
1 view (last 30 days)
Show older comments
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
Accepted Answer
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
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.
More Answers (1)
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
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)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!