4 ms·
The Grep Test is interesting, but it is too extreme for me. I have this thing I call the 'No Lie Principle.' The idea is that when you look at code, the comput
by michaelfeathers 13y ago
The Grep Test is interesting, but it is too extreme for me. I have this thing I call the 'No Lie Principle.'
The idea is that when you look at code, the computations you see are the ones actually executed. Meta-programming may be used but only to add behavior to existing code, not to nullify it.
A good example is an 'execute around' method. The method you see in the code is executed, but some things may happen before it and some things may happen after it. What you can't do is replace the body with something else.
An interesting thing about the 'No Lie Principle' is that aligns with good practice around inheritance also. It's better to override abstract methods than it is to override concrete ones for a number of reasons.