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.
 
  • Locked thread
Bloody
Mar 3, 2013

Shaggar posted:

my code is loaded w/ if(thing!=null && thing.<the real test goes here>)

same

Adbot
ADBOT LOVES YOU

Nomnom Cookie
Aug 30, 2009



Bloody posted:

why would you want that? i love abusing short-circuit AND/OR

i don't mean using it when short-circuit && would be more appropriate but i can think of at least one instance in the last year when i would've used boolean & if i'd known about it

Shaggar
Apr 26, 2006
tbh i cant think of any situations where I'd want it to not short circuit that don't involve horrible clever code state changing

theadder
Dec 30, 2011


wrong thread

Nomnom Cookie
Aug 30, 2009



Shaggar posted:

tbh i cant think of any situations where I'd want it to not short circuit that don't involve horrible clever code state changing

do thing on this server, do thing on that server, report ANDed result

Notorious b.s.d.
Jan 25, 2003

by Reene

Shaggar posted:

my code is loaded w/ if(thing!=null && thing.<the real test goes here>)

defaulting to nullable types is one of the very few things i dislike about java

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Shaggar posted:

my code is loaded w/ if(thing!=null && thing.<the real test goes here>)

i like thing.try(:test)

i want thing.andand.test (andand would return the object itself on a non-nil object, and on nil return an object that swallows method calls and returns nil)

Doc Block
Apr 15, 2003
Fun Shoe

Kevin Mitnick P.E. posted:

do thing on this server, do thing on that server, report ANDed result

yeah, ok, but that's just ANDing two values together, not using it for a test.

edit: unless you're being "clever" and doing something like
code:

if(getResult1() & getResult2())
but then you get what you deserve for doing that.

Nomnom Cookie
Aug 30, 2009



Cocoa Crispies posted:

i like thing.try(:test)

i want thing.andand.test (andand would return the object itself on a non-nil object, and on nil return an object that swallows method calls and returns nil)

c# is getting this as .?


Notorious b.s.d. posted:

defaulting to nullable types is one of the very few things i dislike about java

i prefer to be charitable and think this is something gosling et al didn't have time to deal with for java 1.0

scala would be much more appealing to me if it was stronger wrt null elimination

Morkai
May 2, 2004

aaag babbys
nullable types rule everything around me


















 








(and i hate them)

Notorious b.s.d.
Jan 25, 2003

by Reene

Kevin Mitnick P.E. posted:

i prefer to be charitable and think this is something gosling et al didn't have time to deal with for java 1.0

everyone makes mistakes. java was a really excellent attempt at not making any.

Kevin Mitnick P.E. posted:

scala would be much more appealing to me if it was stronger wrt null elimination

scala's best feature, java interop, sometimes depends on replicating java's mistakes

what scala does right is making option types, map/filter, pattern matching the obvious/easy ways to handle nulls. i almost never have an actual null check in my code because nulls just aren't relevant

Stringent
Dec 22, 2004


image text goes here
||= :smug:

Morkai
May 2, 2004

aaag babbys

what does this stubby penis syntax DO?

Notorious b.s.d.
Jan 25, 2003

by Reene

Morkai posted:

what does this stubby penis syntax DO?

welcome to operator overloading

Stringent
Dec 22, 2004


image text goes here

Morkai posted:

what does this stubby penis syntax DO?

what doesn't it???

Morkai
May 2, 2004

aaag babbys

Notorious b.s.d. posted:

welcome to operator overloading

it sounds dangerous. i hope you know what you're doing with that thing.

Nomnom Cookie
Aug 30, 2009



Notorious b.s.d. posted:

everyone makes mistakes. java was a really excellent attempt at not making any.


scala's best feature, java interop, sometimes depends on replicating java's mistakes

what scala does right is making option types, map/filter, pattern matching the obvious/easy ways to handle nulls. i almost never have an actual null check in my code because nulls just aren't relevant

i want the java interop and i want the non-nullable types :colbert:

