Compose your code of simple sentences, one per line, so that your code reads almost like a cooking recipe:

return mixInCup(boil(water), grind(coffeeBeans), sieve.strain(lemon.squeeze()));

var hotWater = boil(water);
var coffeeGrounds = grind(coffeeBeans);
var lemonJuice = lemon.squeeze();
var clearLemonJuice = sieve.strain(lemonJuice);
return mixInCup(hotWater, coffeeGrounds, lemonJuice);

It's worth doing even in simplest cases like beta.extractBla(, because we are used to read from left to right and from top to bottom, so it's better to say that first alfa.builds(foo) and then beta.extractsBla().

An ideal line of code should look like a simplest english sentence with three components: subject, predicate (verb) and object. The subject is the "who" or "what" of the sentence, the predicate is the verb, and the object is any noun or concept that is part of the action of the subject: subject.verb(object).

W. Gdela

            Votes: 0

See more like this: