7 ms·
I always hated ORM and saw it as an anti-pattern since I first used it many years ago for these exact reasons. I remember back then, devs would look down on me
by jongjong 3y ago
I always hated ORM and saw it as an anti-pattern since I first used it many years ago for these exact reasons.
I remember back then, devs would look down on me for voicing my critiques about it.
There are many tools and techniques which I am forced to use today as a dev which are also anti-patterns.
The unfortunate reality of our industry is that most of the popular tools which software devs are using suck and are encouraging anti-patterns. The thing about the tech industry is that there are a small number of well-connected developers and ex-developers who call all the shots in this industry and they suck.
- wernercd 3y ago> anti-patterns if it works and it's stupid... it's not stupid. If companies around the world can get stuff done with "anti-patterns" then, by definition, they don't "suck". I'm all for doing better and trying to improve my "craft" but I'm not going to look down on decisions that work.
- msla 3y agoLeaded gasoline worked but it was so stupid it actively made people stupid.
- jkaplowitz 3y agoI think you’ve just identified leaded gasoline as the next greatest AI-powered cloud native blockchain technology.
- throwanem 3y agoYou can drive a nail with a brick if you try hard enough. Does that make it not stupid to go looking for a brick while there's a hammer right there in your toolbag?
- AlchemistCamp 3y agoA screwdriver is the tool I know best and therefore it’s the most productive thing for me to use to nail things together with in my upcoming project. I learned this strategy from HN/IH commenters on many, many posts asking about which tools are ideal for various tasks.
- ivan_gammel 3y agoI would entertain myself looking how someone uses a screwdriver with a nail. Novel engineering approaches are never late to study.
- scns 3y agoI prefer a screwdriver to my bare hands when i need to drive a nail but no hammer at hand. Speaking about real tools and not metaphorically though.
- HowTheStoryEnds 3y agoYou obviously use 2 precisely configured screwdrivers, so one screwdriver can hit the other when the nail requests it, like a multilevel cache.
- bawolff 3y agoFor a technology to not work at all it has to be really really shitty. Anti-patrern means pattern that is bad. If the tech didn't work at all it wouldn't be a pattern at all. You could write your website in handcrafted assembly and it would work, but it would still be really stupid.
- irrational 3y agoMore like, they want to use cheaper labor who don’t know SQL so they give them baby tools like ORM. Follow the money.
- quickthrower2 3y agoAlso there was a time it would be good to have Entity Framework or Hibernate on your CV. Another follow the money.
- quickthrower2 3y agoGetting stuff done is by far not the only concern. Maintenance cost is definitely a problem to consider.
- seanhunter 3y agoNope. If it works and it's stupid, it's still stupid. Just because companies can get stuff done in dumb ways doesn't mean those ways aren't dumb, it means that by brute force, sunk cost and obstinacy they can make things happen. There are any number of technical and non-technical dumb things in any large organization. You definitely can't assume something isn't dumb just because a company does it. Noone is looking down on ORMs because they work, people are looking down on them because they don't work well enough to justify their downsides in most use cases. That's why people call it an anti-pattern. Yes you can get it to work but in general it's going to make things worse not better. Now are some things that people call "anti-patterns" actually the right thing in certain circumstances? Absolutely. Just because something sucks in one situation doesn't mean it isn't the right choice in another.
- wernercd 3y ago> Nope. If it works and it's stupid, it's still stupid. Successful businesses with successful and profitable products say otherwise. The fact that stuff gets done means that it's not dumb, at a base level. You may not like it - and a lot of people don't because it removes the need for overengineered, oversmart and other "solutions" when sometimes the best solutions is literally the "stupid" solution. > Noone is looking down on ORMs because they work, people are looking down on them because they don't work well enough to justify their downsides in most use cases. A decade of experience in a few companies I've worked at and every company I interview with says otherwise. EF is top notch and removes a large swath of "boilerplate" code and works more than well enough. I've had much better experiences with something like EF than I have with stored procedures and triggers and other "better" solutions. > Now are some things that people call "anti-patterns" actually the right thing in certain circumstances? Absolutely. See? you even admit that "anti-patterns" are the right patterns "in certain circumstances". The only thing you disagree with is how common those circumstances are and for the vast majority of circumstances? ORMs are a lot better than "custom" layers underneath. Nothing worse than creating a custom way of doing something that's already done. Inserting your own bugs. etc. Smart programmers don't solve problems that are already solved. I wouldn't create a PDF parser from scratch (outside of learning excercises). I wouldn't create a Word Document parser. XML parser. etc... Why would I create a data layer management package when I have better things to do with my time that actually adds value to a company?
- MrDresden 3y agoI guess you have never had to come in and solve a bad situation that has arisen specifically due to the bad short term decisions someone made in the past. Not all tech debt is bad, as long as it is recognized when being created and gets accounted for in near future planning. That way it is a deliberate decision taken, after weighing pros and cons, knowing it will need to be dealt with at some point. The worst of these is when those making the decisions don't know as much as they think they do, forgo weighing pros and cons, and paint them selves into a corner by accident. Those kinds of situations can literally kill a company (and have).
- watwut 3y agoBeing old enough to experience how it worked before ORM, ORM is godsend. Maintenance just used to sux, massively, comparatively.
- kristopolous 3y agoCompetency is a function of the human and not the tools. People who create piles of garbage will do so regardless of what you give them. Let's not pretend ORM made poor behavior more manageable. It was just a different style mess to clean up. You give them TDD, they'll create bad broken tests. You give them linters, they'll put in arcane and asinine rules. You give them git and they'll have branching that looks like the Hapsburg family tree with commit comments like "fix". You aren't going to fix behavior with tools. It takes time, discipline, probably a bunch of therapy...
- salawat 3y ago>You aren't going to fix behavior with tools. It takes time, discipline, probably a bunch of therapy... I just wanted to say, this, right here, is one of the single most powerful, yet often hardest won realizations that an individual can come to. Giving a fool the materials and means to build a house, then letting them do as thou wilt, does not a recipe for a safe structure make. Or for a more poignant, recent example that should resonate. A deep sea submersible.
- moring 3y agoThis argument has been presented forever to excuse bad tools, and it is a strawman. Of course good tools don't fix bad behavior. The argument in favor of good tools is that competent people with good tools are insanely more productive than competent people with bad tools.
- kristopolous 3y agoBut what does that mean? Consistent, predictable tools that can be specified generally and generally specified. For instance, gdb enacts and gnuplot
- Idiot_in_Vain 3y agoOr maybe you haven't taken the time to learn those tools and techniques and this is why you think they are anti-patterns. The people who set the trends in the development industry are extremely smart. Take for example ORMs - people already know SQL and are often too lazy or un-motivated to learn their ORM of choice in depth. So for them the ORM is confusing and SQl just works. But an ORM eliminates a ton of code that needs to be written and maintained. Boilerplate code to read a row from DB than map it to an object or a map. Boilerplate code to do DB inserts and updates. Optionally boileplate code to track changes. Any decent ORM allows one to bypass it's mechanisms and in the edge cases write SQL directly. It's essentially the same argument people used countless times in the past - e.g. why learn a higher level language, if they never work and I can do anything in C.
- jongjong 3y agoThat's usually a good comeback since people who don't like something tend to avoid using the thing but because of the way the tech industry works, it's not possible to avoid the tools so I actually became an expert at them even though I hate them. I use some of these tools daily and have been using them for years to the point that I'm basically an expert at them. They suck. They're over-engineered (introduce more problems than they solve), have too many dependencies, slow down development speed, etc... Anyway, these days I know to shut my mouth and cash my cheques... Software development work pays by the hour after all.
- Idiot_in_Vain 3y agoOf course everyone is free to have their own opinion, but for good reasons the opinions of the people who create new ORMs, frameworks, languages, OSs, lead big complex projects at big corp are generally valued more that the opinions of those who see dev work as nothing more than a way to make a buck. And yes ORMs and other tools used in software industry often look over engineered if one doesn't want to understand in depth the problems they are solving, but wants to quickly solve a business problem.
- ragnese 3y ago> The people who set the trends in the development industry are extremely smart. Sure. But, why do the trends keep changing, then? Why don't these smart people just get it right once and for all? It's because, frankly, the people who set the trends are often wrong. E.g., Java-style OOP with deep single-inheritance chains is not even considered good style IN JAVA anymore. They're just celebrities, and we're (as a group) just as susceptible to group-think and cargo-culting as people who try every fad diet because some celebrity did it.
- omniglottal 3y agoIn fact, there are many smart people, and relatively few of them have their manager's ear, while management also listens equally to a bunch more not-smart people pointing to the popular smart people, saying "these people are smart", ignoring the merit of the position of other smart dissenters. In short, it's all a big train of reasoning based almost entirely on the "appeal to authority" fallacy.
- ragnese 3y agoThank you for saying this. I don't consider myself some kind of 10x dev. Hell, most days I feel like a 0.1x dev. But, sometimes I can't help but feel like "everyone else" is doing it wrong. The cargo cult has been wrong many times in the past, yet if you go against today's cargo cult, they act like you're insane. Do we not learn our lessons? Or at least accept that maybe today's "best practices" won't always be considered as such? Let's keep in mind that if any of us had said anything about OOP being overrated in the 90s and 00s, we'd have been laughed out of the room. It was "obvious" that OOP was the best way to write reliable, maintainable, projects. Now, it's almost the opposite: it's super cool to write a blog post shitting on OOP (while almost never actually defining it...). Likewise, it was "obvious" that statically typed programming languages were just tedious and getting in our way, so let's write everything in Python, Perl, and JavaScript. Except that now, most people seem to be in the opposite camp: it's all about Rust, Swift, TypeScript, etc. I hate ORMs. Every single one I've tried feels like a bad abstraction and doesn't really do what I want. For added, unrelated, controversy, I think Java's checked exceptions are a good language feature, and I absolutely don't care that the creator of C# did an interview 12 years ago declaring them bad. I'm vindicated every time I see someone praise Rust's Result type, or when I see someone write a TypeScript or Kotlin library that implements a Result/Either type. We're moving back toward statically declaring how a function may fail and trying to force the caller to deal with it. It's exactly the same as checked exceptions. I have also seen some laughably bad and inefficient code written in non-functional languages just for the sake of writing in functional style, when it does absolutely nothing to actually increase the quality of the code/project. FP will absolutely be ridiculed in ten years, the same way OOP is being ridiculed today. /rant