Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One thing I often see elided in these naming wars is scope: am I the only person who gives longer names to globally visible things than to locals?

For example:

    size_t *find_foo(const char *source_text)
    {
        const char *src = source_text;
        for(; src != 'f'; src++)
           ... do stuff
        ... do more stuff

        return src - source_text;
    }
Now the meaning of "source_text" would not be evident, except for the name. But just glancing at the usage shows that "src" is clearly a working cursor into the source text.

But if I called it "working_cursor" would that really explain anything to the reader? If anything, giving a detailed name risks misleading readers in much the same way as stale comments can mislead.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: