How to organize program files in OOP with classes and tests?

7 Ansichten (letzte 30 Tage)
Marco
Marco am 2 Aug. 2023
Bearbeitet: Ayush Anand am 29 Aug. 2023
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

Antworten (2)

Udit06
Udit06 am 25 Aug. 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.

Ayush Anand
Ayush Anand am 29 Aug. 2023
Bearbeitet: Ayush Anand am 29 Aug. 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:
  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.

Kategorien

Mehr zu Software Development Tools finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by