Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Refactoring if statements for readability (codereadability.com)
2 points by mostlystatic on Aug 29, 2015 | hide | past | favorite | 1 comment


Lets not limit it to if statements. Writing or refactoring existing code by using meaningful variable names can go a long way in increasing the readability of the code. I follow a simple rule to make my code easy to follow: 1.variable names should indicate what they will be containing

2.name the function with atleast one verb denoting what the function does.

3.file names indicate what code in it is trying to do.

Small changes like this can help more than comments some times to understand and read code.

Finally code is meant for humans to read. So be expressive!




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

Search: