Do not question the algorithm

Uber, the creepy[1] ride service company, wants us to just accept “The Algorithm.”

During a recent hostage situation in Sydney, Uber increased its rates according to a “surge pricing” algorithm. When the inevitable backlash occurred, the company attempted to excuse itself by claiming that the price changes are algorithmic and that the company wasn’t engaging in a deliberate attempt to take advantage of a crisis. The former, of course, is a ridiculous claim because (to paraphrase Dr. Paul Batalden): “Every algorithm is perfectly designed to get the results it gets.”[2] If the algorithm fails to account for crisis situations, its designers either failed to consider that crises might occur, or they did consider it but are hiding behind “The Algorithm.”

The real problem here is both insidious and pervasive in our internet-solutionist culture. Internet companies like Uber, Google, and Facebook expect us to accept that their unseen algorithms are inherently fair and just. Their pleas that we should learn to love their algorithms are attempts to endow them with properties they simply do not have. Algorithms are not naturally-occurring phenomena whose properties and behaviors are waiting to be discovered and accepted. They are designed by companies in an effort to advance their own interests.

Reminds me of Evegeny Morozov’s thesis in “To Save Everything Click Here”.


  1. Why “creepy”? As The Telegraph points out, it’s not the NSA spying you need to worry about. It’s companies like Uber whose executives threaten journalists who dare to write a critical article.

  2. The original quote was: “Every system is perfectly designed to get the results it gets.”

Not taking sides

Plus ça change plus c'est la même chose

The headline on the New York Times reads: “Obama avoids taking sides on effectiveness of CIA techniques.”[1]

Seriously, you can’t take sides on torture? If you can’t say something definitive about the abhorrent use of torture by the CIA and their operatives, then you shouldn’t be in charge of a nation that sees itself as just and compassionate.

This is not difficult. We have no right to complain about human rights violations in other countries when we are an unrepentent violator.


  1. Baker, P. (2014, December 10). Obama Avoids Taking Sides on Effectiveness of C.I.A. Techniques. The New York Times. Retrieved December 10, 2014, from http://www.nytimes.com/2014/12/11/us/politics/obama-effectiveness-cia-torture.html [Link](Baker, P. (2014, December 10). Obama Avoids Taking Sides on Effectiveness of C.I.A. Techniques. The New York Times. Retrieved December 10, 2014, from http://www.nytimes.com/2014/12/11/us/politics/obama-effectiveness-cia-torture.html)

On becoming a superstar

I recently stumbled on an intriguing book entitled: “How to be a high school superstar: A revolutionary plan to get into college by standing out (without burning out)” by Cal Newport. As a homeschool parent, I find that I think about how to equip my daughter to “sell herself” more effectively to admissions committees earlier than I would if I didn’t. After all, we have no one else to rely on; our family is almost entirely of our own making.

The thesis is simple. Most high school students attempt to stand out by competing on quantity and in the process they either burn themselves out or they lose sight of the very attributes that would make them more appealing to admission committees. Or sometimes they get lucky and win at the numbers game.

The most successful kids are those who are, in a word, interesting. Any reasonably endowed kid can load up his schedule with AP classes, sign up for a bunch of clubs, reluctantly volunteer at Habitat for Humanity, and half-heartedly play the clarinet in the band. But if you’re playing the numbers game with this, you’re already at a disadvantage because that what everyone else is doing. And what do you say when the interviewers asks you about any of these activities? If you’re only half-engaged, then the child ends up giving a rehearsed boring answer to the question.

This book takes a contrarian approach - which to a contrarian like me always sounds appealing. Instead of trying to win on quantity, Newport urges kids to compete on “interestingness”. When I was a more active Flickr user, there was an “Interestingness” score that the service assigned to photographs. Maybe it’s still the same. No one ever knew exactly what made one photograph more interesting than any other; but there was a certain “je ne sais quoi” about images that achieved that status. Maybe kids are like Flickr images and admission committees are looking for capable kids with a quality of interestingness.

Newport encourages kids to follow three laws of being what he describes as a “relaxed superstar”:

  • The law of underscheduling. Give yourself plenty of time to explore things that are interesting to you. (Remember when people had hobbies?)

  • The law of focus. Be the master of one area of interest. Don’t cover the waterfront with activities that fail to tell a coherent story about who you are. I always think about good ideas as being those that you can describe in a 15 second elevator pitch. Maybe the best kids are that way. Unrelated activities don’t add up to anything coherent. I wrote about this not long ago[1].

  • The law of innovation. Newport describes this law as the pursuit of “accomplishments that are hard to explain [but] not hard to do.” For me, this was the hardest bit to understand and agree with because there are so many worthwhile pursuits that kids can follow that aren’t necessarily innovative. Perhaps one way that students can be innovative without necessarily abandoning their passion is to find an innovative “angle” on their pursuit. If you are a musician, for example, how can you find something unique to do with music that complements your interest?

This is an area where homeschool parents may have an advantage. It’s easier to have unscheduled time when the entire schedule is up for discussion.


  1. Duncan, A. “Hoping something sticks”, October 9, 2014. Link

Seeing the forest and the trees

One of the joys and trials of Suzuki parents is helping our children attend to the myriad details that turn technique into beautiful music. Immersing yourselves in the details of their instrument, you begin to appreciate the massive complexity that talent education breaks down into logical progressive steps. As with muscles that develop strength through repeated use, our patience develops through repeated trials and the realization that “the art is long.” It is no wonder that sometimes we are attending so carefully to the repertoire, the technique, finding the helpful ways to practice together that we lose sight of the bigger picture. Dr. Suzuki imagined a world where music could bridge cultural gaps by helping acquire the common language of music while developing strength and excellence of character. In educational paralance, this is the “hidden curriculum” of the Suzuki method. Without calling them out by name, our children acquire a set of competencies that will make them more perseverant, resilient and compassionate adults. Yet there is still another curriculum that we must attend to - the culture of music. Suzuki’s brilliant insight was that language is largely learned through listening, modeling, repetition, and feedback. This language that our children are learning doesn’t exist in a vacuum; rather, it is part of a culture. Frantz Fanon wrote that: “To speak a language is to take on a world, a culture.”[1] Just as we bring intention and purpose to the development of technique, Suzuki parents should look diligently for ways they can introduce their children to the amazing culture of music.

Classical music in peril

That classical music is imperiled is no secret. Mark Vanhoenacker, writing for Slate, declared that: “Classical music in America is dead.”[2] Recent years have witnessed major disputes between orchestra players and management, owing in large part to the economic realities of dwindling audiences. Many young people (perhaps even Suzuki students) have never attended a professional classical music concert. Scanning the audiences at concerts, one sees an astonishing lack of age diversity. In a study commissioned over ten years ago by the John S. and James L. Knight Foundation, only 13% of survey respondents had attended a classical music concert in the previous year.[3] If the study were repeated today, the data would undoubtedly look more dire. Music sales data and the number of classical radio stations all tell a similar story. Classical music, which has always appealed to a relatively small niche in the United States, is threatened by mounting social and economic factors. Music may be a language; but language cannot survive without culture.

Tips for parents

Parents need not be musicians themselves to introduce their children to the culture of music. Adults who are curious about the world naturally convey their sense of interest to their children. So, be curious about the music your children are playing (and more.) “I wonder what period of music this piece is from?” “What’s special about that period of music?” “Are there any performances of this piece on YouTube?” Children, by and large, don’t expect grown-ups to have all of the answers; so parents needn’t feel they must know everything about music to cultivate the culture of classical music in their children. Instilling a curiosity and a practice of jointly exploring this amazing world of music is all it takes.

The games that we play with children in practice can be extended in all sorts of ways to explore musical culture. Parents can play “Name the composer” with their children. Find a recording or video of a piece by a famous composer and try to guess. My sister and I played this game when we were young.

I can’t stress enough the importance of seeing and hearing live music. Almost every community has a diversity of classical music venues to choose from. Although the Suzuki method stresses listening as a major modality for learning music, attending concerts serves two major purposes other than listening. It connects the visual with the audible. Some have compared attending a classical concert to watching a masterpiece being painted on stage in real-time. Finally, it can inspire children to see adults who have mastered their instruments and fellow audience members who also enjoy great music.

