Clean code has room to breath

2023-04-07 #programming / freek.dev

Timeless advice from Freek & Brent.

Just like reading text, grouping code in paragraphs can be helpful to improve its readability. We like to say we add some "breathing space" to our code.

$page = $this->pages()->where('slug', $url)->first();
if (! $page) {
throw new Exception();
}
$page = $this->pages()->where('slug', $url)->first();
 
if (! $page) {
throw new Exception();
}

Just one line of space can make the difference.