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
multigl
Nov 22, 2005

"Who's cool and has two thumbs? This guy!"
yes, follow the advice of an idiot programmer

Adbot
ADBOT LOVES YOU

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
He's not wrong about statement mappings

Sapozhnik
Jan 2, 2005

Nap Ghost
same, except do everything using stored procs and transparently bind them to Java interfaces using proxy objects

maybe also use SQL views and some limited WHERE and ORDER BY generation to sort and filter those if you need a sortable and filterable report table thing every now and again

Squinty Applebottom
Jan 1, 2013

developers are idiots who can't be trusted running queries against a db so you should always provide nice padded views for them to bang their head against

Squinty Applebottom
Jan 1, 2013

if your data is at all useable by base tables either its trivial or you aren't normalized properly

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Just use excel you dringus

Bloody
Mar 3, 2013

just store everything in memory as a hash table or array or linked list or whatever

havelock
Jan 20, 2004

IGNORE ME
Soiled Meat
Plus bits of stored procs are super easy to copy and paste into other stored procs when you need to compose parts of queries that share the same logic.

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

polpotpi posted:

if your data is at all useable by base tables either its trivial or you aren't normalized properly

time to masturbate endlessly over third normal form "Hentai website running at optimal performance" says Miku-chan, my database monitoring script tells me sexily

coaxmetal
Oct 21, 2010

I flamed me own dad

Socracheese posted:

in django i make my db be compatible with the orm and i use it when its easy like

user = User.objects.get(name="shitlord mcfuckstein")

but i write my own sql queries when i need to do anything like multiple relations

where does that put me on the pro/scrub scale

that's like super scrub because you don't know how to use the orm, which is pretty easy to use.

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
orm's that don't let you write your own sql are cool

coaxmetal
Oct 21, 2010

I flamed me own dad
most of the orms I know let you write your own sql if you really wanna.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
writing your own sql is as stupid as writing your own encryption/hashing

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

chumpchous posted:

writing your own sql is as stupid as writing your own encryption/hashing

lol

what is best in life

to see your orm do stuff for you, but write sql when you need it

Shaggar
Apr 26, 2006
orms write bad sql so you don't have to

Goat Bastard
Oct 20, 2004

chumpchous posted:

writing your own sql is as stupid as writing your own encryption/hashing

but less stupid than the number of people who think this unironically

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
What if we could learn what orms are doing internally and then leverage them only when they provide benefit

Whoa

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Gazpacho posted:

What if we could learn

That's a pretty impossible task right there for your average developer

Stringent
Dec 22, 2004


image text goes here

Shaggar posted:

orms write bad sql so you don't have to

shaggar was right

Nomnom Cookie
Aug 30, 2009



Shaggar posted:

orms write bad sql so you don't have to

ain't no sql wizard can improve SELECT * FROM poo poo WHERE gloppiness = 'NOTMUCH'

double sulk
Jul 2, 2010

programming is dumb and a waste of time and the less work you have to do to get it over with the better

who cares about efficiency, just throw more hardware at it

Stringent
Dec 22, 2004


image text goes here

gucci void main posted:

programming is dumb and a waste of time and the less work you have to do to get it over with the better

who cares about efficiency, just throw more hardware at it

i would love to throw hardware at you

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Shaggar posted:

orms write bad sql so you don't have to

i just faced up to the fact that i'm gonna be writing bad sql no matter what. might as well do it in 1/8 as many keystrokes

Stringent
Dec 22, 2004


image text goes here

chumpchous posted:

i just faced up to the fact that i'm gonna be writing bad sql no matter what. might as well do it in 1/8 as many keystrokes

this

Max Facetime
Apr 18, 2009

Stringent posted:

i would love to throw hardware at you

Zombywuf
Mar 29, 2008

How do I ORM a window function?

HORATIO HORNBLOWER
Sep 21, 2002

no ambition,
no talent,
no chance
Java code:
try {
        //...
} catch(Exception e) {
        throw e;
}
this should be a compiler error and by compiler error I mean the computer loving explodes and takes you out with it.

