Vincent Gable’s Blog

December 7, 2009

Dot Syntax Solution

Filed under: Cocoa,Design,Objective-C,Programming,Usability | , , , ,
― Vincent Gable on December 7, 2009

Surprisingly, the addition of dot syntax to Objective-C 2.0 has been a major source of controversy. I wonder if there’s some kind of Bike Shed effect at work here: the problem dot-syntax causes is trivial1; while the clarity it brings to code is minor. So it essentially boils down to aesthetics. (For the record, I like the dot, even with it’s current flaws, but I don’t believe it’s worth fighting for).

The Actual Problem

The problem is that when you see a.b = c; you don’t know if it’s:

  1. Assigning the b field of a struct to c. This basically compiles down to one move instruction.
  2. Invoking the -setB: method on an Objective-C object. By convention -setB: should update the b property of the object to hold the value c, and nothing else. But it might have side effects, or be really slow.

A Solution

Using a different symbol to access Objective-C properties would remove all ambiguity. Nobody would mistake a@b = c; as assigning to a C-struct. It’s clearly an Objective-C construct.

But personally, I’m not a big fan of the @ character. It’s ugly; it’s noisy; there’re just too many lines in it. I think U+25B8 ‘BLACK RIGHT-POINTING SMALL TRIANGLE’ would make a better choice,

obj▸property = value;

And since ‘▸’ can’t be part of a valid C identifier, you can basically preprocess your code with s/▸/./, then compile it with existing tools.

Of course, it doesn’t matter what character(s) is picked, so long as it’s clearly different from existing C syntax; and you have a way of replacing it with a . before building it.

1 I’ve heard experienced developers complain that dot-syntax = a steeper learning curve for newbies, and that it can be confusing, but I haven’t actually seen one come out and say ‘I spent X hours debugging a problem that I couldn’t see because of it’. The fact is, any situation that dot-syntax would obscure is already pathological. In the end I just can’t see dot-syntax mattering much.

February 23, 2009

Laptop Mats

Filed under: Announcement,Design,Usability | , ,
― Vincent Gable on February 23, 2009

I just really want somebody to make a good portable cooling pad for portable computers.

Laptops1 are too hot to be used on a lap. This Penny Arcade comic says it best, if a little crudely,

Using this Macbook is like putting my dick in a George Foreman Grill. Okay? It’s like making a penis panini.

There’s a real need for something to keep your your lap cool. You can buy gel cooling pads. But I have reservations about them. The biggest is the weight of the gel. And according to reviews, eventually the pad absorbs enough heat to turn into a hot pad.

My solution is inspired by sushi mats:

415ANWJ8X6L._SL160_.jpg

It’s a very simple idea really, instead of bamboo slats, you use hollow aluminum tubes in the mat. That gives you an extremely light pad that’s easy to roll up and carry anywhere. It keeps the hot computer off your lap, draws heat away from the computer. (Aluminum has been used to make heat sinks for decades.)

Oh, and just in case you were wondering I’m using a book to protect my lap as I write this. But books are heavy, so I only carry one if I need to refer to the book.

If you have a better way to stay cool while working on the road, please share!


1
I’m counting netbooks (inexpensive, ultraportable but slow computers) as separate from “laptops”. Certainly many netbooks work just fine on top of the lap. But some people will always need more powerful laptops.

Powered by WordPress