Read about the composers, for their lives are quite fascinating. Many led difficult lives; and this can inspire kids to be grateful for the fine music we have. Try to situate the composers and periods of music on a timeline with familiar places and events. This helps anchor music as a real integral part of history, not just something that happened “out there.”

Conclusion

The work and joy of Suzuki parents is found in instilling both the language and culture of music in our children. It means taking an expansive view of what we’re trying to accomplish. We “zoom in” on technique and individual mastery and “zoom out” to focus on the culture of classical music. By helping children situate themselves in a culture that stretches into the past and future, they can begin to see themselves as the recipients of a rich and vital heritage. They can see the trees and the forest.


  1. Fanon, Frantz, Black Skin, White Mask

  2. Mark Vanhoenacker, “Requiem: Classical music in America is dead”, Slate, January 21, 2014, accessed November 27, 2014. http://www.slate.com/articles/arts/culturebox/2014/01/classical_music_sales_decline_is_classical_on_death_s_door.html

  3. John S. and James L. Knight Foundation. 2002. Classical Music Consumer Segmentation Study 2002: National Survey [computer file]. Southport, CT: Audience Insight LLC [producer]. Princeton, NJ: Cultural Policy and the Arts National Data Archive [distributor]. Link

Hoping something sticks

Expertise through long-term committment

Raising kids has become a topic of obsession American parents. There seems to be no shortage of advice to be had, much of it conflicting.

It wasn’t always like this, of course. A generation or two ago, kids followed a predictable route of development that followed that of their parents and their grandparents before them. In essence, parents could say to their children: “Just watch what I do; and you’ll become what you will be.” But the post-WWII prosperity and the cultural shifts that followed brought significant upward and lateral mobility. A side-effect of mobility is that it breaks down the formulaic approach to raising kids. If I can be anything I want, then why not actually try? But this often leaves parents with a limited ability to prepare their children for their idealized future.

The fragile economic conditions also weigh heavily on parents. Since the future is so uncertain and parents’ ability to prepare their kids for a livelihood that is dissimilar to their own is lacking, many parents respond by exposing their kids to countless activities. Throwing things at the wall hoping that something sticks. Of course, this leads to burnout and frustration among parents and an unnecessarily harried life for their kids. But more importantly, this isn’t how expertise develops.

Expertise unfolds through long-term committment to a discipline. Trying many activities in hopes of finding one that resonates with a child seems logical, but it turns out to be a particularly bad way to develop real expertise in kids. Interest develops through depth more than breadth. If we skim along the surface of the ocean at high speed, it looks like a boring, desolate place. But if we slow down and dive beneath the surface, the richness of its diversity springs into view. I don’t discount that kids have differentiated interests that result from unique ways in which they’re wired. And parents have to be mindful of unique characteristics of their kids when they select activities. But there’s both a lesson and a meta-lesson to be had by focusing on a smaller range of activities.

The lesson, of course, is the acquisition of a talent or ability that has depth. Kids that have dived beneath the surface are easy to spot. They’re the ones who are in the front, winning competitions. They’re involved. The meta-lesson is about pushing through difficulties, deferring gratification, and respecting commitments. Both are priceless.

Things don’t stick to walls because of some unknown forces. They stick because someone made them stick. That’s what parents do.

Betrayed by language

Orwell, "Politics and the English Language"

The media has widely reported that the Secret Service recently allowed an armed, deranged person to jump over the White House fence and enter the mansion. The agency director, Julia Pierson, quickly disintegrated in the wake of bipartisan pressure to resign.

I don’t know Ms. Pierson. She may have performed well in prior posts. Perhaps not.

But her use of language during her testimony to Congress betrays her as a bureaucrat more concerned with management than leadership. Consider her response to an inquiry about agency staffing:

“I do know we have provided a human capital strategy to Congress at their request.”

