2 ms·
This fits quite well in the large advice (expressed e.g. by Martin Fowler) that a function should not contain deeply nested if/then/else constructs, but a flat
by vog 11y ago
This fits quite well in the large advice (expressed e.g. by Martin Fowler) that a function should not contain deeply nested if/then/else constructs, but a flat series of "if" statements each finishing with a "return" statement. And if this is impossible, break the function into smaller functions such that each of them is composed like that.
This advice is especially helpful when coding complex conditionals in business logic. (but small enough so you don't need/want a generic rules engine and rules DSL for that.)