Swan icon indicating copy to clipboard operation
Swan copied to clipboard

Swan Style Guide

Open marcnunezc opened this issue 5 years ago • 1 comments

Rules of thumb

  1. General 1.1 All names should be pronounceable 1.2 Spaces between methods and properties: See example below
  2. Variables 2.1 The more concrete the shorter and viceversa 2.2 Defined as nouns
  3. 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

marcnunezc avatar Mar 14 '19 18:03 marcnunezc

Feel free to edit my post to add/remove anything!

marcnunezc avatar Mar 14 '19 18:03 marcnunezc