- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Frist
Admin
Unless I'm seriously stupid, this takes the 1 path 99.5% of the time, not 0.5%.
Admin
What IS the result of a "-=" operator in javascript?
Admin
True, but it takes the other path 0.5% of the time.
Admin
-=, like all JS assignment operators (=, +=, <<=, >>=, >>>=, *=, /=, |=, &=, ^=, %=, **=), returns the new value of the variable.
Admin
In other news, Remy has no idea what A/B testing actually is.
Admin
Au contraire: "D-" is still a passing grade. I certainly wouldn't pass this code.
Admin
Same as in C, C++, and just about every other language that has this sort of operator.
Admin
He understands what it is in practice. How many UI designers are working out hypotheses and P-values when they do A/B testing?
Admin
That might be unfair. But he hasn't really explained why this snippet doesn't do A/B testing.
I apologise for stating the obvious, but the point of A/B is pretty much the same point as double-blind tests in science. Take (in this case) 0.5% of the population at random, and do A rather than B.
Then, of course, you measure the results of applying A rather than B. (And normalise them. I don't need to explain that, either.)
You can't really do A/B here unless you pass the randomised selection parameter into the function, so, you know, not actually A/B at all. Because, how would you measure the results?
(Whether or not A/B testing is a good idea is best left to the SVPs with metrics and charts and snake oil and stuff. Me, I'm sort of A/B on the stuff.)
Admin
I'm not sure that he does.
And how many UI designers would you expect to do the relevant statistical analysis?
Me, I expect "none." It's not what a UI designer should do. A UI designer should present A and B, according to parameterization which is clearly not present here.
One other thing about A/B which always bugs me: it's like a referendum. Surprise! It's a binary choice! All subtlety is lost, and you don't get to juggle multivariates. This is not an implementation limitation, obviously, but it turns out to be a [o]Bozo Management[/i} limitation.
Irrelevant to the present case, of course, where the A/B degree of freedom is ... er ... zero.
Admin
But, sadly, not every language that has the operator. shudders
That said TRWTF is having a single-letter global variable.
Admin
Hmmm. Why does Google Chrome spend about 20 seconds trying to connect to api-widget.soundcloud.com page while trying to load this post from the main page?
Admin
Google Chrome is A/B testing you.
CYA
Admin
Those improv posts use embedded soundcloud.
Admin
Something to do with the podcasts on the front page (at the end of May) I'd guess.
Admin
It's fairly common for assignments to return some sort of void or unit type. This more accurately represents the side-effecting nature of the operation, and prevents errors where people mix up = and ==. It's a reasonable question to ask about a language you don't know.
Admin
Some devops shops use the term blue-green testing, rather than A/B.
Admin
Actually in C and C++ the operators return not the new value, but the variable assigned to as an lvalue (C++-speak "reference"). The value enables just common idioms like a=b=c=0 or while ((c=getchar()) != EOF) But the lvalue gives us gems like ((a+=5) *= 3) &= 0xFF or a += b = c *= 7 for some fun during the review.
Admin
Exactly. And that is a completely different thing from "randomly showing different versions until something sticks".
(I agree that the person who wrote this code also understands sweet Fanny Adams about A/B testing.)
Admin
Multi-variable A/B testing exists, but is hard to get right. (I suspect, but do not know, much more than polynomially harder than single-variable.)
Admin
The assignment operator would make sense in a slightly different context. Want to randomly choose 1 of 5 paths? Just change the value to 0.2 and copy that line 4 times.