In my previous post I presented a way to implement lazy properties.
It was a bit macro-heavy though, and looked kind of messy. I wondered if there was another way. Objective C is marvellously dynamic and introspective. Shouldn’t we be able to do something clever at runtime to achieve what we want?
In a word, the answer is yes, we can…
In my previous post I showed a relatively clean way to implement lazy properties generically using the dynamic runtime.
So how does this dynamic implementation actually work?
There comes a time in every programmers life when all the fancy symbolic debuggers let us down, and we have to fall back to that old standby, logging. Or to give it its full name “printf debugging”!
Actually there are lots of reasons why logging can be useful. Sometimes we have what I like to call a “heisenbug” - where the very act of stopping in a debugger to look at the problem causes the problem to disappear. Sometimes we have other timing issues. Sometimes we simply have too much data to analyse in real time, and we need a chance to process it or manually sift through it later.
In these cases the typical solution is to insert print statements into our code which output some text to the console or a file. In C this is typically printf(), or perhaps fprintf(). In Objective-C, we use NSLog instead.
Ambientweet 1.0.1 is on it’s way, and has been submitted to the Mac App store today for review.
It brings with it a slew of syncing/caching updates which should result in more reliable fetching of tweets (especially after it’s been running for a while), and a faster startup.
The posting interface has also been improved - it looks more like a normal tweet window now, and it correctly deals with long urls, allowing you to post tweets that appear to be longer than 140 character, but which will be under the limit after Twitter has shortened the links.
It’s hard to make good products if you’re working in a vacuum. That’s why one of the things that we like most is hearing from people who’ve used our software, even if the message is “it’s broken”!
So if you send us a good suggestion, or a report of a genuine bug that we didn’t know about, there’s a good chance that we’ll send you a free license in return.
No promises mind you - if you send fifteen reports, each about an individual spelling error in the manual, then you probably won’t get fifteen licenses back :)