inessential by Brent Simmons

December 2015

How to Solve Tabs vs. Spaces Forever

Code is a tree structure, but we use text editors to write and edit code.

Picture this bit of Swift:

if let x = foo() {
    bar(x)
    moreThings(x)
}
someOtherCode()

The braces are there to make the structure explicit, and the indentation is there for human-readability. Picture this same bit of Swift written using a tree structure editor — an outliner:

if let x = foo()
    bar(x)
    moreThings(x)
someOtherCode()

No braces needed. You can’t see it in the example above, but the indentation isn’t tabs or spaces — it’s part of the UI of the outliner.

You also can’t see how easy it is rearrange code. To move the entire if let… section, you’d grab that line and move it (via mouse or keyboard), and the entire block of code (before someOtherCode()) would go with it.

You can also expand and collapse things to get a high-level view, and drill down into detail when needed. (Code folding gives you some of this, but it’s always been a poor substitute for an actual outliner.)

* * *

One of the arguments against using an outliner to edit code is that code wouldn’t be in a plain-text format, and it’s wise to store things like code in a plain-text format.

Well, it’s easy enough to translate plain-text code to an outline and back. The plain-text format would include braces, and it would use tabs or spaces (whichever) for indentation.

You could still use your favorite SCM and diff tools and everything else with that code. You could still collaborate with people who prefer a text editor.

* * *

Another possible argument against using an outliner is that nobody’s ever tried it, and so we don’t know how horrible it would be in practice.

This argument isn’t true. I wrote most of my code in an outliner for eight years (when I was working on UserLand Frontier). And I miss it every day. Writing code in an outliner is the exact opposite of horrible. It’s marvelous.

I wish Xcode had an outline mode.

PS These days I work on OmniOutliner for Mac. Because I learned to love outliners from writing code in an outliner.

The Hillary Landslide

If Trump wins the nomination — which is more likely every day — then Hillary Clinton could win all 50 states.

Democrats might gain both houses of Congress, because the presidential candidate has an effect on Congressional and even state and local races.

As a Democrat, I should be ecstatic at the thought of such a landslide. But I’m not.

* * *

I’m not ecstatic because I’m an American.

In modern times both parties have nominated some awful people, but none so extreme that they’d fit better as a National Front candidate.

Think about how other nations and people around the world would see us then. Think about how we’d see ourselves.

Even if he loses big — the biggest and best loss ever — there’s no going back. We will be a nation where one of the two major parties nominated the favorite candidate of white supremacists.

If you’re a Democrat, you might blame them, those Republicans, for this. But that’s not right: it’s the fault of the entire American people.

* * *

Same thing holds for Ted Cruz.

(“Lady Nixon,” I heard him called. Which is completely unfair to ladies and to Nixon.)

Group Communication App Models

Because I worked on Glassboard, a group communication app, I have an interest in different solutions to this problem.

Glassboard was based on the Facebook model: it had posts-and-comments with newest at the top. It was asynchronous rather than real-time (though it was often fairly close to real-time).

Our reasoning was sound. Facebook was hugely popular, and we wanted to use a model that people were familiar with. We decided asynchronous was fine because it was a mobile app — and people don’t just sit on their phones all day long. (And because Facebook wasn’t real-time either.)

* * *

There are other models we could have used. I wanted to emulate Twitter. That would have meant a flat list with no comments — but a post could have been a reply, and there would have been a way to view just the replies to a given post.

This still would have been newest-at-top and it wouldn’t necessarily have been real-time (though, again, it could have been close, since super-fast-async gets close to real-time).

Glassboard wasn’t a success, and I suspect even this Twitter-like Glassboard wouldn’t have been a success either.

* * *

Enter Slack. I think it may be the proof that there’s just one model that clicks for people doing group communication: chat. Chronological order. Real-time. Small, one-sentence-sized message-entry box at the bottom.

I don’t mean that Slack’s success is inevitable because of its model — but I believe that that model may be necessary. Had Slack worked like Glassboard, or like my hypothetical Twitter-like Glassboard, it would not have succeeded. (Is my theory.)

In other words, people like chat, and everything else is too much trouble and not enough fun.

* * *

If I can convince myself of this theory, then that small part of me that still wants to build a Twitter-like Glassboard app can finally shut up.

PS Warning: I’m not looking at Twitter until after I see the new Star Wars movie. It could be weeks. This kind of sucks because Twitter is the modern comments section, and this means I won’t be looking at comments. But, yes, it’s rather important to me to avoid spoilers.

PPS Also: I’ve replaced Twitter with Slack for many uses. But that’s another topic.

Suspended Ledes Suck

Suspended ledes serve no purpose but to demonstrate the writer’s cleverness, and I get angry every time I read one.

(A suspended lede is where the thing-being-talked-about is withheld right at first. Some one or a few provocative sentences, designed to grab the reader’s attention, appear first — and then there’s the big reveal of the actual subject.)

* * *

This post, rewritten with a suspended lede, might have looked like this:

I hate it with the heat of a thousand white-hot stars on a summer afternoon, that overplayed gimmick, that tired writing tic that does nothing but draw attention to the writer’s cleverness.

Wow! What’s he talking about?! This is so danged interesting that I must keep reading! What a great writer!

The suspended lede.

Oh! Of course! That totally fits! What a great writer!

Puke. It’s so pukey.

* * *

Respect your readers: tell them the subject right up front. Write well enough to keep their attention. Don’t draw attention to your own cleverness.

More Scenarios

Rubio wins outright

Clinton probably wins the general election.

Cruz wins outright

Clinton probably wins the general — but first the nation endures a campaign where one of the two major candidates is an Actual Fascist.

Trump wins outright

This is much like the Cruz-wins-outright scenario. Bad for the country, but at least Clinton probably wins.

Trump runs as a third-party candidate

Cruz or Rubio might win outright, or a combination of deals and shenanigans at the convention gives the nomination to someone besides Trump.

Trump then declares that the Republican Party stabbed him in the back — and he might be right — and that that justifies his running as a third-party candidate.

Clinton probably wins in a landslide, but first the country endures one or possibly two Actual Fascists on the ballot (Cruz and Trump).

This could result in a permanent right-wing nationalist/nativist party like the National Front in France. The Make America Great Again party.

If that happens, look for that party to eclipse the Republican party in just a few cycles. It’s not just about numbers — it’s also about passion. These people are more passionate than old-fashioned Republicans.

Then we’d be back to a two-party system: Democrats and Make America Great Again. You may think our politics are screwed-up right now — but you’d be wrong to think they can’t get worse. Much worse.

(Which only strengthens Trump’s party. Whenever there’s gridlock, look for people to support the party of the easy answers, the party that rails against DC insiders, the party that claims that real leadership can cut the Gordian knot of constitutional governance.)

Perhaps it’s more likely that Trump’s run would be a one-shot deal. There would be no enduring third party.

But I think it’s self-evident that the support for such a party is there, and someone with charisma, money, and megalomania could build it. Someone exactly like Trump.

All he needs is a semi-plausible justification — and not getting the nomination, for whatever reason, is cause enough.

The Nightmare Scenario

The Republican presidential candidates can be divided into two categories: Lying Panderers Who Are Deeply Wrong about Pretty Much Everything (LPs), and Actual Fascists.

LPs

  • Marco Rubio
  • Jeb Bush
  • Carly Fiorina
  • Chris Christie
  • Lindsey Graham
  • Rick Santorum
  • Mike Huckabee
  • John Kasich
  • Rand Paul
  • George Pataki
  • Jim Gilmore

Actual Fascists

  • Donald Trump
  • Ben Carson
  • Ted Cruz

(Note: I waffle on Huckabee. Perhaps he should be listed in Actual Fascists — but it doesn’t matter, as we’ll see in a second.)

Chances

