Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 1.13 KB

NumberOfParams.md

File metadata and controls

32 lines (22 loc) · 1.13 KB

Number of parameters in method (NumberOfParams)

Description

It is not recommended to declare many parameters in functions (best practice to use not more than seven parameters). In So doing there should not be many parameters with default values set (best practice to have not more than three such parameters). Otherwise code readability decreases. For example it is easy to make a mistake in number of commas passing optional parameters.

If need to pass many parameters to a function, it is recommended to group same-type parameters into one or more composite parameters of type Structure.

Examples

Incorrect:

// Create an item in catalog "Goods"
Procedure CreateSKU(Name, Goods, Units, Weight, Check = True)
// ... 
EndProcedure

Correct:
Group parameters, having goods item properties into Structure Values.

// Create item in catalog "Goods"
Procedure CreateNewGoods(Values, Check = True)
EndProcedure

Sources