humancode.us

An Introduction to Grand Central Dispatch

July 28, 2014

Grand Central Dispatch is an important system library introduced in OS X 10.6 and iOS 4. It provides a set of C API that makes it easy(er) to deal with parallel programming on iOS and OS X. GCD works with C, C++, Objective C, and even Swift.

When you begin exploring GCD, you discover two things right away: its API is terse, and there is hardly anything in the way of introductory materials. Wouldn’t it be nice if there were a gentle introduction to guide you through some basic patterns that you should use or avoid?

That’s what this series of posts is intended to do. I’ve been using GCD since its early days, and I have battle scars to prove it. I hope I can act as a guide to this powerful and elegant library.

Over the next few weeks, I will post several blog posts that deal with aspects of GCD to help you get started, get comfortable, and get creative with the API.

I will be tagging the posts in this series with #libdispatch. Click on the tag to list related posts.

Block APIs are NOT harmful

July 17, 2014

Note: This is a repost of an older post that was published on my tumblr blog. Before I begin writing more posts on the subject of programming, I thought I’d practice by reposting something I’ve already written. This post has been re-edited for clarity.

I take exception to Drew Crawford’s recent post that block-based APIs introduce “harmful” surprising side effects into Objective-C, especially under ARC. Drew’s post calls attention to NSNotificationCenter in particular, but really, any block-based API is susceptible to similar kinds of pitfalls.

I would encourage you to download a copy of Drew’s example code as you read his blog post to understand the problem he’s describing.

Read more…

Moving to Jekyll

July 16, 2014

I’ve been wanting to write more blog posts on the subject of software development and code in general, and tumblr just isn’t cutting it for me, mainly because it’s so ridiculously hard to format and syntax-highlight code in the post.

I’ve been intrigued by static site generators, and I finally settled on Jekyll, hosted on GitHub Pages. Jekyll allows me to have manual control over layout and style, and allows me to write posts in glorious Markdown instead of HTML-in-a-rich-editor.

Plus, code:

@interface Hello: NSObject
- (void)hello;
@end

@implementation Hello
- (void)hello {
    NSLog(@"Hello, world!");
}
@end

Anyway, it’s also nice to get back into hacking HTML and CSS. I hope I learn a thing or two along the way.

You can still get to my old blog hosted on tumblr here. The old posts have been automatically imported into this blog (with mixed results).

Not Yet

July 9, 2014

Copyright ©2014 Dave Rahardja

Carousel Detail

July 9, 2014

Copyright ©2014 Dave Rahardja

Newer Posts