There’s another way to categorize the candidates: those who have no chance to win the nomination and those who might win.

No Chance

  • Jeb Bush
  • Carly Fiorina
  • Chris Christie
  • Lindsey Graham
  • Rick Santorum
  • Mike Huckabee
  • John Kasich
  • Rand Paul
  • George Pataki
  • Jim Gilmore
  • Ben Carson

Bush is a remarkably awful candidate. Fiorina gets some support after each debate, and then it vanishes as everybody forgets about her. Christie is a mean kid from New Jersey. Graham doesn’t excite anybody but John McCain. Santorum is a whiny has-been. Huckabee no longer seems like the nice evangelical that people liked last time he ran. Kasich is borderline not-insane, which is disqualifying. Paul doesn’t like killing people nearly enough. Pataki has a weird name and he’s from New York. Gilmore is completely unknown. Carson makes even crazy people worry about his mental faculties.

This leaves…

Might Win

  • Marco Rubio
  • Donald Trump
  • Ted Cruz

If their chances are equal, then that means there’s a two-thirds chance that the Republican nominee will be an Actual Fascist.

But their chances may not be equal. Slate posted a piece on Rubio that suggests he’s pretty bad at running for the nomination.

There’s your nightmare scenario. All it takes to get an Actual Fascist as the nominee is for Rubio to suck at this. And there’s some indication that he does.

Nightmare Scenario, Part Two

Let’s give the Republican nominee a made-up name so we can refer to him: Crump.

Crump wins the nomination and starts running a general election campaign against Hillary Clinton, the Democratic nominee.

Clinton is kicking Crump’s ass all over the map (except for the South, and even there it’s close in a few states).

And then Something Happens. Could be something international, could be something with the economy, could be a scandal, could be a combination of things — we don’t know. But this Something sticks to Hillary and she loses the general election.

Here’s the thing: sometimes something does happen. Not always, but sometimes. And you can bet that there will be legions of well-funded people trying to make something happen.

And then we have President Crump, an Actual Fascist.

What separates where we are right now from that outcome is not damn much.

I’m Harping on This

Look at the Finder for a second. Look at Mail. Open your Safari bookmarks. Look at Xcode’s sidebar.

In each case you have a tree view of different things. Under the hood, that view is backed by a data structure which contains different things.

Now, those different things have some things in common — an icon and name, for instance. But they’re otherwise quite different.

* * *

In the bad old days you’d make some kind of subclass for all of these things. Call it ListMember. Your Folder and File class (or whatever) would descend from ListMember.

But these days we’re smarter: we use protocols. There’s no reason Folder and File should descend from the same class — they’re almost entirely different, and inheritance is a pain to deal with, so we use protocols instead.

And we’re happy. It works great.

Until you realize that, in Swift, you can’t do this.

This comes up all the time in my code. I want to love Swift — and do, in many ways — but every time this comes up I want to go back to Objective-C.

Is it just me that has this issue? It seems like it’s a massively common problem. Is everyone but me doing things the old-fashioned way (via inheritance) and just not talking about it?

Face Value

If Rubio, Bush, or Cruz — or any candidate except for Carson — had the consistent and strong lead in the polls that Trump has had, we’d be talking about the primaries as a coronation rather than as a contest.

Because Trump is a clown and a huckster, because we believe there’s a sane Republican party establishment that has actual power, we trick ourselves into dismissing his chances.

We shouldn’t. That’s not how this works. If he gets the votes, he gets the delegates and he gets the nomination.

* * *

Just as the white demographic shrinks, the angry racist white demographic gets more vicious. And Trump’s message to them is clear: Take your foot away from the brake pedal. Unbuckle your seatbelt. Run all the red lights. Just gun it.

That’s how we’ll make America great again.

Nothing he has has said has hurt him, and it’s likely nothing will.

The craziness he’s playing with is older than democracy. And, to be fair, he’s not the first Republican to play with this. Sarah Palin was there before Trump. The Tea Party is their party. Years ago there was the John Birch Society. It’s nothing new, but Trump has taken it to a new level.

