tdm-calculator icon indicating copy to clipboard operation
tdm-calculator copied to clipboard

Refactor: Conditional Logic into variable names

Open jackrinjames opened this issue 4 years ago • 3 comments
trafficstars

Overview

We need to move long conditional logic into variables with meaningful names so that they're less confusing.

Action Items

  • [ ] identify locations of conditional logic

Resources/Instructions

jackrinjames avatar Sep 18 '21 18:09 jackrinjames

Ask Claire if this is CSS, HTML, Javascript, or other

ExperimentsInHonesty avatar Sep 18 '21 19:09 ExperimentsInHonesty

I think this is general code readability.

For expressions like (rules && rules.length !== 0), it should be replaced by a named variable called something like rulesLoaded. This is especially true if the exact condition is repeated several times in the code. The stopping point for this kind of refactoring is not very clear. Maybe until the dev is comfortable that the code is easy to understand.

fyliu avatar Sep 18 '21 23:09 fyliu

Need more clarification of the convention proposed. Is this referring to if..else statements with many else clauses, or does it apply to nested ternary expressions as well? Please be more specific in the request by including at least some examples

entrotech avatar May 13 '22 22:05 entrotech

  • #975

Biuwa avatar Jan 19 '23 04:01 Biuwa

Should be closed. The request is apparently some sort of coding convention that Claire was interested in, but did not define well enough to be actionable.

entrotech avatar Feb 04 '23 06:02 entrotech