Sign in to follow this  

nameing of funtions and good name for arguments?

Recommended Posts

im after a good guide for nameing funtions and useing good names for arguments

one of my funtions :

void GetLookAtMatrix( IModel* change, IModel* start, IModel *end);

change is the one i want to change , start is one model and end is the other model . it calcs the vector bewteen start and end. and then makes change to make it face that vector......

should the funtion name be GetLookAtMatrix or SetLookAtMatrix

and the argument names are horrible , trying to make it clearer.

is there a good guide for this sort of thing please

Share this post

Link to post
Share on other sites
You could look at some of the 1,000,000 hits google lists for "variable naming conventions" but, in the end, it just needs to be something you're comfortable with (assuming you're working solo).

Make the function and argument names something that will remind you what the function does, and which argument is which. If I were modifying the view matrix for an object based on some input, I'd probably make that function a member of the class. I.e., (IModel*)changeModel->SetLookAtMatrix(IModel* startPoint, IModel* endPoint) or something similar.

If you don't want to move that function to your IModel class, you might want to consider ChangeLookAtMatrix(...) (see below).

FYI, in general, Get_ functions should actually return the value that the function says you'll "get." Set_ functions in general, set the value of a protected or private variable in a class or struct. Calculations can certainly be done in that function.

The Get/Set functions, again, in general, are class, structure or object functions of some sort and are concerned with values for an instance of that class.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this