Well, the compiled code (if there is such a thing) would be the same, but the denseness does differ a bit. Though whether the default value should be hardcoded, injected or looked up, that’s of course a different matter and will probably depend on business considerations (e.g. sometimes the default is, and can only be, a blank string, regardless of context).
I’m mostly referring to the fact that it’s a single versus two separate statement/expressions, with the corrolary that the latter allows a line of whitespace inbetween to emphasize them being separate concerns. Moving the second part of the A || B to the next line aids the separation a bit, most people tend to not do that unless the total statement/line is too long to fit.
Well, the compiled code (if there is such a thing) would be the same, but the denseness does differ a bit. Though whether the default value should be hardcoded, injected or looked up, that’s of course a different matter and will probably depend on business considerations (e.g. sometimes the default is, and can only be, a blank string, regardless of context).
Sure. The example is a bit contrived. There would definitely be more error handling logic, as you've mentioned.
Help me understand what you mean by "denseness". From my pov, things look basically the same if you ignore the coding style.
vs
I’m mostly referring to the fact that it’s a single versus two separate statement/expressions, with the corrolary that the latter allows a line of whitespace inbetween to emphasize them being separate concerns. Moving the second part of the A || B to the next line aids the separation a bit, most people tend to not do that unless the total statement/line is too long to fit.
Edit: thanks for the interesting discussion btw
Ah...ok. Understood. I agree.
edit: Absolutely. That's what this is all about. Thanks for the feedback.