3 ms·
> itostr takes time to mentally process (or pronounce), if I had to read your code. integer_to_string takes no effort and can't be confused. The idea is that t
by hassy 18y ago
> itostr takes time to mentally process (or pronounce), if I had to read your code. integer_to_string takes no effort and can't be confused.
The idea is that the first time you saw `itostr` you'd do something like this:
* Jump to the definition of `itostr` (a couple of keypresses in Emacs).
* Read the Edoc comment for the function ("Convert integer to string").
* Jump back to where you were (one key combo).
Sure, if the function was named `integer_to_string` you wouldn't have to do the above. But this was a trivial example. Many functions would take more than three words to describe what they are doing precisely, especially when your functions are granular and do exactly one thing. This can quickly lead to long lines, which I find hard to read and ugly.
At the end of the day, it's all down to personal preferences and style. I like things this way, and you like them the other. It's just the way it is, and there are arguments for both approaches. For me, the benefits of terse naming outweigh its disadvantages, and the advantages of long descriptive names.
- ericb 18y agoI guess, to me, if those lookup keystrokes resulted from saving a few keystrokes in a function name, and developers might look it up many times, it doesn't seem like you come out ahead. But, as you say, to each their own.
- jamongkad 18y agoPersonally I would rather have descriptive variable names such as "this_goes_to_db" or something to that effect. But then the question is how long is too long? and by me practising that I find my code it readable but at the same time uneccesarily verbose.