New around here? Register your SA Forums Account here!

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
HoboMan
Nov 4, 2010

*mentored other developers

Adbot
ADBOT LOVES YOU

redleader
Aug 18, 2005

Engage according to operational parameters
ef sucks, don't use it

i don't know what the solution is for doing db stuff, but i certainly know that ef is not that solution

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003

Flat Daddy posted:

what are some things I can do if my work project is not technically interesting in any way but I want to add bullet points to my resume?

have you tried applying unnecessary technologies that don't actually meet the business needs any better than a simple solution would have?

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.


redleader posted:

ef sucks, don't use it

i don't know what the solution is for doing db stuff, but i certainly know that ef is not that solution


dapper and stored procs

i was updating an old batch job today to add some new functions and it was all old school sql datareaders and it suucckkkedd having to manually cast everything and check for nulls. i should have just added Dapper to it but i didn't want to end up with two approaches embedded into the thing and was too lazy to update the whole thing and then have to test it

Flat Daddy
Dec 3, 2014

by Nyc_Tattoo

DELETE CASCADE posted:

have you tried applying unnecessary technologies that don't actually meet the business needs any better than a simple solution would have?

that’s what the project already is. we use react and redux to render a basically static page. others are working on replacing the backend with microservices that talk to each other with a central queue. someone else is “researching” adding graphql layer. at this point i think I’d need to invent new forms of wankery to get in on the action

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

HoboMan posted:

my new job will pay for it so can anyone recommend a tutorial service?

if your job is paying for it, the correct answer is college

redleader
Aug 18, 2005

Engage according to operational parameters

Powerful Two-Hander posted:

dapper and stored procs

i was updating an old batch job today to add some new functions and it was all old school sql datareaders and it suucckkkedd having to manually cast everything and check for nulls. i should have just added Dapper to it but i didn't want to end up with two approaches embedded into the thing and was too lazy to update the whole thing and then have to test it

the missing piece would be nicely managing schema changes and migrations, and coordinating the rollout of these

i guess ef's selling point is that it does everything (albeit with mediocrity)

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.


redleader posted:

the missing piece would be nicely managing schema changes and migrations, and coordinating the rollout of these

i guess ef's selling point is that it does everything (albeit with mediocrity)

funnily enough ive been looking at that sort of thing and as far as i can tell all solutions suck in different ways and you're always going to end up having to janitor dependencies somehow

like maybe you could abstract your entire db into a BI layer (or Business Objects layer or whatever the proper name is) so that all your schema dependencies are in one place but ive seen that kind of done and it sucks and never gets maintained properly.

edit: i guess dapper introduces a sort of hidden dependency in that your proc outputs must match to your class property names and that is not directly visible if you don't pay attention, but i'll take that over "somewhere in this edmx file is the mapping i need" any day

Powerful Two-Hander fucked around with this message at 22:49 on Apr 8, 2019

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.


I just remembered that our older apps (we have Web apps from like 2007)used to use the "shared business objects" approach and it probably started as a good idea but ended up with nonsensical methods/objects being used all over the place because people kept including it as a dll and passing it around so you'd get like

code:

list<post>MyPosts = convertPoopToPosts(Butts.Poop)

with weirdo mappings behind them instead of just writing a new call

edit: oh yeah and people would modify the library for specific use cases and not check changes in so you'd have like 5 different mutually incompatible versions floating around it sucked

Powerful Two-Hander fucked around with this message at 23:37 on Apr 8, 2019

animist
Aug 28, 2018
the more i attempt to use c++ metaprogramming the more i can feel my brain dribbling out my ears

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

animist posted:

the more i attempt to use c++ metaprogramming the more i can feel my brain dribbling out my ears

c++ metaprogramming is incredibly good but unfortunately it requires a lovely perfectly smooth brain. marble-like, hard as a rock. this is enlightenment

animist
Aug 28, 2018

Phobeste posted:

c++ metaprogramming is incredibly good but unfortunately it requires a lovely perfectly smooth brain. marble-like, hard as a rock. this is enlightenment

:hmmyes:

elcannon
Jun 24, 2009

redleader posted:

the missing piece would be nicely managing schema changes and migrations, and coordinating the rollout of these