No leader who is concerned with the actual effectiveness of her organization in the real world would resort to deliberately obscure terminology in this fashion. A better response would be clearer and more direct. Perhaps:

“We provided Congress with a staffing plan at their request.”

or,

“We submitted a report to Congress on how we plan to staff the agency.”

Finally, a leader does not lapse into passive voice in matters as serious as this. Ms. Pierson testified that:

“It is obvious that mistakes were made.”

Who made mistakes? What was the nature of there errors? How about:

“We failed to respond to a serious threat to the President.”

The passive voice points a detachment from responsibility and a failure of leadership.

Unit testing with Swift and Core Data

The problem

Unit testing with Core Data can be complicated. We want to reduce any dependencies in order to isolate the class under test. But Core Data itself is a big dependency. Graham Lee wrote a couple blog posts[1],[2] several years ago on patterns for testing Core Data applications. He describes two patterns for isolating the the class under test. While Graham prefers to remove the Core Data dependency entirely, I’ve tended to use his second pattern by creating an in-memory Core Data stack that I build up and tear down with each test. I’ve done this for years using Objective-C; but now that Swift has come on the scene, I’ve had to adapt the process somewhat; and I’ll describe that here.

Application test example

We’ll start out by constructing a prototypical Employee/Manager model in a sample app. I’ve called the product (and module) name “Zoom”. This is important to know because we’ll need to prepend out NSManagedObject model class names in the model editor with the module name. Because of what I regard as an Xcode 6 bug, you should not prefix the class names in the model editor until after you’ve generated the class files assuming you want Xcode to do that step for you. If you namespace the class names beforehand, then the NSManagedObject subclass generation function in Xcode 6 won’t work properly.

Entities and NSManagedObject subclasses

With that in mind, create two entities: Boss and Employee. Give the Boss entity, attributes of firstName (String) and lastName (String). Give the Employee entity, attributes of firstName, lastName, salary (Integer 16), and dateHired (Date).

swift core data class nameConfigure the relationships between Boss and Employee. That should be obvious Boss to Employee is To-many and then the reciprocal to keep Core Data happy.

Remember to set the Class field in the Entity inspector; but leave off the namespace if you’re first generating the NSManagedObject subclasses. Your generated Employee class should look like this:

1
2
3
4
5
6
7
8
9
10
11
12
import Foundation
import CoreData

class Employee: NSManagedObject {

@NSManaged var firstName: String
@NSManaged var lastName: String
@NSManaged var dateHired: NSDate
@NSManaged var salary: NSNumber
@NSManaged var boss: Boss

}

and the Boss class should look like this:

1
2
3
4
5
6
7
8
9
10
import Foundation
import CoreData

class Boss: NSManagedObject {

@NSManaged var lastName: String
@NSManaged var firstName: String
@NSManaged var employees: NSSet

}

When generating the subclasses for your model entities, remember to add the files to both the main target and the unit test target. The same goes for the model file itself. Now that we’ve set up the NSManagedObject subclasses for our Core Data entities, we can namespace the classes in the model editor:

swift core data class name

The Core Data stack

In my main application, I’ll just use the templated Core Data stack. It works as a starting point and it also can serve as the in-memory stack for our unit tests. To simplify testing of classes that use Core Data, I start with a base class that sets up and tears down our in-memory stack. We’ll call that class CoreDataTestCase.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

class CoreDataTestCase:XCTestCase {
lazy var managedObjectModel: NSManagedObjectModel = {
let modelURL = NSBundle.mainBundle().URLForResource("Zoom", withExtension: "momd")!
return NSManagedObjectModel(contentsOfURL: modelURL)
}()

lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator? = {
var coordinator: NSPersistentStoreCoordinator? = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
var error: NSError? = nil
var failureReason = "There was an error creating or loading the application’s saved data."
if coordinator!.addPersistentStoreWithType(NSInMemoryStoreType, configuration: nil, URL: nil, options: nil, error: &error) == nil {
coordinator = nil
let dict = NSMutableDictionary()
dict[NSLocalizedDescriptionKey] = "Failed to initialize the application’s saved data"
dict[NSLocalizedFailureReasonErrorKey] = failureReason
dict[NSUnderlyingErrorKey] = error
error = NSError.errorWithDomain("YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict)
NSLog("Unresolved error (error), (error!.userInfo)")
abort()
}

return coordinator
}()

lazy var managedObjectContext: NSManagedObjectContext? = {
let coordinator = self.persistentStoreCoordinator
if coordinator == nil {
return nil
}
var managedObjectContext = NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType)
managedObjectContext.persistentStoreCoordinator = coordinator
return managedObjectContext
}()

override func setUp() {

}

override func tearDown() {
managedObjectContext = nil
}
}

