How to organize program files in OOP with classes and tests?
7 次查看(过去 30 天)
显示 更早的评论
Hi guys,
I am creating a simulator in OOP, including many classes and corresponding tests, using the Unit-Test framework.
(Test are made using classes too)
I have something like this in the directory:
root/
@MAC/
MAC.m
f_mac1.m
f_mac2.m
tests/
test1.m
@PHY
...
I don't need to export my code, or share it.
How can i organize my files in the best within OOP paradigm?
I have read this: https://nl.mathworks.com/matlabcentral/answers/350269-how-should-i-organize-my-matlab-files, but it's too generic.
Where shall I place tests and, how to call the tests, that are testing a given class?
Shall I use the @, or not?
What should be in the Matlab path?
I am getting strange errors about name mismatching.
Thank you
Marco
0 个评论
回答(2 个)
Udit06
2023-8-25
Hi Marco,
You can refer to the Class and Package Folders section from Class File Organisation MATLAB documentation to understand how to organize program files in OOP with classes and tests.
I hope this helps.
0 个评论
Ayush Anand
2023-8-29
编辑:Ayush Anand
2023-8-29
Hello Marco,
I understand that you want to know more about how to organize files in accordance with the OOP paradigm including classes and tests.
You can refer to the following pages for understanding how to organize your files in accordance with the OOP paradigm:
- https://in.mathworks.com/help/matlab/object-oriented-programming.html: This documentation provides an overview of OOP concepts in MATLAB, including class organization, file organization, and packages.
- https://in.mathworks.com/help/matlab/matlab_oop/scoping-classes-with-packages.html :This page explains how to use packages to organize related classes and control access to class members.
- https://in.mathworks.com/help/matlab/class-definition-and-organization.html: This page provides guidelines for organizing classes, including file naming conventions and folder structures.
I hope this helps.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Software Development Tools 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!