samedi 28 février 2015

Bad sign if nobody can comprehend one's code?


If a coder writes code that nobody other than he can understand, and code reviews always end with the reviewer scratching his head or holding their head in their hands, is this a clear sign that the coder is simply not cut-out for professional programming? Would this be enough to warrant a career change? How important is comprehensible code in this industry?


Consider these C examples, compare:



if (b)
return 42;
else
return 7;


versus:



return (b * 42) | (~(b - 1) * 7);


Is there ever an excuse to employ the latter example? if so, when and why?





Aucun commentaire:

Enregistrer un commentaire