Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
ultrafilter
Aug 23, 2007

It's okay if you have any questions.


YanniRotten posted:

I've had PRs land on my desk from a contractor where they were doing at least some of their filtering in memory after pulling in all rows, and were doing their own aggregations (literally they did not preserve ANY individual row data for what they were doing).

It took me a lot of attempts to communicate how to make the database do this instead, I think I had to straight up send them example code.

It might be them not knowing that SQL can do that. On the other hand, if the database is storing all the intermediate results on disk, doing stuff in-memory can be much faster. I've seen a query go from three hours to eight minutes when we stopped using SQL for joins and aggregations.

Adbot
ADBOT LOVES YOU

JehovahsWetness
Dec 9, 2005

bang that shit retarded

YanniRotten posted:

I've had PRs land on my desk from a contractor where they were doing at least some of their filtering in memory after pulling in all rows, and were doing their own aggregations (literally they did not preserve ANY individual row data for what they were doing).

It took me a lot of attempts to communicate how to make the database do this instead, I think I had to straight up send them example code.

I had to fix a recent production issue that was like this, with the added bonus of it being DynamoDB results. The dev didn't know results were paginated so once the results were >1MB data just disappeared...

YanniRotten
Apr 3, 2010

We're so pretty,
oh so pretty

JehovahsWetness posted:

I had to fix a recent production issue that was like this, with the added bonus of it being DynamoDB results. The dev didn't know results were paginated so once the results were >1MB data just disappeared...

Don't the SDKs ship pagination-aware wrappers anyway? This is the double whammy of using an API that's at a lower level than you really need but also not reading the docs for it.

wilderthanmild
Jun 21, 2010

Posting shit




Grimey Drawer

Hollow Talk posted:

When you need to calculate things, just do SELECT * FROM, pull everything into python, then insert it all again after your calculation is done by iterating over all rows and inserting each one individually. Do this in pandas if you are a Data Scientist. Put SQL 5/5 on your resume.

At my very first programming job I was treated like a wizard for massively increasing the performance of this desktop app they were using. Every single database call involved pulling down the entirety of whatever table you needed. Need to get one order? Pull down the entire orders table and find order 12345. Don't forget to pull down the entire address, customer, phone number, and notes tables and pull out all of the ones you need too! Just going through and removing a bunch of .ToList() and for loops and replacing them with .Where fixed so much.

YanniRotten
Apr 3, 2010

We're so pretty,
oh so pretty

wilderthanmild posted:

At my very first programming job I was treated like a wizard for massively increasing the performance of this desktop app they were using. Every single database call involved pulling down the entirety of whatever table you needed. Need to get one order? Pull down the entire orders table and find order 12345. Don't forget to pull down the entire address, customer, phone number, and notes tables and pull out all of the ones you need too! Just going through and removing a bunch of .ToList() and for loops and replacing them with .Where fixed so much.

Those jobs where you’re a genius from just sort of being able to do things right are fun. I got an insane amount of mileage at my first job just out of having any awareness of indexes.

Oh this terrible process takes an hour how about five seconds instead with me being 100% sure nothing has been broken by the change.

I mean, you gotta get out of those places fast, smartest person wrong room etc., but it’s kind of fun building that reputation out of stuff everyone should know how to do at a good shop.

Canine Blues Arooo
Jan 7, 2008

when you think about it...i'm the first girl you ever spent the night with

Grimey Drawer
Our team maintains our own ORM and I am completely sold that it might be ideal to just build it yourself. The advantages are that you get to build it exactly how you want, adding features is very easy, and you are expected to have at least some understanding of SQL as a team which conveys some nice benefits.

Ruggan
Feb 20, 2007
WHAT THAT SMELL LIKE?!


Yeah nowadays I just use Dapper and do most of my code in either stored procedures that abstract db structure away OR bring data that we will need into memory and cache whatever makes sense (often times enums or lookup tables).

Performance is a lot better and I don’t have to wrestle with EF to keep it from doing something extremely stupid.

Volguus
Mar 3, 2009

Canine Blues Arooo posted:

