&gt; he explicitly said, that this is lame implementation and can be optimized (for example by looping until square root of the number)<p>Was this the same video where he chastised programmers who mentioned the Sieve of Eratosthenes? Without actually explaining why that was the wrong solution?<p>&gt; while benchmarks are tests for performance<p>Certainly benchmarks are useful tests. But so are edge conditions. Consider &quot;average(i, j)&quot;. The simple solution is (i+j)&#x2F;2, but if i+j overflows then the answer will be wrong. If max signed&#x2F;unsigned int is allowed as an input value, or an overflow might happen in an intermediate value, then those should surely be part of the tests which drive the code. Without it, it&#x27;s all too easy to have a silent integer overflow.<p>Going back to the primes code, 2^31-1 <i>might</i> be seen as a performance test. Or if the code was written well in the first place, it might just be a simple bounds check.<p>For that matter, if &#x27;well-written unit tests ... provide a working specification of your functional code&#x27;, then where&#x27;s the documentation which defines the expected or at least preferred input range? Or the step to point out that the input spec is under-defined and needs clarification?<p>&gt; So maybe, Martin Fowler, when coining this term, meant something different?<p>Funny thing that. If you look around, you&#x27;ll see that most people quote his example almost verbatim. In general they like to replace user code with system code. This makes me think that most people either think it&#x27;s trivially obvious, or haven&#x27;t really thought about it. (I think few people really do algorithm development, so neither one would surprise me.)<p>In &quot;Refactoring: Improving the Design of Existing Code&quot; p. 139, at <a href="https:&#x2F;&#x2F;books.google.com&#x2F;books?id=HmrDHwgkbPsC&amp;pg=PA139&amp;lpg=PA139&amp;dq=%22Substitute+Algorithm%22&amp;source=bl&amp;ots=y57hwpM6_X&amp;sig=gx3IPpj74SWg4F6xjSf3VnKLxBE&amp;hl=sv&amp;sa=X&amp;ved=0ahUKEwiExJrKwOTKAhWBwHIKHR4OCM44ChDoAQgeMAE#v=onepage&amp;q=%22Substitute%20Algorithm%22&amp;f=false" rel="nofollow">https:&#x2F;&#x2F;books.google.com&#x2F;books?id=HmrDHwgkbPsC&amp;pg=PA139&amp;lpg=...</a> , you&#x27;ll that Fowler says to apply &quot;Substitute Algorithm&quot; only if the newer algorithm is clearer. He also says that if it compiles and passes all of the existing tests, then your done.<p>My complaint is that even a clearer algorithm can have different edge cases, so you have to analyze the code and perhaps add new tests before you are done.<p>&gt; is actually a smell to my knowledge<p>My statement was based on reviewing Martin&#x27;s FitNesse code some six years ago. I can no longer recall if my memory is accurate, and withdraw my comment.<p>&gt; from one year to another, someone always coins &quot;Unit tests are dead, long live Integration tests&quot;; another year and someone says: &quot;Integration tests are dead, long live Unit tests&quot;. It flips over and over again.<p>Coplien doesn&#x27;t say that. While he believes that most unit tests are a waste, he encourages unit tests for &quot;key algorithms for which there is a broad, formal, independent oracle of correctness, and for which there is ascribable business value&quot;. Sorting definitely falls into that category.<p>He also points out that maintaining unit tests which are also covered by your functional tests is a waste of maintenance time, and says to get rid of those unit tests.<p>I&#x27;ve always found it hard to work in an airplane, and don&#x27;t travel anywhere often enough to need to worry about it. :)<p>Thanks also for your compliment. Best of wishes.