Coding Standards - EranOfek/AstroPack GitHub Wiki
File and directory names
- Package names shall start with lowercase letters (e.g., +imProc). A few (old) exceptions exit (e.g., +VO).
- Class names shall start with an uppercase letter (e.g., @AstroImage).
- Function and methods names shell start with lowercase letter (e.g., flat).
- Variable names shall start with an upper-case letter.
- Property names in a class shall start with an upper-case letter.
Input arguments
In cases where input arguments with some default are required and/or key,val input arguments are needed, we shall use the matlab "arguments" block, where keyword values are marked as "Args.":
function Result = Funname(Obj, Args)
arguments
Obj
Args.Min = 1;
Args.Max = 5;
end
UnitTest
Each package/class should have a unitTest function. In the case of a class, this is a static function. The purpose of the unitTest function is to enable testing of the functions in the class/package.
Classes
A class should always reside in a directory that starts with "@" (e.g., @ImageComponent). The methods of a class shall reside in the same file as the class definition. An exception is the unitTest static function that shall reside in a separate file.