Rational adults know how dangerous this craziness is.

And telling the crazies that there are no limits, that nothing is off the table — that, in fact, the only way to fix the country is through previously-unthinkable policies — is to harm the country.

It further polarizes our politics. It leads to hate crimes. It erodes our moral standing in the world (already so damaged by the Iraq war) and our ability to lead. It provides ready-made fodder for every terrorist recruiter.

Trump is already hurting the country. Getting the nomination — which is utterly possible, perhaps even likely — would hurt the nation yet more.

And if he can get the nomination, he can become President.

Don’t pretend to yourself that he doesn’t actually want the job. He wants the job.

* * *

Trump is not best-understood as a pop-culture phenomenon. We have to take him at face value. He’s a candidate, and he’s winning.

On Apps that Get Acquired

Mailbox, which had been acquired by Dropbox, is all done.

The news was met on Twitter by people complaining that you can’t rely on apps that get acquired, since they usually get shut down.

Here’s the thing, though:

Apps that get acquired don’t last. Apps that don’t get acquired also don’t last. (Exceptions are rare.)

Consider the Google Graveyard, for instance. Or Everpix.

Or consider Instapaper, which was acquired and is still going strong. Or NetNewsWire — acquired twice, and still coming out with new versions. (Yes, there was a bit of a break, but it’s back.) Consider MarsEdit. Consider Unread.

When deciding whether or not you can trust an app to stick around, you can’t go by whether or not it was acquired.

You also can’t go by whether or not it’s open source, because open source apps get abandoned.

You can’t go by size of company, because big companies like Google or Apple will retire apps, and small companies will fail — or switch their attention to the app that makes them money but isn’t the one you use.

There are some companies you can rely on: Bare Bones, Panic, and Omni (my employer), for instance. You can count on Apple to continue to provide a web browser, email app, and IDE. You can count on Google to have a search engine.

But, after that, every situation is unique. Getting acquired may be the thing that keeps an app alive, or it might be the thing that kills it. Or it might keep an app alive just a little while longer.

In other words: just going by acquired-or-not isn’t actually useful.

Low-Hanging Fruit

I got email from my Dad where he describes a bug in Mail on El Capitan and how he solved it by going back to Yosemite.

I was never able to get Mail to work. In the end, it was a resource hog. Somehow between Yosemite on September 28 and yesterday, my available storage space went from 71GB to 3GB (on a 320GB hard drive). For the last week and a half, I could not even open mail with El Capitan. Even in “safe” mode, I could not get Mail to work.

…So, I am living with Yosemite, and it works fine.

* * *

Last night I edited the Safari bookmarks on my development machine. The changes didn’t sync to my laptop.

I gave it overnight — they still haven’t synced. I tried turning Safari syncing on and off, on both machines, and that didn’t help. I ended up making the changes manually on my laptop to match my development machine.

* * *

A week ago I wanted to stream the latest Doctor Who to my laptop. I launched iTunes and started watching. It got about a minute in — and then it stopped. I clicked some buttons, but nothing helped. It was stuck.

Finally it occurred to me that perhaps something was using my bandwidth and preventing streaming from working. I was right: it was iTunes — the same app on the same computer — downloading a bunch of podcasts. I paused the downloads, and then streaming worked.

Why wouldn’t iTunes prioritize streaming? Surely it could notice that someone is watching a thing, and notice that it’s stuck, and then just pause other downloads. Not everybody is going to figure out how to deal with this manually.

* * *

Every day, on multiple computers, in Notification Center, I have to click to allow Weather to use my location. Why would it forget that I already said yes?

There’s a reason, I’m sure, and I bet there’s an easy fix.

My point is that this shouldn’t be allowed to get into a state where it’s annoying.

* * *

So we have Apple Watch and Apple TV now. What I’m hoping for — what I’m nearly begging for, more as a user than as developer — is that Apple spend a year making things better. Nothing new. Just make things work better.