Example test class

We’ll derive our test classes from this base class. For example, to test our Boss class, we could begin with a test case class that derives from CoreDataTestCase:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import Foundation
import CoreData
import XCTest

class BossTestCase: CoreDataTestCase {
var boss:Boss?

override func setUp() {
super.setUp()
let entity = NSEntityDescription.entityForName("Boss", inManagedObjectContext: managedObjectContext!)
boss = Boss(entity: entity!, insertIntoManagedObjectContext: managedObjectContext)
}

func testThatWeCanCreateBoss() {
XCTAssertNotNil(self.boss, "unable to create a boss")
}
}

Conclusion

Creating an in-memory store doesn’t completely eliminate the Core Data dependency; but it reduces the pre-test assumptions considerably and makes for more controlled testing in Core Data applications.


  1. Lee, Graham. (6 September, 2009) Unit testing Core Data-driven apps. Retrieved Septeber 28, 2014, from http://iamleeg.blogspot.com/2009/09/unit-testing-core-data-driven-apps.html

  2. Lee, Graham. (10 January, 2010) Unit testing Core Data-drive apps, fit the second. Retrieved September 28, 2014, from http://iamleeg.blogspot.com/2010/01/unit-testing-core-data-driven-apps-fit.html

Richard Morgan on Kicking the Facebook Habit

Today Richard Morgan wrote an brilliant witty piece “Kicking the Facebook Habit” in the New York Times.

His comments on the reactions of his Facebook connections to his suddent departure are predictable but amusing:

When my friends tried to check in on me, they saw only an Error 404-style page. A typical note from an over-30 friend was “Are you O.K.?” A typical under-30 note was “Did you block me on Facebook?” Their self-centered hysteria only amplified my abstinence.

I left Facebook nearly two years ago, an act that leaves me now with only the most minimal curiosity about what’s happening there.

'Music in Practice' on photocopying

I recently stumbled on the website “Music in Practice” which is a great resource for violin teachers and parents.

One of the articles that caught my attention was “Photocopying Helps Focus” which outlines the ways in which making extra copies of the music can help with practice. Sue Hunt, the author, refers to several ways that photocopying can be an aid to practice. A few caught my eye:

  • Photocopying creates clean copies to use so that cumulative marks on the score don’t cloud what’s really important in practice during the week.
  • You can slice and dice the copies and rearrange them so that just the passages of interest appear on a single page. Although it’s hardly necessary to go to this much trouble, I use a flat-bed scanner to scan the music. Sometimes marks are already on the score; so I use Photoshop to clean up the original images, then I begin to take pieces of the music and clip them into a new document. For example, ViolinGirl is learning “The Two Grenadiers” from Book 2 now. I want her to practice all of the retakes because they all use the same technique (small circle bow at the frog.) On the first page of the new document, I write out the instructions from the teacher and put the passages lined up down the page. It reduces the temptation to just keep playing through to the next phrase. I did the same, then with other types of learning spots, categorizing them into similar applications of technique. It keeps us focused on one technique at a time.
  • For the longest time, I’ve been craning my neck to see measure numbers when we are in a lesson. ViolinGirl’s teacher gives an instruction for a particular passage and I want to make note of that instruction. It’s difficult without the music in front of me; so I’ve begun to bring clean copies of the most recent working pieces to the lesson so that I can mark them up as the teacher makes comments. It’s much easier than trying to verbalize the instructions in my notes. Now I use lesson copies.