3 ms·
Personally I think the most valuable concept is simply naming the internal parts of a larger block of logic. The article does that in the last step, but doesn’t
by dahart 2y ago
Personally I think the most valuable concept is simply naming the internal parts of a larger block of logic. The article does that in the last step, but doesn’t name it in the summary. :P Doing the naming at any step with temporary variables or functions usually makes it cleaner and clearer.
- exceptione 2y agoExactly. Naming the constituting parts also makes it clear if there is a bug. Example. Is there something wrong in the following statement? You don´t know, because it does not specify what the intended meaning of the statement is. if (foo.a <= 3 && bar || bar > 34 && ( ...etc )) Take away: break up the parts of you logical condition, give them a name, reassemble the condition from the logically named parts. A a rule of thumb, a condition that reads like a regular sentence is a clear condition.