Use parens as a hint to Xcode's autoindent

Sometimes I wish Xcode's autoindent would do things a little differently. For example, I like to use C's ternary operator:

NSString *label = [self someBooleanTest]
                  ? [self methodWithASortOfLongishName]
                  : [self anotherMethodWithALongishName];

Unfortunately Xcode (at least Xcode 3) autoindents this code like this:

NSString *label = [self someBooleanTest]
? [self methodWithASortOfLongishName]
: [self anotherMethodWithALongishName];

As a workaround, I use the fact that Xcode likes to align things under parentheses and other opening delimiters:

NSString *label = ([self someBooleanTest]
                   ? [self methodWithASortOfLongishName]
                   : [self anotherMethodWithALongishName]);

This can help with other compound expressions as well:

BOOL rectContainsPoint = ((point.x > NSMinX(rect))
                          && (point.x < NSMaxX(rect))
                          && (point.y > NSMinY(rect))
                          && (point.y < NSMaxY(rect)));

Side note: The reason I parenthesized the subexpressions of the boolean expression above is so I can easily select a subexpression by double-clicking on a parenthesis. This makes it easier to eyeball for correctness. I don't always do this — I probably wouldn't have done it with this particular code — but when I do it's more for this reason than for protecting myself from an operator-precedence mistake.

I have other indentation quibbles that I don't have workarounds for. I'll submit Radars for them when I get around to checking that they're still present in Xcode 4.

UPDATE: Parentheses can also help with autoindenting of blocks:

volumeCalculator = (^(float width, float height, float depth)
                    {
                        return width * height * depth;
                    });

Without the parentheses, the above would look like this, which makes less sense to me:

volumeCalculator = ^(float width, float height, float depth)
{
    return width * height * depth;
};

On the words "respectful" and "appropriate"

From what I can tell, Dave Winer is not a foolish person, but this piece defending his take on Richard Stallman's recent remarks makes very little sense.

Please note that what follows is not meant to defend or praise Steve Jobs, or to attack Richard Stallman, or to imply Dave Winer is a bad person. It's directed purely at Winer's poor logic.

Winer wishes to defend his claim that Stallman was being "both appropriate and respectful" toward Steve Jobs. He assures us that he knows what "respect" means:

If you read my web writing going back to the beginning, you'll see the concept of Respect in a lot of the pieces. I really worked this one through.

First, appeal to authority is weakest when one uses oneself as the authority. Just make your case and let readers judge for themselves how well you worked it through. Second, he immediately follows by telling us:

Respect means you respond to who the person really is, or what the object really is, not what you imagine it is.

That is not at all what respect means. The quality Winer describes is freedom from illusion. You can imagine incorrect things about a person and direct your respect at that misguided impression. It's still respect. I suspect what Winer means to talk about is freedom from pretense, because he argues that

when Stallman says that Jobs made computers that put users in a tightly controlled box ("jail made cool"), he is being respectful. It's very true!

No. Stallman is being honest. He sincerely means what he says. However, he says it in the form of a backhanded compliment. To defend the "compliment" part as respectful while ignoring the "backhanded" part is a gross sin of omission.

Now for Winer's other word, "appropriate":

([Stallman] also sees a man who died, and responded to that too. It helps you feel the humanity of Stallman, he has this much in common with Jobs, he too will die.) Stallman is telling you about Stallman through Steve's life. Perfect. Totally appropriate (the other word) because that's exactly what we all do, whether we admit it or not.

Setting aside the absurdity of this reading of Stallman's words as some sort of poignant reminder that we are all brothers and sisters under the skin — setting that aside — factual correctness does not make a statement appropriate any more than it makes it respectful. Stallman does address the sad fact of death, and I think it is fair to remind people of this. But he does not do so in an appropriate way.

The key part of respect is consideration for the dignity and feelings of other people. The key part of appropriateness is consideration of social norms. These qualities are related to honesty and factual correctness but to confuse them as being the same is at best badly mistaken.

There's a joke that goes: "I'm not saying so-and-so's mother was a whore; I'm just pointing out she had money and I never saw her at night." I defy Winer to imagine this factual statement applied to any deceased person and find it respectful or appropriate in any sense other than admiration for the mother's entrepreneurial spirit.

RIP

There are different kinds of heroes, and very few truly historic ones. As heroes go, Steve Jobs was far and away in a class by himself.

I understand a little now how sad people were when John Lennon was killed. Of course in this case there isn't the shock factor — we've known for a long time that Steve's days were numbered. But it still comes as a blow to lose an icon that so much of my life has revolved around.

Steve made many, many marks on history. Now we will mourn for a while. And then we will carry on, because of the mark he made on us.