<story><title>“Clean Code, Horrible Performance” Discussion</title><url>https://github.com/unclebob/cmuratori-discussion/blob/main/cleancodeqa.md</url></story><parent_chain><item><author>robalni</author><text>I used to like to rewrite code that I thought was &amp;quot;ugly&amp;quot; because it was not written in the modern way or it was not very generic or whatever.
I thought that doing that was often pretty easy so I thought &amp;quot;why has no one done this already?&amp;quot;&lt;p&gt;Later I realized that the fact that it was easy to change was what made it good and the changes I wanted to make to it would probably just make it more complicated.&lt;p&gt;That&amp;#x27;s the danger; good code is easy to change so it will easily get rewritten until it&amp;#x27;s not easy to change anymore.</text></item><item><author>pkolaczk</author><text>It is debatable if Clean Code actually improves the programmer efficiency and programs readability. I find people applying it religiously often create over-complex designs like FizzBuzz Enterprise.&lt;p&gt;Even Uncle Bob&amp;#x27;s examples are not the state of the art in readability:
&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;qntm.org&amp;#x2F;clean&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;qntm.org&amp;#x2F;clean&lt;/a&gt;&lt;p&gt;The main problem seems to be that Clean Code is mostly a premature optimisation in code flexibility. It makes code more complex and objectively worse in hope it would be easier to extend later. Unfortunately we often dont know how the code will change, and in practice the code has to be significantly changed&amp;#x2F;rewritten anyway when a business requirement change appears.&lt;p&gt;IMHO optimizing for simplicity and readability has served me the best. Instead of avoiding the changes in code, it is better to write code so obvious that anyone can safely and easily change it when really needed.&lt;p&gt;And finally, performance of the program vs performance of the developer is a false dichotomy. So many times I&amp;#x27;ve seen a more readable, simpler code turned out to be more efficient as well. You often can have both.</text></item></parent_chain><comment><author>edflsafoiewq</author><text>&amp;gt; Software has a Peter Principle. If a piece of code is comprehensible, someone will extend it, so they can apply it to their own problem. If it’s incomprehensible, they’ll write their own code instead. Code tends to be extended to its level of incomprehensibility.&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;nigeltao.github.io&amp;#x2F;blog&amp;#x2F;2021&amp;#x2F;json-with-commas-comments.html&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;nigeltao.github.io&amp;#x2F;blog&amp;#x2F;2021&amp;#x2F;json-with-commas-commen...&lt;/a&gt;</text></comment>
<story><title>“Clean Code, Horrible Performance” Discussion</title><url>https://github.com/unclebob/cmuratori-discussion/blob/main/cleancodeqa.md</url></story><parent_chain><item><author>robalni</author><text>I used to like to rewrite code that I thought was &amp;quot;ugly&amp;quot; because it was not written in the modern way or it was not very generic or whatever.
I thought that doing that was often pretty easy so I thought &amp;quot;why has no one done this already?&amp;quot;&lt;p&gt;Later I realized that the fact that it was easy to change was what made it good and the changes I wanted to make to it would probably just make it more complicated.&lt;p&gt;That&amp;#x27;s the danger; good code is easy to change so it will easily get rewritten until it&amp;#x27;s not easy to change anymore.</text></item><item><author>pkolaczk</author><text>It is debatable if Clean Code actually improves the programmer efficiency and programs readability. I find people applying it religiously often create over-complex designs like FizzBuzz Enterprise.&lt;p&gt;Even Uncle Bob&amp;#x27;s examples are not the state of the art in readability:
&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;qntm.org&amp;#x2F;clean&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;qntm.org&amp;#x2F;clean&lt;/a&gt;&lt;p&gt;The main problem seems to be that Clean Code is mostly a premature optimisation in code flexibility. It makes code more complex and objectively worse in hope it would be easier to extend later. Unfortunately we often dont know how the code will change, and in practice the code has to be significantly changed&amp;#x2F;rewritten anyway when a business requirement change appears.&lt;p&gt;IMHO optimizing for simplicity and readability has served me the best. Instead of avoiding the changes in code, it is better to write code so obvious that anyone can safely and easily change it when really needed.&lt;p&gt;And finally, performance of the program vs performance of the developer is a false dichotomy. So many times I&amp;#x27;ve seen a more readable, simpler code turned out to be more efficient as well. You often can have both.</text></item></parent_chain><comment><author>simplotek</author><text>&amp;gt; (...) because it was not written in the modern way or it was not very generic or whatever.&lt;p&gt;Premature generalization is a well known problem and a never-ending source of complexity. I lost count of the times I had to push back on PRs of clueless developers who felt the need to generalize one-liners that pop up twice in the whole project, and for that their proposal was to add a strategy pattern, ultimate replacing two expressions with three classes.</text></comment>