The first output of a constructor should be the object of the class

IDFCNS-20
TitleThe first output of a constructor should be the object of the class.
PriorityMandatory
Severity level1
DescriptionThe first output of a constructor should be the object of the class.
RationaleIf the first output is not the object of the class, it will result in a runtime error. It is not logical and harder to read if the first output of a constructor is not the object of the class.

Avoid:

classdef ConstructorDesign

   properties
      computedValue
   end

	methods
		function x = ConstructorDesign()
			obj.computedValue = 100;
			x                 = 101
		end
		
	end
end

Instead use:

classdef ConstructorDesign

   properties
      computedValue
   end

	methods
		function obj = ConstructorDesign()
			obj.computedValue = 100;
			x                 = 101
		end
		
	end
end