in reply to Re^2: RFC: App::SFDC
in thread RFC: App::SFDC
It is basically a stylistic choice, but I think it improves the readability of the code a lot. At least to me. I picked this code example because at first glance I simply saw 'stuff', then while looking at it there were 'revelation'-like experiences. Oh! It's a function call! Oh! It's using a ternary operator to build a conditional argument set. Oh! The conditional is just there to help debugging.
I rewrote the code to make these 3 different aspects more visible and make it easier to mentally skip parts that are probably not relevant to spotting bugs, e.g. the debug conditional.
Generally I try to format the code in a way that minimizes the mental effort and the time required to recognize the building blocks. Hopefully this helps to reduce the 'TL;DR'-effect when reading / scanning over it and helps to spot possible bugs more easily. That's also the reason why I try to avoid the ternary operator in complicated statements. Sure it's convenient, but '?' is a lot less visibly distinct then 'if ('. In your case I was even able to drop the 'else' branch, because it didn't have any purpose besides satisfying the syntax.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: RFC: App::SFDC
by Nemo Clericus (Beadle) on Jul 15, 2015 at 16:18 UTC |