BP18: Make code as readable as possible, not as short as possible

  • Write your code to be as readable as possible.
  • It doesn't matter if the total count of lines of your code becomes higher after the refactoring. If it's for the sake of clarity, it's perfectly okay.
  • Don't be affraid to extract single line of code into a separate method. The descriptive method name works as a comment so you don' need in-line comments then.

When your coleague asks you: "So you just refactored the code to make 10 lines out of original 5 lines?"

What will you answer? You should answer "Yes. Because it's more readable this way. And atomic. And reusable".

 

Comments

Anonymous
What the f* is separate method?

Download Better Coder application to your phone and get unlimited access to the collection of enterprise best practices.

Get it on Google Play

Chat

Oh, the operator is not available. Leave us your comments. We will answer all your questions as soon as possible.

Comments

Anonymous
Καλησπέρα.
Anonymous
the infinteis -3/15 so 1triition / infinet
Anonymous
e
Anonymous
<a href="https://inspirum.pl "
Anonymous
[url]https://inspirum.pl[/url]
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e