How to organize program files in OOP with classes and tests?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Udit06
el 25 de Ag. de 2023
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 comentarios
Ayush Anand
el 29 de Ag. de 2023
Editada: Ayush Anand
el 29 de Ag. de 2023
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 comentarios
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!