Swan
Swan copied to clipboard
Swan Style Guide
Rules of thumb
- General 1.1 All names should be pronounceable 1.2 Spaces between methods and properties: See example below
- Variables 2.1 The more concrete the shorter and viceversa 2.2 Defined as nouns
- Functions 3.1 The more concrete the longer and viceversa 3.2 Defined as verbs
Entities naming
property -> obj.thisIsMyProperty; variable -> thisIsMyVariable; *exception: matrices inside methods class -> classdef ThisIsMyClass childclass -> classdef ThisIsParent_ThisIsChild instance -> thisIsMyInstance = ThisIsMyClass(); methods -> obj.thisIsMyMethod(); parent_method -> obj._thisIsMyParentsMethod();
Examples
Filter_P1()
classdef Filter_P1 < Filter
% SPACE
properties
property1
property2
end
% SPACE
methods
% SPACE
function computeCh(obj)
Ch=zeros();
obj.homogTensor = Ch;
end
% SPACE
function thisIsMyVeryConcreteFunction()
myVar = 12;
end
% SPACE
end
% SPACE
end
Feel free to edit my post to add/remove anything!