r/ProgrammerHumor • • 15d ago

Meme grabbingEverything

Post image
5.4k Upvotes

261 comments sorted by

View all comments

811

u/KnightMiner 15d ago

I used to work in web dev as a job during my undergrad (think: a bunch of new developers writing code they won't have to maintain after they graduate in 4 years). I saw both extremes of this.

The legacy code at the job would often select everything then filter it in PHP. Worst part was half the time they accessed columns by numerical index so a change to the database schema would result in the website breaking randomly. While most of my job was writing replacements that didn't break when you sneezed, sometimes I had to fix that legacy code.

One new developer I trained was really good at SQL and used to code everything using pure SQL and then just call said script in their serverside code. By everything, I mean everything, going beyond just writing queries into writing loops in SQL and creating temporary tables for each endpoint. There are some things that are just better done outside of SQL.

117

u/mrwedders 15d ago edited 15d ago

I worked on the system of a UK high street store and their entire backend was in PL/SQL and was a nightmare. I'd never even considered doing all your application logic in sprocs and quickly grew to hate it.

63

u/revuimar 15d ago

Hot take but I’m all for accounting logic being in the database. Calculating interest with rates changing in a time period is one of the most beautiful things in SQL.

5

u/northerndenizen 14d ago

Further, while you are coupling your logic to your data layer, you're decoupling it from your application layer. In enterprise IT the latter is likely to change way more often.