loading...

re: How to write readable code? VIEW POST

FULL DISCUSSION
 

There's a weird thing in readability that you learn to quickly read the form that you use/read most. This means that if you have multiple repositories full of another format then your "ideal" format will be more difficult. Standardize your code format for the team.

If ternaries aren't used elsewhere then it can take longer to remember how to read it than just having the if/else.

Things like right side open VS left side open can be acceptable either way if you are accustomed to it.

 

Be consistent! Yes, but this cannot be an argument for bad code style.

e.g.:

bad:

.example_1,.example_2{background: url(images/example.png) center center no-repeat, url(images/example-2.png) top left repeat, url(images/example-3.png) top right no-repeat;}

not that bad:

.example_1, 
.example_2 {     
 background: url(images/example.png) center center no-repeat,                            
             url(images/example-2.png) top left repeat,                            
             url(images/example-3.png) top right no-repeat;
}

-> dev.to/suckup_de/do-not-fear-the-w...

code of conduct - report abuse