i guess ef's selling point is that it does everything (albeit with mediocrity)

If you are using MSSQL then the SSDT project type is good for storing all the schema objects and you can get the build to output a .dacpac file that you can feed into a command line utility to do a fresh deploy or a possibly graceful migration. This falls apart if you have a change resulting in possible loss of data (e.g. changing a column from an nvarchar to a varchar), but in those cases a I don't see how you get around some amount of dba intervention or whatever. I've got our current build process setup so that changes in the schema project result in a new MSSQL docker container being built and registered which goes a long way for doing dev stuff or certain integration tests where spinning up an empty DB is useful.

If you aren't using MSSQL I guess you can just put a big SQL create script into source control and get most of the same benefits.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
that reminds me - at my first real programming job (php/mysql, because of course) the database schema versioning system was a bunch of ddl statements on a trac wiki page. on deploy you manually ran whatever had been changed since last deploy in the production db. pretty spoooky stuff in retrospect but i don't seem to remember anything going spectacularly wrong in my time there.

jeffery
Jan 1, 2013
we're gonna have a really good programming module because of me

galenanorth
May 19, 2016

Lutha Mahtin posted:

are you able to get a PO Box or a coworking space?

also did u try "well im technically doing all the business online, so" :v:

No, but the thought of trying the "well im technically doing all the business online, so" line of questioning did occur to me. I couldn't get through to the Zoning Board and they wanted me to leave a message, and I'm hesitant about leaving details about something that could get me in trouble, but I'll call the county clerk's office and ask them instead. One of the nine places where I applied for a Django job wrote me

"There's been a lot of interest in the position making the selection process extremely competitive. Although your experience is impressive, it's not the best match for this specific role. I'll keep your resume and contact you if I come across other opportunities that may be a better match."

I'm going to work on getting an online tutoring job now

galenanorth fucked around with this message at 01:46 on Apr 9, 2019

pseudorandom
Jun 16, 2010



Yam Slacker

gonadic io posted:

I'm doing my first async http server/client/db thing in rust and am finding it pretty painful honestly: https://github.com/djmcgill/de-list-server

just the process of getting used to the hyper/tokio setup, and it doesn't help that the library I proofed out the sync stuff in hasn't updated it's async interface in a while so i'm having to reimplement it. i'll probably end up contributing my changes back as a pr i think but it's annoying to have to do

e: also i should have just used an error library (or just ignore all errors) from the beginning instead of ending up with poo poo like Box<(dyn std::error::Error + Send + Sync) in a bunch of places

I'm both a couple days late and too lazy right now to actually investigate your code, but is there any reason you're going lower-level with hyper/tokio rather than one of the higher level frameworks? Rocket was really easy for simple projects, but I've moved over to Actix for my more recent toy projects. I would definitely recommend using a framework for Rust web things, unless your project is a web framework itself.


Beamed posted:

This was 2008-2011

Look at this guy, graduating high school in 3 years.


I was 7-11.



Phobeste posted:

c++ metaprogramming is incredibly good but unfortunately it requires a lovely perfectly smooth brain. marble-like, hard as a rock. this is enlightenment

I'm wonder how the developers are doing at my previous employer. Once I got a good grasp of templates and metaprogramming, I started using a lot of it. I tried to document it well, as I had already been thinking of leaving (and I have compassion and empathy for other devs), but I'm still curious how they're dealing with the damage I left behind.

Osmosisch
Sep 9, 2007

I shall make everyone look like me! Then when they trick each other, they will say "oh that Coyote, he is the smartest one, he can even trick the great Coyote."



Grimey Drawer

HoboMan posted:

my new job will pay for it so can anyone recommend a tutorial service?

I've heard good things about egghead and thinkster.

gonadic io
Feb 16, 2011

>>=

pseudorandom posted:

I'm both a couple days late and too lazy right now to actually investigate your code, but is there any reason you're going lower-level with hyper/tokio rather than one of the higher level frameworks? Rocket was really easy for simple projects, but I've moved over to Actix for my more recent toy projects. I would definitely recommend using a framework for Rust web things, unless your project is a web framework itself.



