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
uG
Apr 23, 2003

by Ralp
someone has to write abstractions over academic poo poo for the retards!

Adbot
ADBOT LOVES YOU

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

chumpchous posted:

i don't see how cucumber adds anything to this process over spec or rspec or whatever. in rspec it would just be
code:
describe "When i visit a thread" do
   before { visit '/thread' }
     it { should (...) } 
end
It's way less code than writing your specs in a weird NPL, and you can still shove your tests off in to helpers/factories without having to worry about remembering things like "hey was it "when I visit a thread" or "when visiting a thread" or "when i click on a thread"" because you can just use sane function names that are easy to remember.

it's still just as descriptive to whoever is running the tests, and it's way less annoying to program. i think it really just comes down to taste. i'll try cucumber on my next thing and see if i like it
rspec has too much syntax, it feels too much like programming

Nomnom Cookie
Aug 30, 2009



uG posted:

someone has to write abstractions over academic poo poo for the retards!

or make the academic poo poo less abstracted

either way PhDs with 0 industry experience aren't the best at designing usable PLs, who knew

power botton
Nov 2, 2011

haskell is some weird awful academic poo poo for idiots, linq is the greatest thing ever.

microsoft academia -> spectacular language feature

MeruFM
Jul 27, 2010
what's the advantage of linq other than making it look more like a raw query, which at that point why are you not just doing a raw query

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Cocoa Crispies posted:

rspec has too much syntax, it feels too much like programming

