Categories
Development

Regarding Style

RibbitAs I’ve gotten older my coding style has evolved. I’m a fairly verbose coder which can drive some people absolutely crazy but it works for me. It makes code more readable.

Case in point. Something I get questioned about all the time is why do I write false if conditions like this.

if (nil == thing) {
    // Create a new thing
}

Instead of doing…

if (!thing) {
    // Create a new thing
}

Well, that’s easy. My eyes can pick it up instantly. One other thing about that syntax. It’s a hangover from over 20 years of writing C and C++ code. The compiler will bark if you try to a value to zero. In that way it served as a way to make sure you didn’t accidentally make a mistake that could take a while to find. Let the compiler help you where it can.

I really like it more for readability. Opinions vary.

Categories
Social

Twitterrific for iPhone Tips

I’m an Apple fanboy and I’m a fan of Iconfactory Apps. I use Twitterrific for iOS and Mac so I thought I’d share some tips with my fellow Twitterrific for iPhone users.

Two of the things I love about Twitterrific are the nice shortcuts from the timeline view.

Tip #1: Double Tap

No, not rule #2 from the Zombieland Rules List.

While viewing your timeline you can double tap on an item and up pops a shortcut menu. This is super handy for replying and retweeting. I use it all the time. Here’s what it looks like.

Tip #2: Tap and Hold

The second feature I really appreciate, and use all the time, is tap and hold. This works from the timeline and from the tweet detail views. Simply tap and hold a link to see the shortcut menu. Great stuff. Here’s what it looks like.

I use the Send to Instapaper and Copy Link options all the time. Notice they’re placed toward the bottom of the menu. I’m pretty sure the fine folks at the Iconfactory did this intentionally since they’re the options people will probably use the most.

Hopefully you find these tips useful.

Categories
Development

OSAtomic?

Mike Ash: “As anyone who does threaded programming knows, it’s difficult. Really difficult. Threaded execution results in highly unpredictable timing with how multiple threads interact with each other. The result is that code which appears to be correct and passes tests can be subtly flawed in such a way that it fails rarely and mysteriously.

There are many rules to follow when writing threaded code, but the most important one is this: lock all access to shared data.”

If you’re a Windows developer, and have had the pleasure of coding a threaded application, OSAtomic sounds pretty darned familiar, without reading Mike’s article. If your brain instantly went to InterlockedIncrement you’re not alone.

Threading can be difficult. Read what Mr. Ash has to say if you’re new to Cocoa, or new to development. Threads can be your best friend or your worst enemy.

Categories
Development Life

A Living Resume

Eat your own dog food.James Robertson: “One of the things I got asked about was my technical chops – since I’d been working in software promotion, did I still have any useful skills from a development perspective? Well, the blog is a living, breathing example of the fact that I know at least a few things. The code is in the public repository, so it’s easily accessible as well.”

James is a Smalltalker, and a darned good one. He not only promotes Smalltalk but eats his own dog food. His weblog is a living testament to that.

Not such a bad way to sell yourself.