My class/struct names are usually descriptive nouns, Person, Cell, Board, Grid, etc... ( wow, I'm full of great ones <- sarcasm )
My variables are usually descriptive ... (i, j, k, x, y, z, position, velocity, acceleration, orientation, count or numElements or maxElements, isDead, etc...).
My point is, I try to make the names self documenting so I don't have to leave so many comments. If you enter a function called Calculate() or CalculateVelocity() which would you need to leave a comment for? Caclulate() would probably need a comment above the signature letting you and others know that is what the function does, calculates velocity. CalculateVelocity() wouldn't need any comments telling you or others what the function does. Inside the function it should be much the same.
Code: Select all
Vec3 CalculateVelocity( const Vec3& CurrentPos, const Vec3& PreviousPos, float DeltaTime )
{
// velocity is the change in position over the change in time ( deltaP / deltaT )
const auto deltaPosition = CurrentPos - PreviousPos;
const auto velocity = deltaPosition / DeltaTime;
return velocity;
}