Chose names with shaded directional meaning

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the naming category.

Last Updated: 2024-03-02

I had a method called orderByDistance but it needed a comment to clarify whether the first elements in the output were the nearest or furthest. A better name for the method - one that wouldn't need a comment - would be orderByProximity since the word "proximity" suggests order, i.e. the nearness.


When naming functions whose return value has some order, use adjectives that communicate that meaning rather than bland nouns that remove it.