Category Archives: Foundation

Objective-Curry

Sadly it’s not called Schoenfinkeling, but that’s the name of the person who noticed that there’s no reason to ever have a function with more than one argument. What you think is a function with two arguments is actually a … Continue reading

Posted in code-level, Foundation, OOP | 1 Comment

When single responsibility isn’t possible

This posted was motivated by Rob Rix’s bug report on NSObject, “Split NSObject protocol into logical sub-protocols”. He notes that NSObject provides multiple responsibilities[*]: hashing, equality checking, sending messages, introspecting and so on. What that bug report didn’t look at … Continue reading

Posted in Foundation, Java, ruby | Leave a comment

On designing collections

Introduction This post explores the pros and the cons of following the design rule “Objects responsible for collections of other objects should expose an interface to the collection, not the collection itself”. Examples and other technical discussion is in Objective-C, … Continue reading

Posted in Foundation, OOP, software-engineering | Comments Off on On designing collections

Class clusters, placeholder objects, value-oriented programming, and all that good stuff.

Have you ever seen this exception in your crash log? 2012-05-29 17:55:37.240 Untitled 2[5084:707] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘*** -length only defined for abstract class. Define -[NSPlaceholderString length]!’ What’s that NSPlaceholderString class? Leaving aside NSMutableString … Continue reading

Posted in code-level, Foundation, software-engineering | Comments Off on Class clusters, placeholder objects, value-oriented programming, and all that good stuff.

Why we don’t trust -retainCount

I’m pretty sure @bbum must have worn through a few keyboards telling users of StackOverflow not to rely on the value of an Objective-C object’s -retainCount. Why? When we create an object, it has a retain count of 1, right? … Continue reading

Posted in code-level, Foundation, iPad, iPhone, Mac | Comments Off on Why we don’t trust -retainCount

On counting numbers

While we were at NSConference, Alistair Houghton told me that he was working on static NSNumbers in clang. I soon thought: wouldn’t it be nice to have code like this? for (NSNumber *i in [@10 times]) { /* … */ … Continue reading

Posted in code-level, Foundation | Leave a comment

On NSInvocation

I was going to get down to doing some writing, but then I got some new kit I needed to set up, so that isn’t going to happen. Besides which, I was talking to one developer about NSInvocation and writing … Continue reading

Posted in Foundation, iPad, iPhone, Mac, software-engineering | Leave a comment