Hacker News new | past | comments | ask | show | jobs | submit login
What acronyms and abbreviations in source code are sensible?
6 points by Tomminn 6 days ago | hide | past | web | favorite | 3 comments
I'm thinking things along the lines of "num" for "numberOf" and "max" for "maximumOf".

It depends. For example, if you are writing code using HMMs the following would be adequate:

    while True:
        pi1 = dot(A, pi)
        if norm(pi - pi1) < eps:
            return pi1
Because whoever is reading the code can be expected to know what pi, pi1, A, dot, eps and norm are from context. I usually write some comments at the top of the module in case things could be unclear. Then I use short names wherever possible; subst for substitute, tmpl for template, expr for expression and so on. But you have to experiment yourself and see what fits your style and programming strength -- there are no hard and fast rules.

Whatever all the contributors can agree on, keeping in mind there may be future contributors e.g. new starters.

So if it’s a solo project anything goes.

If it’s going to be maintained by a big team long term then be conservative.

Anything, although if it is unclear then comments can be helpful to clarify it.

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