Morkai
May 2, 2004

aaag babbys

Kevin Mitnick P.E. posted:

i want the java interop and i want the non-nullable types :colbert:

you can't have everything you greedy prick.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Morkai posted:

what does this stubby penis syntax DO?


Notorious b.s.d. posted:

welcome to operator overloading

it's not overloading in ruby

it's basically lvalue = rvalue unless lvalue

or assign rvalue to lvalue unless lvalue already has a non-falsey value

Nomnom Cookie
Aug 30, 2009



Morkai posted:

you can't have everything you greedy prick.

if the scala guy is so smart how about he proves it by doing what i want

Mathhole
Jun 2, 2011

rot in hell, wonderbread.
i just wanted to let oyu all know that

git is poo poo

mercurial seemed less confusing and just as capable.

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news
guys i think i have distilled computers into their one true form and it is the union of 420 and 219. for reelz

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news
you can do everything with those numbers. everything you want.

Plastic Snake
Mar 2, 2005
For Halloween or scaring people.
420+219+21.9+(2.19*4.20)-4.20 = ~666

hail approximately satan

Coffee Jones
Jul 4, 2004

16 bit? Back when we was kids we only got a single bit on Christmas, as a treat
And we had to share it!
i should just flat out refuse to work for a place that doesn't practice TDD.

but try saying that 3 months into a job hunt

i should just get away from the .net / java world.

Coffee Jones fucked around with this message at 01:03 on Mar 15, 2014

Notorious b.s.d.
Jan 25, 2003

by Reene

Coffee Jones posted:

i should just flat out refuse to work for a place that doesn't practice TDD.

but try saying that 3 months into a job hunt

i should just get away from the .net / java world.

be the change you want to see in the world

moving a reluctant team towards tdd is that intangible they call "leadership"

Notorious b.s.d.
Jan 25, 2003

by Reene
not to mention 90% of the idiots who brag about tdd/bdd/ddd are startup shidiots doing none of the above, they just want young bucks who love buzzwords

Police Academy III
Nov 4, 2011

Notorious b.s.d. posted:

defaulting to nullable types is one of the very few things i dislike about java

We have a thing in our build system at work that actually does nullness checking and sometimes it's a pita because it's not that smart but jfc is it better than dealing with nulls everywhere. now if only the teams we integrate with would actually mark their poo poo @Nullable


Cocoa Crispies posted:

it's not overloading in ruby

it's basically lvalue = rvalue unless lvalue

or assign rvalue to lvalue unless lvalue already has a non-falsey value

l += r ≡ l = l + r
l ||= r ≡ l = l || r

makes sense to me

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD

Notorious b.s.d. posted:

not to mention 90% of the idiots who brag about tdd/bdd/ddd are startup shidiots doing none of the above, they just want young bucks who love buzzwords

it's certainly possible my opinion of TDD could be changed if I saw it in practice but it really seems like it could only work in a project that is either trivial, waterfall-style overspecced, or luxuriously overfunded.

heck even the concept of high levels of strict Unit™ testing doesn't seem to pay any dividends as opposed to the more general notions of automatable "unit" tests, most of which will be integration tests, and continuous integration

Notorious b.s.d.
Jan 25, 2003

by Reene
I divide testing into acceptance tests, and everything else.

Acceptance teats express intent: I was trying to write a program that would fulfill these criteria.

Everything else either smoke tests my code or attempts to exercise the code to recreate a bug that has since been fixed, so that I don't fix the same bug twice.

People have write long books about these topics but this is my two cents. I don't understand the need for vast catalogs of jargon on this one

Deus Rex
Mar 5, 2005

Police Academy III posted:


l += r ≡ l = l + r
l ||= r ≡ l = l || r

makes sense to me

l ||= r isn't exactly equivalent to l || l = r nor to l = l || r. http://www.rubyinside.com/what-rubys-double-pipe-or-equals-really-does-5488.html

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Notorious b.s.d. posted:

I divide testing into acceptance tests, and everything else.

Acceptance teats express intent: I was trying to write a program that would fulfill these criteria.

Everything else either smoke tests my code or attempts to exercise the code to recreate a bug that has since been fixed, so that I don't fix the same bug twice.

People have write long books about these topics but this is my two cents. I don't understand the need for vast catalogs of jargon on this one

i've only been programming 'seriously' for two years now, but testing is by far the most confusing issue i've dealt with.

it's so easy to overtest, and it's also easy to undertest. unit testing involves writing mocks for all external interfaces and objects and so you'll sit there writing tests and then realize 'wait this is really not testing anything' because you've mocked something to the point that all you're testing is whether or not calling one method will eventually call another method.

it's extremely frustrating and when i try to add full testing coverage to projects it quadruples the time involved.

on the other hand, when i just add some integration tests to make sure things do roughly what they're supposed to, it helps out a lot.

anyhow my point is that i'm bad at testing and trying to get good at testing has been harder and more ongoing than any other programming thing i've tried to learn.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
USSMICHELLEBACHMAN I agree with your post, it takes experience and serious peer review to learn what methods make sense to test.

MeruFM
Jul 27, 2010
what's a unit test other than

if (functionCall(input) != expectedOutput){
system.kill(); return false; die; exit(1);
}

I don't think i've ever worked in a TDD environment

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

MeruFM posted:

what's a unit test other than

if (functionCall(input) != expectedOutput){
system.kill(); return false; die; exit(1);
}

I don't think i've ever worked in a TDD environment

if that function call calls external systems that you don't necessarily control you're supposed to mock those systems otherwise it's an integration test.

i mean, testing a single thing is simple. the hard part is deciding what interfaces need to be tested, what inputs need to be tested, and what you should expect from those inputs. then it's refactoring all those tests so that they're elegant and concise or else ur code smells and stack overflow is going to laugh at you.

double sulk
Jul 2, 2010

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD

Notorious b.s.d. posted:

I divide testing into acceptance tests, and everything else.

Acceptance teats express intent: I was trying to write a program that would fulfill these criteria.

Everything else either smoke tests my code or attempts to exercise the code to recreate a bug that has since been fixed, so that I don't fix the same bug twice.

People have write long books about these topics but this is my two cents. I don't understand the need for vast catalogs of jargon on this one

yeah I think we basically agree :)

good point on writing a Unit™ test when you fix a bug, that is definitely valuable and I do that

USSMICHELLEBACHMAN posted:


it's so easy to overtest, and it's also easy to undertest.

this is a great point too! I particularly like that literally nobody ever says the first half but it's so true in every project I've worked on that strived objectivelessly for some particular metric of >XX% lines covered by unit test

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
writing a test every time i fix a bug is one of the few things that makes sense to me

otherwise i've kind of approached it like 'ok i'm testing something manually, i might as well test it automatically' and then every time i think of something new to test manually, i write an automatic test for it. which is how i approached testing when i started but then i started reading about testing and it got much more complicated

Sagebrush
Feb 26, 2012

today i wanted a function that would not terminate and return to the main state machine for thirty seconds until its asynchronous task was completed, so i

for (int i = 0; i < 30; i++) {

//start important task
//and update it with new data periodically until it finishes
delay(1000);
}

yaaaaaaaaaaaaay

Adbot
ADBOT LOVES YOU

Stringent
Dec 22, 2004


image text goes here

Notorious b.s.d. posted:

I divide testing into acceptance tests, and everything else.

Acceptance teats express intent: I was trying to write a program that would fulfill these criteria.

Everything else either smoke tests my code or attempts to exercise the code to recreate a bug that has since been fixed, so that I don't fix the same bug twice.

People have write long books about these topics but this is my two cents. I don't understand the need for vast catalogs of jargon on this one

I want to work in a company where management writes acceptance tests and I code to them for a ridiculous amount of money.

  • Locked thread