I had a look at them but didn't really see what they'd give me for my dumb use case. I do want to switch to Tide to get futures 0.3 everywhere though

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

HoboMan posted:

i get to pick all the tech for a brand new webapp! :toot:



i have to pick all the tech for a brand new webapp :ohdear:

dare you to propose this

and then when the laughing is over tell them you actually want to use Dyalog

Aramoro
Jun 1, 2012




Powerful Two-Hander posted:

funnily enough ive been looking at that sort of thing and as far as i can tell all solutions suck in different ways and you're always going to end up having to janitor dependencies somehow

like maybe you could abstract your entire db into a BI layer (or Business Objects layer or whatever the proper name is) so that all your schema dependencies are in one place but ive seen that kind of done and it sucks and never gets maintained properly.

edit: i guess dapper introduces a sort of hidden dependency in that your proc outputs must match to your class property names and that is not directly visible if you don't pay attention, but i'll take that over "somewhere in this edmx file is the mapping i need" any day

Is this not just an ORM, just use Hibernate/JPA to manage your schema.

Aramoro
Jun 1, 2012




DELETE CASCADE posted:

have you tried applying unnecessary technologies that don't actually meet the business needs any better than a simple solution would have?

We call that 'futureproofing'

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

Powerful Two-Hander posted:

"somewhere in this edmx file is the mapping i need"

so glad I don't work with EF anymore

Shaggar
Apr 26, 2006

Aramoro posted:

Is this not just an ORM, just use Hibernate/JPA to manage your schema.

:barf:

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.
oh god jesus gently caress hibernate is one of the few things worse than EF.

Aramoro
Jun 1, 2012




Finster Dexter posted:

oh god jesus gently caress hibernate is one of the few things worse than EF.

Counterpoint, Hibernate is cool and good.

elcannon
Jun 24, 2009
Probably the most useful take I've gotten from reading this thread over the years is that the application layer has no business owning the database layer and that ORMs inevitably end up with people blowing off their own foot and then just shrugging it off because at least they don't have to touch SQL.

My first job out of college had an inventory processing job that had to be run every 2 hours. While the job was running no one could generate any reports off the DB or do any type of manual entry into the inventory system. By the time I was hired the job took anywhere from 80 to 110 minutes run, meaning that anyone that needed access to the inventory system had about a ~30 minute window every two hours to do whatever they needed to do with the inventory system before it went down again. My manager told me that "its doing a bunch of really complicated SQL stuff on our ~*~5000 SKUs~*~ so there's not really any way to make it faster". Everyone on the product team had just accepted that they would have to constantly rearrange their schedules around the 3-4 times per day when the inventory system was available. I eventually got assigned a task to change some portion of the code in that job and I discovered that the two senior devs that had written it had used EF and were doing tons of 2-3 level nested iterations inside LINQ-SQL IQueryables without materializing anything so each outer iteration ended up producing 1000s of queries that were mostly full table scans because no one had bothered to index anything. That thing probably took 2-3 minutes to run back when they only had 100 or so SKUs but just exploded as that DB grew and it was impossible to debug because even if you ran the query profiler you have to still map all of the garbled autogenerated EF SQL back to the LINQ statements.

That place had tons of scheduled jobs that ran for insane amounts of time and people were just fine having like a nightly ~8 hour job that would fail at 4AM 2-3 times a month. I finally buckled down and learned how to index properly and was able to get a couple of those from 4+ hours to less than a few minutes and it is a v gratifying feeling. SQL owns and I'll never understand why so many people will jump through so many hoops to not have to touch it.

Aramoro
Jun 1, 2012




elcannon posted:

SQL owns and I'll never understand why so many people will jump through so many hoops to not have to touch it.

Developers have a particular talent for absolutely butchering hand crafting SQL. One of the first things I looked at when in an investment bank was a query that was taking ages, previous dev was producing a Cartesian product of rows in the database for a query. On his test database with 10 rows no issues, with millions of rows? Less good. We use Hibernate specifically because we support deploying on SQL Server and Oracle and formally DB2.

Aramoro fucked around with this message at 14:51 on Apr 9, 2019

Shaggar
Apr 26, 2006
if you cant write sql you probably cant write application code.

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

Aramoro posted:

