<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>icxa</author><text>The argument against ORMs aren&amp;#x27;t that they are a leaky abstraction (although they most definitely are).&lt;p&gt;The argument is although they appear to offer you value up front, they cost you much more down the road. The moment you have a hot path query that needs optimizing, you are dropping down to your ORM&amp;#x27;s &amp;quot;raw sql&amp;quot; mode. Then you do it again. Then again. Then you are ripping out the ORM and spending cycles refactoring it out of your code and replacing it with simpler abstractions.&lt;p&gt;I always find the people who don&amp;#x27;t believe writing raw SQL is preferable to using an ORM is usually down to a lack of experience or because they have been coerced to use ORMs by their &amp;quot;enterprise grade&amp;quot; language (usually your C# developers of the world, no offense to you all but if every time you look up examples of data operations it&amp;#x27;s dealing with EntityFramework you are probably going to wind up with a lot of devs using EntityFramework). The ORMers, as I call them, don&amp;#x27;t have confidence in their own SQL ability, and they haven&amp;#x27;t experienced the aforementioned situation enough times to realize you are better off starting with SQL to begin with.&lt;p&gt;The realization is, if I could summarize it: yes all abstractions are at least somewhat leaky, so you are better to use simpler ones than complex ones (and if you need something more complex, compose it from simpler ones)</text><parent_chain><item><author>ryanbrunner</author><text>I see this fact used pretty often to dismiss the idea that we should use abstractions at all, and I think that&amp;#x27;s pretty wrongheaded. As an example, it&amp;#x27;s pretty common to hear that people should prefer writing raw SQL to using an ORM or query builder because those are both &amp;quot;leaky abstractions&amp;quot;&lt;p&gt;Abstractions aren&amp;#x27;t necessarily only there so that you don&amp;#x27;t need to understand anything about what&amp;#x27;s being abstracted. They are there so that your code can get away from nitty-gritty implementation details, and be more focused on the problem domain.&lt;p&gt;What would you rather see when you&amp;#x27;re coming into a new codebase:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    const formData = new FormData();
    formData.append(&amp;#x27;name&amp;#x27;, &amp;#x27;Widget&amp;#x27;);
    fetch(`&amp;#x2F;api&amp;#x2F;widgets&amp;#x2F;${id}`, {
       method: &amp;#x27;POST&amp;#x27;,
       body: formData
    })
&lt;/code&gt;&lt;/pre&gt;
or:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    Widget.save({ name: &amp;#x27;Widget&amp;#x27; });&lt;/code&gt;&lt;/pre&gt;</text></item></parent_chain></comment><story><title>The Law of Leaky Abstractions</title><url>https://github.com/dwmkerr/hacker-laws#the-law-of-leaky-abstractions</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>XCabbage</author><text>Some abstractions are basically perfect and don&amp;#x27;t require you to understand the layer beneath them at all. Some have that as their ideal, but are imperfect, and sometimes require you to understand a few details of the layer below. But others - the best example that I know of is SCSS - &lt;i&gt;aren&amp;#x27;t even trying&lt;/i&gt; to eliminate the need to understand the layer below. Everything you need to know to write CSS, you still need to know to write SCSS, and then SCSS adds more on top. It&amp;#x27;s a convenient tool for power users and I wouldn&amp;#x27;t want to be without it, but for a beginner, using SCSS instead of CSS means you have strictly more to learn; I&amp;#x27;d suggest that a newbie on my team not touch SCSS until they&amp;#x27;ve done a few days&amp;#x27; work with raw CSS.&lt;p&gt;While less clear-cut than SCSS&amp;#x2F;CSS, it seems to me that ORMs&amp;#x2F;SQL have a similar relationship. Frankly, without knowing SQL, you can&amp;#x27;t hope to competently use an ORM; you won&amp;#x27;t know what sort of queries and updates it&amp;#x27;s capable of or what its performance characteristics will be, let alone more subtle stuff like what indexes to create or how the database&amp;#x27;s transaction model works. But even once you DO understand the SQL layer, getting to grips with how ORMs work is a major additional hurdle.&lt;p&gt;For that reason, while I am comfortable using an ORM for projects I work on, I wouldn&amp;#x27;t recommend that a beginner do the same. If I did, I&amp;#x27;d be doubling the amount they have to learn, and creating a risk that they&amp;#x27;ll give up in despair trying to figure out how something poorly-documented works at the ORM layer because they don&amp;#x27;t have the knowledge of the underlying SQL layer to intuitively guess what their ORM code must be doing under the hood.&lt;p&gt;It&amp;#x27;s perhaps more radical than anything I believe, but I think you can reasonably go further and make the case that the extra learning curve imposed by ORMs is not worth the minor convenience benefit they offer to the proficient, and that for that reason, it&amp;#x27;s generally better not to use them. The fact that they leak the entire layer underneath them is &lt;i&gt;part&lt;/i&gt; of that argument, but not all of it; the other part is that the layer they build on &lt;i&gt;top&lt;/i&gt; of that is difficult-to-learn and only adds a small bit of convenience in exchange.</text><parent_chain><item><author>ryanbrunner</author><text>I see this fact used pretty often to dismiss the idea that we should use abstractions at all, and I think that&amp;#x27;s pretty wrongheaded. As an example, it&amp;#x27;s pretty common to hear that people should prefer writing raw SQL to using an ORM or query builder because those are both &amp;quot;leaky abstractions&amp;quot;&lt;p&gt;Abstractions aren&amp;#x27;t necessarily only there so that you don&amp;#x27;t need to understand anything about what&amp;#x27;s being abstracted. They are there so that your code can get away from nitty-gritty implementation details, and be more focused on the problem domain.&lt;p&gt;What would you rather see when you&amp;#x27;re coming into a new codebase:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    const formData = new FormData();
    formData.append(&amp;#x27;name&amp;#x27;, &amp;#x27;Widget&amp;#x27;);
    fetch(`&amp;#x2F;api&amp;#x2F;widgets&amp;#x2F;${id}`, {
       method: &amp;#x27;POST&amp;#x27;,
       body: formData
    })
&lt;/code&gt;&lt;/pre&gt;
or:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    Widget.save({ name: &amp;#x27;Widget&amp;#x27; });&lt;/code&gt;&lt;/pre&gt;</text></item></parent_chain></comment><story><title>The Law of Leaky Abstractions</title><url>https://github.com/dwmkerr/hacker-laws#the-law-of-leaky-abstractions</url></story>