Opinion Haver
Apr 9, 2007

HORATIO HORNBLOWER posted:

Java code:
try {
        //...
} catch(Exception e) {
        throw e;
}
this should be a compiler error and by compiler error I mean the computer loving explodes and takes you out with it.

the other day i ran into some code that used singletons for all of its exceptions

HORATIO HORNBLOWER
Sep 21, 2002

no ambition,
no talent,
no chance
here's another fun one

Java code:
Exception thrown = null;

try {
        // entire body of bigass method, with like a million different lines that can throw
} catch(Exception e) {
        thrown = e;
} finally {
        // cleanup code with a shitload of branching since we don't have any idea what was going on when the exception got thrown
        if(thrown != null) {
                throw new Exception("worthless, unhelpful message, usually punctuated with four or five exclamation points");
        }
}
exception handling is hard, let's go shopping

Shaggar
Apr 26, 2006
lol

GameCube
Nov 21, 2006

Stringent posted:

i would love to throw hardware at you

lol

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

HORATIO HORNBLOWER posted:

here's another fun one

Java code:
Exception thrown = null;

try {
        // entire body of bigass method, with like a million different lines that can throw
} catch(Exception e) {
        thrown = e;
} finally {
        // cleanup code with a shitload of branching since we don't have any idea what was going on when the exception got thrown
        if(thrown != null) {
                throw new Exception("worthless, unhelpful message, usually punctuated with four or five exclamation points");
        }
}
exception handling is hard, let's go shopping

I've seen that poo poo sandwich before :barf:

Unfortunately I think it's the only way to do it without re-factoring the entire method, and since no one wants to do it they just keep piling on more poo poo in the stupid exception handler :(

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
this practice of programming book is v. good. thank you

Goat Bastard
Oct 20, 2004

Hard NOP Life posted:

I've seen that poo poo sandwich before :barf:

Unfortunately I think it's the only way to do it without re-factoring the entire method, and since no one wants to do it they just keep piling on more poo poo in the stupid exception handler :(

at the very least pass thrown into the new lovely exception so you don't suppress all the useful information about what actually went wrong jesus christ

coaxmetal
Oct 21, 2010

I flamed me own dad

HORATIO HORNBLOWER posted:

here's another fun one

Java code:
Exception thrown = null;

try {
        // entire body of bigass method, with like a million different lines that can throw
} catch(Exception e) {
        thrown = e;
} finally {
        // cleanup code with a shitload of branching since we don't have any idea what was going on when the exception got thrown
        if(thrown != null) {
                throw new Exception("worthless, unhelpful message, usually punctuated with four or five exclamation points");
        }
}
exception handling is hard, let's go shopping

if only java had checked exceptions this never would have happened

tef
May 30, 2004

-> some l-system crap ->

chumpchous posted:

this practice of programming book is v. good. thank you

:getin:

Max Facetime
Apr 18, 2009

yaoi prophet posted:

the other day i ran into some code that used singletons for all of its exceptions

I bet they prevent stale stacktraces from being logged by always calling fillInStackTrace() right before throwing their exception :allears:

Sang-
Nov 2, 2007

yaoi prophet posted:

the other day i ran into some code that used singletons for all of its exceptions

this is acceptable if you're using them for non-local return (although Im not sure how threadsafe that is?)

Nomnom Cookie
Aug 30, 2009



Sang- posted:

this is acceptable if you're using them for non-local return (although Im not sure how threadsafe that is?)

who cares you already hosed the dog by throwing an exception to jump up the stack

Adbot
ADBOT LOVES YOU

PleasingFungus
Oct 10, 2012
idiot asshole bitch who should fuck off

chumpchous posted:

this practice of programming book is v. good. thank you

yeah, just finished reading through it last night. a few parts of it are humorously dated, one or two things I disagree with (e.g. their recommendation to use cross-platform graphics frameworks, ala java or tcl/tk, to make your program portable - though that's also probably in the 'dated' bucket), but most of it is really good solid programtips. v. smart dog, commendable.

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