<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>toastal</author><text>This comes up very often and is probably a big part of the distaste many people have for jQuery. You see so much copypasta $(selector) that queries the entire DOM over and over again instead of storing the intial query in a selector, querying children based on a ParentNode, etc.. This duplication is wasteful at best, and can hurt performance at worst.&lt;p&gt;But as others noted, this is usually the sign that the creator is either green, or puts little focus in furthering their programming because they normally do other things--not malice or carelessness.</text><parent_chain><item><author>captainmuon</author><text>So much this. I&amp;#x27;ve encountered many codebases (in science and in tech) where the coder did not even use basic abstractions. In one case there was a lot of&lt;p&gt;&lt;pre&gt;&lt;code&gt;    plot(&amp;#x27;graph1&amp;#x27;)
    plot(&amp;#x27;graph2&amp;#x27;)
    ....
    plot(&amp;#x27;graph100&amp;#x27;)
&lt;/code&gt;&lt;/pre&gt;
because somebody didn&amp;#x27;t know how to create strings at runtime in C++. Another codebase did complex vector calculations in components, I was able to reduce a 500 lines function to 50 lines (including comments, and with bugs fixed).&lt;p&gt;I can sympathize with this a bit, I started programming with BASIC - you could not return structs, you could not use indirect variables (no pointers&amp;#x2F;references)... but at least you had the FOR loop :-P&lt;p&gt;People get often called out for over abstracting (rightly so), but I&amp;#x27;ve rarely seen somebody critisized for copypasta or for overly stupid code. Probably because we&amp;#x27;re too accidentially afraid to imply somebody can&amp;#x27;t code.</text></item><item><author>Pxtl</author><text>Every Line Of Business codebase I&amp;#x27;ve worked on has been the worst &amp;quot;there I fixed it&amp;quot; copypasta spaghetti, and has never made it to the point where &amp;quot;maybe we shouldn&amp;#x27;t add a parameter to this existing, cleanly abstracted method to handle this new similar-but-distinct use-case&amp;quot; was anywhere near my radar for abstraction.&lt;p&gt;I would &lt;i&gt;love&lt;/i&gt; to have developers where my problem was &amp;quot;maybe you piggybacked on existing code &lt;i&gt;too much&lt;/i&gt;, in this case you should&amp;#x27;ve split out your own function&amp;quot;.</text></item></parent_chain></comment><story><title>The Wrong Abstraction (2016)</title><url>https://www.sandimetz.com/blog/2016/1/20/the-wrong-abstraction</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>alephnil</author><text>Code like you describe is of often the result when a program is written by someone that does not have programming as their main profession. I have seen code like you describe in code written by scientists (in other disciplines than computer science).&lt;p&gt;They may have very deep knowledge in their field, and have written a program so solve some problem they have, but are unfortunately not very good programmers. This often results in quite naive code that still try to solve an advanced problem.&lt;p&gt;In code written by professional programmers, I have seen the pattern described in the article far more often than the naive style you describe. After all, programmers are trained to avoid duplication and finding abstractions, and will often add one abstraction too much rather than one too little.</text><parent_chain><item><author>captainmuon</author><text>So much this. I&amp;#x27;ve encountered many codebases (in science and in tech) where the coder did not even use basic abstractions. In one case there was a lot of&lt;p&gt;&lt;pre&gt;&lt;code&gt;    plot(&amp;#x27;graph1&amp;#x27;)
    plot(&amp;#x27;graph2&amp;#x27;)
    ....
    plot(&amp;#x27;graph100&amp;#x27;)
&lt;/code&gt;&lt;/pre&gt;
because somebody didn&amp;#x27;t know how to create strings at runtime in C++. Another codebase did complex vector calculations in components, I was able to reduce a 500 lines function to 50 lines (including comments, and with bugs fixed).&lt;p&gt;I can sympathize with this a bit, I started programming with BASIC - you could not return structs, you could not use indirect variables (no pointers&amp;#x2F;references)... but at least you had the FOR loop :-P&lt;p&gt;People get often called out for over abstracting (rightly so), but I&amp;#x27;ve rarely seen somebody critisized for copypasta or for overly stupid code. Probably because we&amp;#x27;re too accidentially afraid to imply somebody can&amp;#x27;t code.</text></item><item><author>Pxtl</author><text>Every Line Of Business codebase I&amp;#x27;ve worked on has been the worst &amp;quot;there I fixed it&amp;quot; copypasta spaghetti, and has never made it to the point where &amp;quot;maybe we shouldn&amp;#x27;t add a parameter to this existing, cleanly abstracted method to handle this new similar-but-distinct use-case&amp;quot; was anywhere near my radar for abstraction.&lt;p&gt;I would &lt;i&gt;love&lt;/i&gt; to have developers where my problem was &amp;quot;maybe you piggybacked on existing code &lt;i&gt;too much&lt;/i&gt;, in this case you should&amp;#x27;ve split out your own function&amp;quot;.</text></item></parent_chain></comment><story><title>The Wrong Abstraction (2016)</title><url>https://www.sandimetz.com/blog/2016/1/20/the-wrong-abstraction</url></story>