Comparison: Object oriented programming in Matlab (Pre R-2008 and Post R-2008)
이전 댓글 표시
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
per isakson
2017년 3월 26일
편집: per isakson
2017년 3월 27일
- 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
2017년 3월 28일
Adam
2017년 3월 28일
Certainly it sounds like it is worth redesigning to OOP. Performance can always be considered afterwards too using the profiler.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Digital Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!