If you need more than 3 levels of indentation, you're screwed?
Posted
by
jokoon
on Programmers
See other posts from Programmers
or by jokoon
Published on 2011-02-27T17:46:58Z
Indexed on
2012/12/18
5:13 UTC
Read the original article
Hit count: 162
Per the Linux kernel coding style document:
The answer to that is that if you need more than 3 levels of indentation, you're screwed anyway, and should fix your program.
What can I deduce from this quote? On top of the fact that too long methods are hard to maintain, are they hard or impossible to optimize for the compiler?
I don't really understand if this quote encourages better coding practice or is really a mathematical / algorithmic sort of truth.
I also read in some C++ optimizing guide that "dividing up a program into more functions improves its design" is frequently taught in CS courses, but it should be not done too much, since it can turn into a lot of JMP calls (even if the compiler can inline some methods by itself).
© Programmers or respective owner