by jongjong · 3y ago · 0 comments
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.
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.
Anyway, these days I know to shut my mouth and cash my cheques... Software development work pays by the hour after all.
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.
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.
What a stupid question.
I think where the comparison fails is that science is far more tolerant of alternative theories than coding is. Coding is almost a mono-culture. The choice of tools and acceptable approaches is really very limited and there isn't much tolerance for alternatives; this is especially problematic given the fact that none of these tools and techniques are backed by math. Coding tools and techniques are backed entirely by subjective opinions concerning productivity across a highly inconsistent range of environments and these opinions are riddled with biases and conflicting business interests.
Programming ideology is built on flaky foundations (vague, inconsistent and biased beliefs about efficiency and maintainability) and yet there is intolerance towards alternatives. This is at odds with science which is generally built on far stronger foundations supported by mathematics and yet is more tolerant of alternative theories.
For context, first you said: "Or 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."
This is pretty clearly an appeal to authority fallacy. It directly implies that calling a currently-popular programming technique or tool an anti-pattern is evidence of a lack of understanding (not taking the time to learn them). It's not assessing whether there is good evidence or arguments about the value of said tools and techniques, and asserts that the techniques are (at least very likely) good because "extremely smart" people said so.
Then, I asked: "But, why do the trends keep changing, then? Why don't these smart people just get it right once and for all?"
Your rebuttal, to my honest reading, is that hard science theories also change over time and those theories are also constructed by "extremely smart" people; therefore my incredulity over software engineering trend-setters should be no higher than my incredulity over basic science theories.
Your argument fails for multiple reasons.
First and foremost, scientific theories only change in the presence of empirical or logical (by which I mean hard or formal logic, not "logic" like we use when arguing politics at Thanksgiving) evidence. Software engineering is not science (and real computer science has nothing to say about programming practices out in the real world), and has almost no means by which it can test any hypothesis with the same rigor as the basic sciences. At BEST, you can do surveys and case studies of software defects in some very fuzzy, statistical, sense, which would put it much closer to the social sciences like psychology, than hard sciences like physics. But, even those kinds of studies are exceedingly rare. The VAST majority of the time, someone just makes a good sounding argument for or against a technique and we either buy it or we don't.
You're fooling yourself if you think there's any comparison between real science and software engineering.
Next, you're actually somewhat making my point for me. If even basic scientific theories evolve over time, then why would you be so confident that the "extremely smart" people who push for certain programming techniques are right about them, and that the skeptics among us just don't understand them? Surely you're admitting that the "extremely smart" people are wrong sometimes. Now, to prove a physics theory wrong requires a LOT of work, data, peer review, etc. Since these smart programming trend-setters did none of that for their preferred technique in the first place, it really won't take nearly the same effort to "prove" them wrong--they are in a MUCH shakier position than a scientific theory.
So, yeah, I stand by my claim that the programming trend-setters are mostly just cult leaders. They have no objective foundation on which to build their ideas, unlike science, so it's much more reasonable to question them than to question a currently-accepted scientific theory.
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...
It's like giving Novak Djokovic a hammer instead of a racket and still expecting him to win tennis tournaments.
I bet he invests a lot of thought and effort into selecting his racket, his shoes, his clothes, his food, his coach, his sponsors, his medications, his strategies... Without the ability to choose his tools and techniques, he would be nothing.
... And yet that's exactly what we expect from developers.
The world is awash in half baked tools that are extremely popular until people somehow collectively realize it's a waste of time.
The frenzied mania of mobs shifting from framework to framework every 6 months is like the world of top40 radio brought to programming; relentlessly promoted crap that just disappears silently to be replaced by more irritating crap with a different version of the same problems because there's always a new generation of teenaged programmers who think they've fixed everything.
The people who follow and fall for it are part of the trainwreck programmers I'm talking about.
Really I want to stop the burnout and churn of the industry. I strongly believe the decrease in quality is because senior people tend to exit. We're 45 years into the microcomputer revolution and 65 or so years into career programming yet whenever I go to a startup, conference or meetup, the "in industry < 5 years" outnumber the old by a significant margin (except for sysadmin stuff).
It's an intrinsic cultural disposition that reinforces itself and we're going to continue to be stuck in this interregnum until we can somehow unmoor ourselves, collectively, from it.
I think a cessation of tool fetishizing and substitution with tool skepticism will help.
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.
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
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.
You could write your website in handcrafted assembly and it would work, but it would still be really stupid.
I learned this strategy from HN/IH commenters on many, many posts asking about which tools are ideal for various tasks.
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.
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?
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).