New answers tagged coding-style
0
votes
Best style practice: avoid negation in conditionals?
After having worked for years with tons of C and C++ code where if(x) or if(!x) was used to test if a pointer or integer x was valid or not, I got used to this idiom and don't see a huge difference to ...
7
votes
Should I use unnecessary function for readability sake
Possibly yes, but in this case no —- because your extra functions don’t make your code more readable.
const renderNavBar = (size ==='small') ? renderMobileNavBar : renderDesktopNavBar;
/* whatever*/
...
2
votes
Best style practice: avoid negation in conditionals?
Express the intent
The driving principe should be to express intentions, i.e. what you really mean to achieve. This makes the code self-explanatory.
Applying this principe to integer comparisons with ...
14
votes
Accepted
Should I use unnecessary function for readability sake
We do a lot of things in programming just for the sake of readability - like giving variables meaningful names (instead of just naming them a, b, c, d, ...).
Or specificially conditionals - there is a ...
Top 50 recent answers are included
Related Tags
coding-style × 1008coding-standards × 141
java × 98
c++ × 96
code-quality × 87
programming-practices × 74
c# × 72
python × 72
clean-code × 64
design × 50
c × 49
javascript × 45
naming × 43
object-oriented × 42
readability × 36
php × 27
language-agnostic × 24
design-patterns × 23
comments × 21
refactoring × 18
conditions × 18
architecture × 17
code-reviews × 17
variables × 16
code-formatting × 16