DEV Community

Discussion on: How to Produce Readable Code

Collapse
 
metalrain profile image
Otto Martikainen

I agree about use of English and naming things clearly, but having function that gets all posts just to filter one by author and modify it's title seems quite inefficient.

Also in last example variable posts is not actually defined and example before that posts is a function so posts.filter is also undefined.

I'm trying to say that details do matter in code.

Collapse
 
jaffparker profile image
Jaff Parker

Oops, thanks for pointing that out, I fixed it :) I'm used to the editor showing me wrong references.

This example isn't real and was just written for demonstration of all principles mentioned. If it were a post about efficient code, I definitely wouldn't have done that 😃