Jump to content
  • Advertisement
Sign in to follow this  

nameing of funtions and good name for arguments?

This topic is 2892 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!