Hacker News new | ask | show | jobs
by bufferoverflow 2187 days ago
And

* magic numbers

    m_iSimClass = 3;
    return 1E10;
    m_timeSmooth*(1/0.3f)
    sqr(0.0001f)
    m_pos.len2()>1E18
    helper.pos.len2()<50.0f
    sqr(m_size.x)*g_PI*0.25f && maxdim<m_size.z*1.4f)
    *1.05f
    *0.4f
    *0.2f
    <0.087f
* Very few comments explaining what's going on

When I was getting my CS degree, my professors required, at the very least, to describe what each method does, what each argument is, and a possible range of values of each, and the same for the return value.

I hate this "self-documenting" nonsense, which obviously doesn't work. This piece of code is a good example of that.

1 comments

Not defending the use of magic numbers but some of it is clear for someone who has written physics code before.