i like programming :(

power botton
Nov 2, 2011

MeruFM posted:

what's the advantage of linq other than making it look more like a raw query, which at that point why are you not just doing a raw query

linq isn't just for sql.

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

MeruFM posted:

what's the advantage of linq other than making it look more like a raw query, which at that point why are you not just doing a raw query

off the top of my head... code completion, syntax checking in the gui, you can do linq against enumerables

power botton
Nov 2, 2011

we're fighting this in another thread but if you're using an orm like the entity framework or linq to sql garbage extensively you've done hosed up somewhere

raminasi
Jan 25, 2005

a last drink with no ice
there's a part of me that has the dream job of working at microsoft research but the rest of me ridicules that part a lot

Max Facetime
Apr 18, 2009

tef posted:

if you have process isolation, option types, then checked exceptions don't seem that neat or useful, and btw, you can do nice things with option types.

for the home audience:

process isolation == a fancy word for good old crash & lose work & restart & hope it stops crashing brand of "error handling"

option types == the idea that error handling becomes easy if you squint so hard that all errors start looking like NullPointerExceptions

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

Max Facetime posted:

for the home audience:

process isolation == a fancy word for good old crash & lose work & restart & hope it stops crashing brand of "error handling"

option types == the idea that error handling becomes easy if you squint so hard that all errors start looking like NullPointerExceptions

I'm sorry, sir, but yospos is a troll-free forum. please keep it that way

!!!

Slurps Mad Rips
Jan 25, 2009

Bwaltow!

Jerry SanDisky posted:

movable and existing before c++14 were its selling points, its super easy to implement one

oh i thought you had done something :krad: where you figured out how to make it have a sizeof(T) instead of sizeof(T + 1), like every other c++ implementation of option<T>

Bizarro Buddha
Feb 11, 2007

SAHChandler posted:

oh i thought you had done something :krad: where you figured out how to make it have a sizeof(T) instead of sizeof(T + 1), like every other c++ implementation of option<T>

This is not possible

Condiv
May 7, 2008

Sorry to undo the effort of paying a domestic abuser $10 to own this poster, but I am going to lose my dang mind if I keep seeing multiple posters who appear to be Baloogan.

With love,
a mod


Bizarro Buddha posted:

This is not possible

:thejoke:

havelock
Jan 20, 2004

IGNORE ME
Soiled Meat

git clone trooper posted:

we're fighting this in another thread but if you're using an orm like the entity framework or linq to sql garbage extensively you've done hosed up somewhere

Consider your sources.


git clone trooper posted:

linq isn't just for sql.

Exactly. Linq is the best because Composition. Encapsulate logic in extension methods from IQueryable -> IQueryable. Compose like crazy in new and interesting ways. Test easily against in-memory structures. Use Linq to Sql and get completely predictable db queries that are appropriate for 95% of the garbage you'll ever write. Use rx.net and compose event logic. Use a similar syntax to compose async computations with Task.

Or, you know, write new stored proc every time you want to do something and handle your own dirty object tracking, whatever.

Shaggar
Apr 26, 2006
linq sucks for sql. its no different from writing out a prepared statement in code. its crap for idiots who write bad programs.

also dirty objects are a concept unique to the terrible persistence model which should never be used outside of prototyping or in memory temporary stores.

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

havelock posted:

Or, you know, write new stored proc every time you want to do something and handle your own dirty object tracking, whatever.

unironically this. except make a lil activerecord-type class that does orm-type stuff for you, but lets you override everything when you need to get tricky

havelock
Jan 20, 2004

IGNORE ME
Soiled Meat

havelock posted:

Consider your sources.


uG
Apr 23, 2003

by Ralp

Tiny Bug Child posted:

unironically this. except make a lil activerecord-type class that does orm-type stuff for you, but lets you override everything when you need to get tricky

sounds like the orm i use

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Shaggar posted:

linq sucks for sql. its no different from writing out a prepared statement in code. its crap for idiots who write bad programs.

you can tell because it's in a j-language

Bloody
Mar 3, 2013

yes let me just handwrite some artisanal sql for this web app that will service dozens of users per day because the hypothetical performance increase vs using some canned orm is definitely worth the additional hours of development and frustration when nothing works and then when it does work it works terribly this seems like a worthwhile way to spend time

Shaggar
Apr 26, 2006
nah, linq is some p-lang academic poo poo trying to be forced into a proper language

Bloody
Mar 3, 2013

linq is the only reason to use c#

Shaggar
Apr 26, 2006

Bloody posted:

yes let me just handwrite some artisanal sql for this web app that will service dozens of users per day because the hypothetical performance increase vs using some canned orm is definitely worth the additional hours of development and frustration when nothing works and then when it does work it works terribly this seems like a worthwhile way to spend time

yeah if it doesn't matter an orm is fine.

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

havelock posted:

Exactly. Linq is the best because Composition. Encapsulate logic in extension methods from IQueryable -> IQueryable. Compose like crazy in new and interesting ways. Test easily against in-memory structures. Use Linq to Sql and get completely predictable db queries that are appropriate for 95% of the garbage you'll ever write. Use rx.net and compose event logic. Use a similar syntax to compose async computations with Task.

Or, you know, write new stored proc every time you want to do something and handle your own dirty object tracking, whatever.

i've heard that linq can be punishing performance-wise because sometimes you'll wind up calling methods way more than you would have if you'd just used a plain old loop

Zlodo
Nov 25, 2006

prefect posted:

i've heard that linq can be punishing performance-wise because sometimes you'll wind up calling methods way more than you would have if you'd just used a plain old loop

that's because j-languages only way to do polymorphism is at runtime with interfaces and poo poo which is completely ridiculous for things like linq

a c++ implementation of linq would own, except that everyone is too lazy to do it

havelock
Jan 20, 2004

IGNORE ME
Soiled Meat

prefect posted:

i've heard that linq can be punishing performance-wise because sometimes you'll wind up calling methods way more than you would have if you'd just used a plain old loop

In the general case, no it's basically the same. If you're working solely on memory objects (vs linq to sql) the source is lazily enumerated and all the transforms applied per element so you only iterate over the source once (.Where(blah).Select(blah) doesn't do one loop for the filter and another for the project).

You can occasionally get into trouble with complex query formulations where the source ends up being traversed multiple times - it's basically the equivalent of a SELECT N+1. There are two perspectives on this: 1. who cares? (O(N) is close enough to O(N*N) for most values of in memory N you're likely to deal with), 2. you can identify these cases and put a .ToList in your query chain to force evaluation and prevent multiple iteration.

In summary, there's a very small performance cost in the general case, a predicate degradation in a few cases with a simple work around that doesn't compromise clarity, and it's vastly easier to read and write than the equivalent loops with accumulator data structures. What's not to like?

If you really care about a few cycles here and there you are either wrong to care or using the wrong language/framework/run time.

havelock fucked around with this message at 16:50 on Jul 25, 2013

FamDav
Mar 29, 2008

Zlodo posted:

a c++ implementation of linq would own, except that everyone is too lazy to do it

there are other issues

Bloody
Mar 3, 2013

FamDav posted:

there are other issues

such as 'using c++'

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

havelock posted:

You can occasionally get into trouble with complex query formulations where the source ends up being traversed multiple times - it's basically the equivalent of a SELECT N+1. There are two perspectives on this: 1. who cares? (O(N) is close enough to O(N*N) for most values of in memory N you're likely to deal with), 2. you can identify these cases and put a .ToList in your query chain to force evaluation and prevent multiple iteration.

