About | ACP | Buy | Industry Watch | Learning Curve | News | Products | Search | Substack
Home » Learning Curve » Developers Workshop

Inessentially Yours

The art of living in a walled garden.

Get It

Try It

Mac developer Brent Simmons had an epiphany. It's about curly braces.


It's got to do with blocks - anything enclosed in curly braces. A single statement always attaches to a conditional expression, but the parser would be woefully confused if you wanted to add further statements - unless of course you added curly braces.

So this is OK:

if (expression)

But this isn't if you want both statements attached to the expression.

if (expression)

Because C involves context-free parsing, the above would be more readily written as follows.

if (expression)


Something right out of CS 101. Grouping statements. But evidently it has Brent in a painful quandary.

He gets down dirty into detail here.

And, as a relentless cutter, a simplifier by temperament, I like it because it means I can do without a couple braces. Though it doesn't make a difference to the generated code, it does means less actual characters in the source file, and it saves a line for the closing brace.

And it's all true and very sympatico. The simple truth is you don't need braces for that first variant, and that's not only by design, but also bleeding obvious.

But hold on, for Brent's changed his mind. He wants to give in. He now wants to write like this instead.

if (something) {

Note the indentation - it seems important to him.

His next comment is deafening to the 'community' in general.

Second reason: it's likely that I was the last Cocoa coder to omit the braces on these statements...

Which is not true at all of course. But there are indeed limits for Brent. The following (Berkeley style) is something he says he will never ever do.


But that's only the original K/R way of coding. It permeates old Unix (and even MS-DOS) code. [It wasn't found much in old Apple code because they were still using Pascal. That's far far worse. Ed.]

'I absolutely cannot bear that extra line for the opening brace. It gives me gas', writes Brent. That's terrible to hear of course. But so what about the closing line in the style he now adores? He goes on.

I'll often - usually, even - put a blank line there, but a blank line is nice and clean. A line with just an opening brace is like a fingernail on the page.

No taking away from aesthetics. They're important. And well written C code is in itself a work of art - beautiful to behold. But still and all.

'(And it ruins the clean left edge of - to open and } to close.)'

OK now we're going a bit too far. And the reader will see where this is all leading.

Brent (yes he's still talking about braces) now suggests another alternative.

-(void)doSomething {


Note the blank line before the function call. Sigh. He ends with:

Reasonable people may disagree. It's a cinch that unreasonable people will also disagree.

That covers all the bases!

Much Too Much Ado

The entire web page for Brent's startling screed takes 3798 bytes on disk. The actual content - the screed itself - is a walloping 1801 bytes and an impressive 329 words.

So what's the point? What's the point about writing about this? What's the point in a screed about coding styles in the first place?

It's like this.

CNN could announce the end of the world tomorrow, get backed up by the BBC, AJE, RT, and Fox, and the Maccies would still be writing about the gradient in icons or the radius of curved corners on document windows - or about how to best style one's own curly braces.

Those who first checked out Apple at the turn of the Millennium - waiting until a substantial technology (NeXT) made its way to Cupertino - found that those within the walled garden were totally oblivious to the world around.

That the world around was crumbling under the onslaught of malware was something the Maccies evidently knew little about. That this situation threatened the very use of the Internet and personal computers wasn't either something that worried them.

That the world around today is visited by other threats is of equal importance: none. That Apple are one of the infamous nine IT companies helping the NSA cull data on private people is ignored. That Apple have a data centre underway in North Carolina that outwardly looks a lot like the NSA centre in Bluffdale hasn't phased them.

You can look all you want for articles from the 'community' on these threats, on what's happening to the Internet, to people, but you won't find much. What you will instead find is baseball scores, articles that discuss other articles that discuss, sneak product screenshots that most often turn out to be bogus, and so forth.

Ours is a tenuous world, and people everywhere - even those living in walled gardens - need to take a look around and be a part of that world. Watson inventor Dan Wood had nothing against commenting (and caring) about the world around, but that's not an attitude that's popular 'in there'.

They even went bat shit insane over a technical note, perhaps written by Avie Tevanian, that advised developers to make their document formats as platform-independent as possible. This from a 'community' always going gangbusters when they can read that their 'platform' has gained market points, but going equally rabid if anyone suggests releasing a hardware-independent OS to get more people the F off Windows. Even their hardest nosed advocates don't seem to get it, saying that Mac vs Windows is a choice of 'taste' rather than security.

OS X as a platform is the easiest way to get people to leave Windows and malware behind and thereby help make the world a safer place. It's the attitudes and the intellectual wastelands inside the walled garden that put people off. What price freedom?

For more and more will opt for hazarding trojans if something doesn't give.

Beyond that, it's not only malware we have to worry about today, and it's time for the Apple faithful to start asking the important questions about the company's work with the NSA in particular and about their respect for privacy in general. We can worry about curly braces another day. If we have time.

See Also
Assange Defence Fund
WikiLeaks: Support WikiLeaks
The Police Protocol (Translated)
Rixstep: JA/WL (Assange/WikiLeaks)
Rixstep: Assange/WikiLeaks RSS Feed
Radsoft: Assange/WikiLeaks RSS Feed

About | ACP | Buy | Industry Watch | Learning Curve | News | Products | Search | Substack
Copyright © Rixstep. All rights reserved.