Category Archives: Cocoa

iOS Table View Cells & The Responder Chain

[open star field]

One may be tempted, when created a custom table view cell, to wire up the action of various buttons it contains to the First Responder. This is a horrible idea. Please, don’t do that.

The rational behind this is that the First Responder

… [and break] …

… [cut to a calm Carl Sagan against the Cliffs of Dover] …

The responder chain works by finding the “first responder” along a chain of objects that have opted in to this system. They can be views or controllers on iOS. The limit of the message passed along this chain is that it has exactly one parameter — the sender.

… [cut to an irritated Joe Pesci leaning against a bar] …

So, you see, as you get higher up the responder chain the less context the responder has to act on. Doing this requires an understanding of the context. If I find a UIButton tossing some message up the responder chain, documented nowhere else except in the Interface Builder UI? That sucks. Do you think I’m being funny? You’re chuckling! Yeah. It’s funny. Very funny.

… [cut to the Death Star Throne Room] …

Without the context of an action one can never satisfy the request. Simply sending a message up the responder chain that some sub-item of a view has been tapped doesn’t help make the user’s intention clear except under the most superficial or specifically co-ordinated conditions.

For each step up that chain there is an expectation of implementation that has been overly abstracted by the idea that one can simply toss this decision someplace else. Sometimes that can work. Eventually it falls apart.

Action verbs are cheap. Context is key.

PUNCH! I dare you. PUNCH! You’ve got no idea what or where to punch but, hell! PUNCH!

… [cut to the edge of the Death Star Throne Room Pitfall Railing] …

See how I set up the context?

PUSH.

Context, then action. Action without context is meaningless.

Brent Is Doing It Wrong So You Don’t Have To

My friend Brent Simmons has long been writing at inessential.com. Recently he’s been writing more often, sometimes many times a day, about his experience adding synchronization to my preferred note taking app of choice, Vesper.

Brent writes well. I’ve not asked him but it seems as if this is part of his process. Write the code. Consider the problems. Write them down. Do so publicly so they carry weight.

If you write software then I suggest you keep up with Inessential. It’s a rare treat to have such a plainly expressed narrative of the process behind writing these complex systems.

Objective: Copland 2010

As is our way, like all nerds before us and all the nerds to follow, it is that time where we take a look at the future of our toolset and gnash our teeth.

Ash Furrow kicks us off this time with, “We Need To Replace Objective-C”. Steve Streza follows up and expands in his piece, “Replacing Objective-C and Cocoa”. Brent Simmons then weighed in “On Replacing Objective-C” with his thoughts.

The root of this discussion is best crystallized by John Siracusa’s Avoiding Copland 2010 from back in 2005 (just 35 years after the start of the Unix Epoch). Back in 2011, Siracusa rekindled his argument on an episode of his podcast, Hypercritical. I wrote a follow on piece to Siracua’s episode: Regarding Objective-C & Copland 2010. Personally, I think this entire debate should just be called, “Copland 2010″ because it puts it all in perspective. Here’s a photograph of Siracusa and myself from 2005 soon after he’d posted his original article.

My issue isn’t with the basic premise that if our toolchain stagnates then so does our chosen platform. My issue isn’t with many of the specific suggestions as to what needs improvement. And my issue isn’t with the timeline of doom, the perils of prognostication and it’s certainly not with the authors.

My issue is that I increasingly feel as if we’re being an incredibly poor client approaching a design agency.

We come to the table demanding certain fonts, colours and shapes but we’ve not identified what the actual problem to be solved is. We’ve come with a set of solutions. Each solution fits our notion of what’s wrong and how it can, should and, indeed — must — be implemented, immediately, or we face irrelevancy.

What we want to do is to describe our fantasy gown to wear to the ball, not how the stitching must be applied. Let’s try to communicate what we need at a higher level so we can actually understand the problem space rather than working backwards from the proposed solution space.

In the future our software will need to concisely express operations that may take seconds to complete, if ever, and must do so within strict security boundaries while exploiting the full compute power of the host device.

That’s what our software needs to do. That one sentence captures much of the Copland 2010 argument. Pretty much anything else is venturing off into the weeds. What does concisely mean? What do strict security boundaries entail? Express operations – functionally? (but, still expressed as imperative?) Compiled but concurrent and functional? What if recompiling on the device can use some sort of other computational asset?

My issue is that listing fashionable solutions is small and myopic yet wrapped in the grandeur of a call to revolution.

Define the problem space and attack it.

That’s what design is. You don’t get to pick, “I’m BLUE!” and then make it work. The problem finds you, and then you fix it. All the noise is a string tied between a doorknob and a bad tooth.

Ok, we could automate that. But can we do better by better understanding the problem?