<story><title>Never edit a method, always rewrite it?</title><url>https://dave.cheney.net/2017/11/30/never-edit-a-method-always-rewrite-it</url></story><parent_chain><item><author>JulianMorrison</author><text>It has been my experience that after a substantial period of being in real use, methods embody tacit knowledge about the problem domain that isn&amp;#x27;t necessarily evident from their public interface. Because initially they didn&amp;#x27;t embody that, and it caused bugs, so people edited in fixes.&lt;p&gt;It has been my experience that rewrites from scratch typically lose all this tacit knowledge and re-implement the original bugs.</text></item></parent_chain><comment><author>DavidWoof</author><text>That&amp;#x27;s sort of the point of the suggestion, I think.  If you &lt;i&gt;always&lt;/i&gt; rewrite from scratch rather than edit, this sort of tacit knowledge won&amp;#x27;t get embedded undocumented and untested into the middle of a function.&lt;p&gt;This is sort of the great contradiction of software development.  Untested legacy software is hard to work with.  So should our focus be on how to work with legacy software or how not to create it in the first place?  There&amp;#x27;s really no answer to that.</text></comment>
<story><title>Never edit a method, always rewrite it?</title><url>https://dave.cheney.net/2017/11/30/never-edit-a-method-always-rewrite-it</url></story><parent_chain><item><author>JulianMorrison</author><text>It has been my experience that after a substantial period of being in real use, methods embody tacit knowledge about the problem domain that isn&amp;#x27;t necessarily evident from their public interface. Because initially they didn&amp;#x27;t embody that, and it caused bugs, so people edited in fixes.&lt;p&gt;It has been my experience that rewrites from scratch typically lose all this tacit knowledge and re-implement the original bugs.</text></item></parent_chain><comment><author>dionidium</author><text>This is the central argument in this famous piece by Joel Spolsky:&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.joelonsoftware.com&amp;#x2F;2000&amp;#x2F;04&amp;#x2F;06&amp;#x2F;things-you-should-never-do-part-i&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.joelonsoftware.com&amp;#x2F;2000&amp;#x2F;04&amp;#x2F;06&amp;#x2F;things-you-should-...&lt;/a&gt;&lt;p&gt;To wit:&lt;p&gt;&amp;quot;&lt;i&gt;Back to that two page function. Yes, I know, it’s just a simple function to display a window, but it has grown little hairs and stuff on it and nobody knows why. Well, I’ll tell you why: those are bug fixes. One of them fixes that bug that Nancy had when she tried to install the thing on a computer that didn’t have Internet Explorer. Another one fixes that bug that occurs in low memory conditions. Another one fixes that bug that occurred when the file is on a floppy disk and the user yanks out the disk in the middle. That LoadLibrary call is ugly but it makes the code work on old versions of Windows 95.&lt;/i&gt;&amp;quot;</text></comment>