Developers have a particular talent for absolutely butchering hand crafting SQL. We use Hibernate specifically because we support deploying on SQL Server and Oracle and formally DB2.

use a statement mapper, then

You get to abstract away the raw sql but don't have the janky bullshit that inevitably happens with ORM

Aramoro
Jun 1, 2012




Finster Dexter posted:

use a statement mapper, then

You get to abstract away the raw sql but don't have the janky bullshit that inevitably happens with ORM

Application is majority CRUD application, utilising a large number of the features of Hibernate with lazy loading etc. It's basically a textbook example of where you should use an ORM. Just being able to persist pojo's in a DAO layer is a big advantage. Using a statement mapper would end up with us essentially writing our own ORM which would be a bad choice.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

one of the most fun tasks I had in my first year at this job was coding a "shipping suggestion score" that was essentially an m-dimensional knapsack problem

i got a good lesson on the importance of specs when it turned out they barely kept any stock for their hugely varied catalogue, meaning m (nr. of possible items) was on the order of 10k or so, the knapsack max 'weight' for each dimension (nr. of each item in stock) was < 10, and each item had 'weights' (order quantities) in the 0-5 range. so basically it was closer to boolean logic than combinatorial optimization, and most of my algorithm code was useless and had to be redesigned for that particular use case

well, just got a lesson on the importance of *writing down* those specs, and also on placing hard execution time limits on all your non-essential async tasks. the client just had a special offer where everybody who placed an order this week got a free $widget, and they stocked up on something like 80k of that one particular $widget, which also appeared in every order. so while my original implementation might have worked decently well, the updated implementation ran face-first into a combinatorial explosion, ate approximately all of the RAM, and crashed the application as it tried to figure out the optimal way to allocate those 80k widgets to ship as many orders as possible. fun.

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

Aramoro posted:

Application is majority CRUD application, utilising a large number of the features of Hibernate with lazy loading etc. It's basically a textbook example of where you should use an ORM. Just being able to persist pojo's in a DAO layer is a big advantage. Using a statement mapper would end up with us essentially writing our own ORM which would be a bad choice.

I assume this is the same textbook that teaches inheritance as good, so probably just throw that in the trash

HoboMan
Nov 4, 2010

i will say that if you are doing pure CRUD and your objects are strictly just tables then an ORM lets you skip doing a lot of manual mapping and can be good.

however this use case is actually pretty rare unless you are very careful in your requirements and initial design. (also you may have to manually map stuff anyways because gently caress you, arbitrary business rules)

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
sql is the best and orms are bad, namaste

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

DELETE CASCADE posted:

sql is the best and orms are bad, namaste

:agreed:

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
query builders/sql metaprogramming tools are usually p dang handy on the application side though. SQLAlchemy, jOOQ, that sort of thing.

toiletbrush
May 17, 2010

HoboMan posted:

i will say that if you are doing pure CRUD and your objects are strictly just tables then an ORM lets you skip doing a lot of manual mapping and can be good.

however this use case is actually pretty rare unless you are very careful in your requirements and initial design. (also you may have to manually map stuff anyways because gently caress you, arbitrary business rules)
my previous NHibernate project was like this - most of the API was OData requests for generic GETs that went straight to raw tables, or views when we wanted to aggregate a bunch of stuff together or to isolate clients from our schema. Updating and saving was easy because we made sure our mappings were super specific and correct. Worked really well and we had basically zero issues and excellent performance.

ORMs are fine if you accept that while they save you writing a lot of SQL, they don't stop you from needing to understand it.

Edit to add: also learn what 'Inverse' does and don't just pepper it around until things start working

toiletbrush fucked around with this message at 18:02 on Apr 9, 2019

HoboMan
Nov 4, 2010

guess who got two thumbs and found plaintext passwords in the database?

Adbot
ADBOT LOVES YOU

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.
cjs: just finished a shouting match between me, CTO, and CEO... choice CEO quote: "small, quick tasks will always be higher priority than bigger tasks even though the small tasks might be less important from a business standpoint."

oh ok let me just interrupt the frontend work on our new platform version so frontend dev can spend 10 minutes adjusting a font size on the old version that will be obsolete in 3 weeks.

:suicide:

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