DEV Community

Discussion on: Code Smell 24 - Boolean Coercions

 
mcsee profile image
Maxi Contieri

I don't know what 'res' stands for.

But if you performed a real benchmark on the code and found out it really needed to be optimized it does not classify as 'premature'.
I'm ok with that since in this very special case speed is more important than readability

Thread Thread
 
yoursunny profile image
Junxiao Shi

res means result. It is common in C code.

Thread Thread
 
mcsee profile image
Maxi Contieri • Edited

ok. that's why i don't like low level languages. They are more cryptic.
I try to specialize on higher level languages. Most code smells apply to them.

I suggest not to use 'res' 'i' ir 'result' as variable names since they have no business meaning.

more examples here:

maximilianocontieri.com/what-exact...

Thread Thread
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

certain things like res and i are so common that I'd consider them expressive variable names, but there's not many. For res, I really like the pascal feature of assigning to the subroutines name, because presumably that's already a descriptive name for the result value.

re not liking low level languages, it seems to me like high- and low-level languages have completely different appeals (I happen to like both of them), so one might like one but not the other. Thinking in systems and poking at bits are as much different areas as back-end and front-end.

Thread Thread
 
mcsee profile image
Maxi Contieri

you are absolutely right. They are different tools for different purposes