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?
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

回答(2 个)

Udit06
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.

Ayush Anand
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:
  1. 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.
  2. 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.
  3. 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.

类别

Help CenterFile Exchange 中查找有关 Software Development Tools 的更多信息

标签

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by