Ad Code

What is rule 13 of naming convention in Java and C++ ?

What is rule 13 of naming convention in Java and C++ ?



Rule No.13 of naming conventions says that functions (methods returning an object) should be named after what they return and procedures (void methods) after what they do. It means that every function should be named such as by just reading the function name only, the reader can get the idea of the task performed by the function.
For example, below given function name is not correct as it adds two integers and displays the sum but by reading its name, it is percieved that it is returning some value which is not correct.

void getSum(int, int);

The above function should be named as below:

void DisplaySum(int, int);

So now by reading the above function name, it become clear the purpose of the function which makes the code easy to read.
Reactions

Post a Comment

0 Comments