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
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.

Adbot
ADBOT LOVES YOU

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

coaxmetal
Oct 21, 2010

I flamed me own dad
shaggar's gimmick is wearing on me I think

coaxmetal
Oct 21, 2010

I flamed me own dad

Shaggar posted:

that's a user object, not a person object, and the email is the login id. its perfectly acceptable to use email as the primary key in this case. in a more advanced system where you might be using other forms of authentication then yeah its no good, but that's not what the example was. also you are 100% wrong about natural primary keys being bad. you've probably never done any data work. unique constraints are different from primary key constraints because they can contain null values. primary keys cannot. also you don't understand what a surrogate key is. the auto generated surrogate key is whats used for references. that's why its called a surrogate key.

also the firstname lastname stuff doesn't matter, its just related data to the user. it could be anything but that's what I put. I also put a loving 8 character password field. its there to show what data is useful as a key and what isn't, not the be all end all of user objects.

shagger you realize you can have both a unique and a non-null constraint on a column without making it a PK?

Anyway, re: notorious bsd saying things, django-style ORMs are for when you are making the database with the app. Which is pretty common, a lot of databases are made specifically as part of an application. And another one like the "smarter orms" is SQLalchemy, which works as a mapping and abstraction for abritrary data. Has a nice sql expression language too.

also an orm can usually generate perfectly performant sql for most applications. A select or join made by an orm is going to be just as good as your artisinally handcrafted stored procedure, and provides a layer of abstraction and portability as well.

coaxmetal
Oct 21, 2010

I flamed me own dad
wait whats wrong with python scope?

coaxmetal
Oct 21, 2010

I flamed me own dad
I didn't want to waste good entropy on this thread so I just voted 1

coaxmetal
Oct 21, 2010

I flamed me own dad
p lang is short for "programming language"

Adbot
ADBOT LOVES YOU

coaxmetal
Oct 21, 2010

I flamed me own dad
I still do a double take every time I see a tef post because I think its TBC. Because also I havent been reading/posting much for like a year.

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