Comparison: Object oriented programming in Matlab (Pre R-2008 and Post R-2008)
Mostrar comentarios más antiguos
Hi, I've recently started to learn Object-Oriented Programming to develop a toolbox for nonlinear control algorithms (optimization-based)in Matlab. I came across a book "A Guide to MATLAB Object-Oriented Programming" by A. H. Register from year 2007. It uses old syntax for OOP in Matlab and read some threads that this old syntax is obsolete but still supported in Matlab. The new syntax looks more intuitive and easy to understand and somewhat close to C++ class. Before I start to implementing code, I need to get some expertise opinions regarding pros and cons of each syntax according to the following criteria:
- Performance regarding execution time: My algorithms will be based on nonlinear optimization techniques, therefore, performance is the most important key factor. Which OOP syntax leads to better execution time for the same problem?
- Support: Will old OOP-syntax be supported in the future releases?
If there are some other criteria related to the pros and cons of OOP-syntax's, I'll be very glad to know.
Many thanks in advance.
Regards, Saif
5 comentarios
per isakson
el 26 de Mzo. de 2017
Editada: per isakson
el 27 de Mzo. de 2017
- A.H. Register describes an enhanced version of the old OOP, which I assume he had developed without knowledge of the new OOP.
- The old OOP is removed from the documentation. If the code is still included in MATLAB, that's to make it possible to run old programs.
- I'm convinced that old or new won't significantly affect the performance of your nonlinear optimization.
- Maybe you shouldn't use OOP at all.
Matlab OOP and performance don't generally mix too well unfortunately. There are things you can do to avoid some of the more obvious OOP performance problems, but when I have got to optimising an OOP algorithm that is time-sensitive I find myself feeling the need to strip it down to almost render the OOP aspect pointless.
I use OOP for ~90% or more of my programming (though didn't start until after 2008 and always use the huge Matlab OOP pdf as my reference), but in most cases performance is not such a big issue. However, for my current work on a highly iterative algorithm it is hard to make OOP performant.
user
el 28 de Mzo. de 2017
Adam
el 28 de Mzo. de 2017
Certainly it sounds like it is worth redesigning to OOP. Performance can always be considered afterwards too using the profiler.
per isakson
el 31 de Mzo. de 2017
Respuestas (0)
Categorías
Más información sobre Digital Filtering en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!