Archive for July 17, 2014

Thursday, July 17, 2014 [Tweets] [Favorites]

Guess What This Perl Does

Mark Dominus (author of an advanced Perl book):

A few weeks ago I asked people to predict, without trying it first, what this would print:

perl -le 'print(two + two == five ? "true" : "false")'

(If you haven’t seen this yet, I recommend that you guess, and then test your guess, before reading the rest of this article.)

People familiar with Perl guess that it will print true; that is what I guessed. The reasoning is as follows: Perl is willing to treat the unquoted strings two and five as strings, as if they had been quoted, and is also happy to use the + and == operators on them, converting the strings to numbers in its usual way. If the strings had looked like "2" and "5" Perl would have treated them as 2 and 5, but as they don’t look like decimal numerals, Perl interprets them as zeroes. (Perl wants to issue a warning about this, but the warning is not enabled by default. Since the two and five are treated as zeroes, the result of the == comparison are true, and the string "true" should be selected and printed.

Of course, that’s not what it does.

Jazzy

Jazzy (from the developers of Realm):

jazzy is a command-line utility that generates documentation for your Swift or Objective-C projects.

Instead of parsing your source files, jazzy hooks into clang and uses the AST representation of your code and its comments for more accurate results.

jazzy’s output matches the look & feel of Apple’s official reference documentation, post WWDC 2014.

Asynchronous Unit Testing in Swift

Chris Adamson:

Fortunately, this is where Xcode 6′s asynchronous testing comes in. It allows us to create XCTestExpectation objects, which are not tests but timers. We create expectations with XCTestCase’s expectationWithDescription(), which just takes a string to describe what we’re waiting for. Then, prior to the end of the test… method, we call waitForExpectationsWithTimeout(), passing in a timeout period and a completion handler closure. This prevents the test method from exiting until either the timeout expires, or some asynchronous test code calls fulfill() on the expectation object, which unblocks it.

Update (2014-07-22): Mattt Thompson:

Perhaps the most exciting feature added in Xcode 6 is built-in support for asynchronous testing, with the XCTestExpectation class. Now, tests can wait for a specified length of time for certain conditions to be satisfied, without resorting to complicated GCD incantations.

Why Your Comcast Rep Is Yelling at You

Adrianne Jeffries:

The man who spoke to Block is a “retention specialist,” a position Comcast describes as “equal parts detective, ally, troubleshooter, and negotiator” in job listings. Comcast’s retention reps are paid a low hourly wage supplemented by a monthly commission that depends on how many customers they are able to drag back into the fold.

[…]

In other words, the incentive structure is really about punishment. Reps start out the month with a full commission, but every canceled product deducts from that amount. Once reps fall below a certain threshold, they get no commission at all. That means a rep could get all the way to the second-to-last day of the pay period only to have a customer cancel four products. Suddenly the rep is below her goal, losing $800 to $1,000 off her paycheck.

This reminded me of Joel Spolsky’s Measurement article from 2002. (Spolsky cites a book about Amazon customer service by Mike Daisey—yes, that one—and parts of the book have since been shown to be exaggerated.)

Update (2014-07-23): Chris Morran (via John Gruber):

A week after the posting of the neediest customer-retention call in Comcast history, the fallout continues, with the company’s Chief Operating Officer telling Comcast employees in a memo leaked to Consumerist that the incident was “painful to listen to,” but that the rep “did a lot of what we trained him…to do.”

Update (2014-07-29): Adrianne Jeffries:

Dozens of current and former Comcast employees told The Verge they had to constantly push products, even if they worked in tech support, billing, and general customer service.