Our team maintains our own ORM and I am completely sold that it might be ideal to just build it yourself. The advantages are that you get to build it exactly how you want, adding features is very easy, and you are expected to have at least some understanding of SQL as a team which conveys some nice benefits.

:barf:

Knowing SQL when dealing with a RDBMS is essential. Building your own ORM when there are gazillions to choose from is just :wtf:.

YanniRotten
Apr 3, 2010

We're so pretty,
oh so pretty

Volguus posted:

:barf:

Knowing SQL when dealing with a RDBMS is essential. Building your own ORM when there are gazillions to choose from is just :wtf:.

Yeah... if the benefit is that you know exactly what it does, that's going to erode over time unless your documentation is up to the standard of existing ORMs intended for wide consumption. Anyone you onboard is gonna be like "WTF is this".

I'm against rolling your own bespoke stuff unless your use case is super special (it usually isn't). There's options out there and the maintainers have thought through a LOT of stuff and have good documentation.

shoeberto
Jun 13, 2020

which way to the MACHINES?
We rolled our own ORM but we have an extreme benefit of a relatively small surface area of what is involved. I can see using an off the shelf solution if your core DB schema is constantly expanding to support new features, but our features primarily evolve by way of using existing ORM pieces as lego bricks essentially.

Off the shelf ORMs just add a lot of overhead that *may* save you time and headache, but it also may *add* time and headache too. Depends on the situation.

redleader
Aug 18, 2005

Engage according to operational parameters

ultrafilter posted:

It might be them not knowing that SQL can do that. On the other hand, if the database is storing all the intermediate results on disk, doing stuff in-memory can be much faster. I've seen a query go from three hours to eight minutes when we stopped using SQL for joins and aggregations.

mysql?

Canine Blues Arooo
Jan 7, 2008

when you think about it...i'm the first girl you ever spent the night with

Grimey Drawer

shoeberto posted:

We rolled our own ORM but we have an extreme benefit of a relatively small surface area of what is involved. I can see using an off the shelf solution if your core DB schema is constantly expanding to support new features, but our features primarily evolve by way of using existing ORM pieces as lego bricks essentially.

Off the shelf ORMs just add a lot of overhead that *may* save you time and headache, but it also may *add* time and headache too. Depends on the situation.

This was kind of our problem space and our concerns. Off the shelf stuff *can* make things easy, but rarely does exactly what you want, and depending on how 'exactly' you need the tooling and how difficult it'd be to build for your project (I think our's took a week of one person's time), it might make sense to just build it.

I totally get the idea that it'd be a bad idea for some projects and teams, but even in hindsight, there is no way I would just do the same thing. We get so much mileage out of our solution and the cost was quite low.

lifg
Dec 4, 2000
<this tag left blank>
Muldoon
One time I used a handmade ORM that I really liked. It was built up over ten years to work really well with an e-commerce site.

It only did 80% of the job that a proper, fully-featured ORM would do, but since it’s was built for their use, it was the right 80%.

CPColin
Sep 9, 2003

Big ol' smile.
When I first started at Experts Exchange, they were using a home-built ORM they wrote in Perl. Nobody really knew Perl, so nobody could ever fix anything or make improvements. I rewrote the thing in Java, which everybody knew, and even introduced the concept of having the generated code call utility functions, so we could make bug fixes in those, instead of tweaking the code generator, regenerating everything, and seeing what happened.

I didn't write any tests, though, because we weren't doing that there, yet, lol. They're still using that dumb ORM. And the horrible, home-built CMS that originally defined content using XML that was stored in the database, with everything having a revision number attached to it. I rewrote that, too, to just store the XML as files that could then be checked into normal version control.

The jerk who wrote that terrible CMS is in our group chat, along with the rest of us former employees, and I always have to bite my tongue about how it was my mission for a while to get rid of every line of code with their name on it.

prom candy
Dec 16, 2005

Only I may dance
Writing one or more terrible CMSes is a rite of passage for developers. I have like 4 under my belt.

Ghost of Reagan Past
Oct 7, 2003