In summary, there's a very small performance cost in the general case, a predicate degradation in a few cases with a simple work around that doesn't compromise clarity, and it's vastly easier to read and write than the equivalent loops with accumulator data structures. What's not to like?

If you really care about a few cycles here and there you are either wrong to care or using the wrong language/framework/run time.

i'm not arguing; i just know that my last company had a bot that grepped the source for linq expressions because a bunch of developers had done some terrible things with them

hepatizon
Oct 27, 2010

Tiny Bug Child posted:

unironically this. except make a lil activerecord-type class that does orm-type stuff for you, but lets you override everything when you need to get tricky

so, activerecord

Shaggar
Apr 26, 2006
if you cant understand your linq just by glancing at it its probably bad.

power botton
Nov 2, 2011

prefect posted:

i've heard that linq can be punishing performance-wise because sometimes you'll wind up calling methods way more than you would have if you'd just used a plain old loop

yeah that sucks when the stackoverflow code i copied and don't understand isn't done well

power botton
Nov 2, 2011

havelock posted:

Or, you know, write new stored proc every time you want to do something and handle your own dirty object tracking, whatever.

as someone who has dealt with databases with billions of rows of data each table...

but if you're making a shitheel little app that one person will use for a few hundred records, do whatever you want.

Shaggar posted:

yeah if it doesn't matter an orm is fine.

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

git clone trooper posted:

yeah that sucks when the stackoverflow code i copied and don't understand isn't done well

no, this was the result of resharper (i think) offering to convert loops into linq expressions, and developers going along with it blindly

(in my own limited experience, it's tough to say "no" to resharper suggestions -- those guys are super-smart, so they must know better than i do)

power botton
Nov 2, 2011

like when jquery idiots chain tons of functions and selectors and turns out they're doing things a millions times over

havelock
Jan 20, 2004

IGNORE ME
Soiled Meat

git clone trooper posted:

as someone who has dealt with databases with billions of rows of data each table...

but if you're making a shitheel little app that one person will use for a few hundred records, do whatever you want.

Why do you have billions of rows in your transactional tables?

But yeah - my point is that most everyone is writing stupid garbage even though they think they aren't. 500k records? who cares? 1 million records with reasonable indexes? who cares?

It's worth those few extra milliseconds to end up with a codebase that can actually be read and maintained.

MeruFM
Jul 27, 2010
i'm writing a regular application of the .exe kind with a sqlite db and it really sucks when you click something and it lags because the shitsql was not written right

it's funny, being on the internet for so long makes you immune to something that's actually really horrible

Adbot
ADBOT LOVES YOU

Shaggar
Apr 26, 2006
stored procs are way easier to understand and maintain once you get above a handful of tables.

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