The code should be read sequentially from beginning to end as a good prose, for code it means grouping logic from main high-level concepts to particular low-level details. In the rest, we simply follow S.O.L.I.D principals.
Length limits (inspired by NASA C Style guide):
function body
<= 60 loc (to be suitable for single screen)source file
<= 600 loc