rock and roll fun
I just left a terrible, terrible job, and god I'm glad to be out of there. The tech stack was boring, you were locked into a very rigid architecture where a few good decisions were outweighed by the massive tech debt and lack of flexibility and outright horrible decisions. The management was so awful, they'd promise our clients things without consulting with engineering, set arbitrary deadlines for them, and yell at us when they inevitably weren't able to be delivered. Asked to work late a lot, and without a real team lead all that responsibility fell on my shoulders. I demanded more pay and a title change if I was going to do the extra work, and my boss pushed for it (I saw the emails, he showed me them on my last day), and they just...refused? Because I refused to work late constantly? And then after they refused to give me the promotion they still kept demanding I work late? This ain't a charity.

In my last week, they assigned me a big, mission critical feature to finish by Friday. This was because they didn't trust anyone else on the team to finish it and when I asked who was going to maintain it when I was gone, they told me to not worry. I mean, it's my last week and I'm not gonna break my back over this, but this felt like a really bad decision for the business. Whatever, I ended up spending my last week trying to answer any and all questions my team had and fighting fires (which are just constant). I pushed up a work in progress branch with the feature on Thursday afternoon and I got it working 95%, so I figured I'd spend the last Friday morning fixing that last 5%. Well, at 8:30PM on Thursday, I get a phone call from someone asking me to join a call to explain what I was doing so they could finish it overnight.

I mean I refused, because it's my last day. But more worrying for the future of the company was that my teammate, who I walked through the technical decisions on this, was explaining it to these supposedly very seasoned engineers at the company and they didn't understand it? Like, nothing was complicated? It's literally just building on a feature that's pretty tried and true. So they just....ripped out all my code and rewrote some garbage hacks that I knew would only half work. I was right because I spent the Friday morning working with the dude who was tasked to rewrite it (he had no context whatsoever on the project so ... good luck guys) and we fixed a few bugs but I also saw it didn't really work (but it looked like it did at first glance).

Well, not my problem, good job idiots.

Also how are you spending my last day just bombarding me with questions and asking me to fix things, it's my last day, maybe you should've planned my departure better? Good loving riddance. They also cut off my access in the middle of a final call with my boss, which is wild.

qsvui
Aug 23, 2003
some crazy thing
good on you for getting outta there, let us know when they continue asking questions while you are no longer employed there

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
Don't forget when they realize they're not about to do what they're asked to demand boat money to help again

Hughlander
May 11, 2005

Volmarias posted:

Don't forget when they realize they're not about to do what they're asked to demand boat money to help again

$300/hr 80 hours minimum, double rate for anything before 10AM or after 5PM. 'Let' yourself be talked down to 'only' $200.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
Telling a former employer you'll be happy to work as a paid consultant is the fastest way to learn just how important you were to the organization

Hint: you weren't at all

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Blinkz0rz posted:

Telling a former employer you'll be happy to work as a paid consultant is the fastest way to learn just how important you were to the organization

Hint: you weren't at all

Look a forum poster had this happen to them, we can all dream ok?

Ghost of Reagan Past
Oct 7, 2003

rock and roll fun
Not sure I'd actually take any payment to work for them again, in any capacity, to be honest.

I took a (slight) pay cut to leave and the counteroffer was considerable.

shoeberto
Jun 13, 2020

which way to the MACHINES?
I worked briefly in a shop like that, and it's just not worth the drain on your mental health when there are good shops out there that will actually treat you with dignity.

prom candy
Dec 16, 2005

Only I may dance

Volmarias posted:

Look a forum poster had this happen to them, we can all dream ok?

I did some work for a former employer as a paid consultant but we parted on good terms.

Xik
Mar 10, 2011

Dinosaur Gum

prom candy posted:

I did some work for a former employer as a paid consultant but we parted on good terms.

I'm currently working for my previous employer. I quit on good terms as a full time employee, then returned later as a private contractor for just over twice my previous rate. It was originally a short, fixed length contract to finish off a specific project. A year and six contract extensions later, I'm still there working on things which I guess fall into a specific cross-section of knowledge/niche where they struggle to find a replacement.

They are currently going through a restructering, the changes are at every level and significant so I imagine there won't be any further contract extensions.

Xarn
Jun 26, 2015
Probation
Can't post for 9 hours!

Blinkz0rz posted:

Telling a former employer you'll be happy to work as a paid consultant is the fastest way to learn just how important you were to the organization

Hint: you weren't at all

Sorry, can't hear you over the money rolling in :shrug:

Ither
Jan 30, 2010

What ORMs, specifically, are giving y'all trouble?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Ither posted:

What ORMs, specifically, are giving y'all trouble?

All ORMs that generate SQL eventually encounter the same problems:
- They generate awful performance-killing SQL
- They generate incorrect SQL
- Trying to do something simple requires a huge investment of time and energy, and often results in case #1 or #2.

I've seen this with both nHibernate and every version of Entity Framework released in the past decade. I'm sure other platforms have the same issues as well.

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
The only parts of ORMs that are worthwhile are mapping tools (just to copy rows of data into your own objects and vice versa) and perhaps type safe query builders.

Any kind of lazy loading, session tracking, auto-generated SQL etc is all garbage

prom candy
Dec 16, 2005

Only I may dance
ActiveRecord is pretty good for basic use case stuff, it's really annoying when you need to go beyond that though.

Macichne Leainig
Jul 26, 2012

by VG
I feel like the problem with ORMs is that they're "fine" until they aren't, and then it's a headache and a half to debug.

Standard SQL database with stored procs is pretty easy to debug. At least, that has been my experience.

Bongo Bill
Jan 17, 2012

Objects and relations are different, mathematically speaking. In order to get the full advantage out of an ORM, you have to forego some of the advantages of one or the other.

Slimy Hog
Apr 22, 2008

These all sound like arguments to either use the ORM for some things and write SQL for the more complex stuff or to only use SQL. I've not seen a good reason to roll your own ORM

spiritual bypass
Feb 19, 2008

Grimey Drawer
Part of the fun of rolling your own replacement for readily available libraries is inventing a justification after the fact

Space Gopher
Jul 31, 2006

BLITHERING IDIOT AND HARDCORE DURIAN APOLOGIST. LET ME TELL YOU WHY THIS SHIT DON'T STINK EVEN THOUGH WE ALL KNOW IT DOES BECAUSE I'M SUPER CULTURED.

Protocol7 posted:

I feel like the problem with ORMs is that they're "fine" until they aren't, and then it's a headache and a half to debug.

Standard SQL database with stored procs is pretty easy to debug. At least, that has been my experience.

I'm guessing you've never had to work with the output of a dev who realized "if I try to check my business logic into application code, people whine about 'documentation' and 'meaningful variable names' and all that useless garbage - but if I write a sproc then I can do whatever I want!"

smackfu
Jun 7, 2004

One of the major benefits of leaving a job is not having to think about any of those problems again... taking a consulting job kinda defeats the point.

Macichne Leainig
Jul 26, 2012

by VG

Space Gopher posted:

I'm guessing you've never had to work with the output of a dev who realized "if I try to check my business logic into application code, people whine about 'documentation' and 'meaningful variable names' and all that useless garbage - but if I write a sproc then I can do whatever I want!"

That sounds like an egregiously bad developer even by our jaded standards.

Doubt problems from their code are only endemic to SQL.

ChickenWing
Jul 22, 2010

:v:

Slimy Hog posted:

These all sound like arguments to either use the ORM for some things and write SQL for the more complex stuff

This is basically it, in my experience. Couple projects ago had a home-rolled ORM-but-not because the client had a "no hibernate" stipulation (it was more complicated than that) that was effectively just a "here's some stuff for basic crud operations and some basic filtering, if you want anything interesting you've gotta write your own SQL" and it honestly worked out pretty well as far as SQL horrors go.

Paolomania
Apr 26, 2006

Are people using "ORM" to also include "database access layer" cause in my experience something that just marshalls data in and out of relatively flat objects for CRUD operations is just DAL and not ORM.

Adbot
ADBOT LOVES YOU

ChickenWing
Jul 22, 2010

:v:

Paolomania posted:

Are people using "ORM" to also include "database access layer" cause in my experience something that just marshalls data in and out of relatively flat objects for CRUD operations is just DAL and not ORM.

I probably am, given that in retrospect our "ORM" had no relationship modelling :v:

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply