The Elegant Chaos Blog

February 03, 2010

Day two started with an illuminating session by Jeff LaMarche about the Objective-C runtime, and some of the nice dynamic and introspective things you can do with it, such as iterating through your own properties, methods, etc. A couple of days ago in Drew’s concurrency workshop I was thinking about the need for some good Objective-C wrappers for OpenCL, as there’s a lot of boiler plate setup code that you have to do. It’s there for flexibility, but probably you do the same thing for most apps, so why not wrap it in some simpler objects. Some wrappers probably already exist somewhere, but it struck me that one of the techniques Jeff was describing would be perfect for supporting OpenCL kernel parameters. Instead of having to write code to poke the parameters into the kernel, wouldn’t it be great to just be able to subclass an OCLKernel class, define some properties on it, and automatically have setters implemented which loaded the property values into OpenCL, and getters which retrieved the values.

Next up was Andy Finnell, giving a session that was supposed to be about Core Image, but was actually more about OpenCL. Everyone reported that this was an interesting session, but I sort of got distracted because I was starting to hack together the OpenCL wrapper classes that I’d thought of in the previous session (I’ll post them up when I’ve done them). Having said that, if there’d been more actual OpenCL in Andy’s presentation I would probably have been drawn back in to it, but actually he mentioned himself that he’d wrapped the calls in a class hierarchy, and went on to focus on the physics, which whilst interesting wasn’t really of much general use. In the end, from what I heard, it was more about the physics of watercolour pigments and their interaction with paper - which whilst interesting, wasn’t really what I was there for!

Next up were two half-length sessions thrown together at short notice because one of the other speakers had to drop out.

First a quick overview of some source control systems by Dave Dribin. This was a tough job in such a short time, and I felt that it was a bit light on the right details. He spent too long on the purpose and history of version control, and not enough time on a discussion of the idioms that we use in the real world, and how they do or don’t fit into the models provided by Svn, Git, Mercurial or Perforce. Not that the history and purpose isn’t interesting, but in half an hour you can’t really do it justice on its own, so it was probably better to focus on telling people who understand version control and use one every day how the one they use compares to the other major options. I found this frustrating because I use a very large Perforce system at work (it’s pricey, but excellent, and I’m not convinced that the other systems could do what we do with it), and run a Subversion server at home (which is simple, but I want to change to something else, probably git or mercurial). What I really wanted was answers to some fairly complex situations that happen in the real world - like “how well can you manage multiple concurrent release branches”, “how does it cope when you have twelve devs continuously hacking on a branch”, “how well does it deal with large amounts of data - e.g. graphics assets”, and “how does system XYZ recommend managing your own shared library modules that are used by more than one project that you also have under source control?”. None of which were really answered.

This was followed by a very whistle stop tour of code signing from Graham Lee. Although brief, this was actually useful as he told me how to do something that I didn’t know how to do before. He delivered it with his customary humour, and the session was most notable for re-christening Wolf Rentzsch as “The Dog Spanner”.

After another excellent lunch we had our final “proper” session, from Aaron Hillegass, on data persistence. He started with an excellent set up, posing some interesting questions about how relevant the file system is any more, and whether “the file” is actually dead, to be replaced largely by the data cloud. Quite possibly, he suggested, our local machine hard drives are just local caches from here on in. I think this is a great topic which could have been explored further - for example, if files on our local hard drive are just caches, shouldn’t we be trying to find ways to structure them better so that they can be synchronised with the cloud in a non-monolithic way. One big fat 10Mb file is a bit hard to sync unless you’ve got a detailed schema describing the internal structure, and permission to mess with it. Anyway, I think that side could have been explored further, but Aaron switched tack somewhat to talk about the BNRPersistence framework that he’s created. Which was an interesting topic in it’s own right.

Finally, we had the “Cocoa Rumble”, which was a light hearted competition between three teams composed jointly of the session presenters and volunteers from the crowd. I didn’t really feel that it worked that well this year, despite generating some good presentations at the end. Somehow I don’t think we’ve yet managed to find a way to end NSConference which matches the old “Stump The Experts” sessions at WWDC (which were kind of cool back in 1993 when I first went, and still good fun back in about 2002 when I last went!).

So there you have it - two days of great Mac related sessions. I’ve learnt a fair amount, met some nice people along the way, and had a splendid time. I’ve eaten far too much, and drunk lots of bad beer and bad cider. And tomorrow, there’s another whole day of iPhone stuff. Phew…

more...

Speaking to various folks at NSConference, I realised that there are quite a few regular developer meetings around the country, in addition to the one that I used to organise in London (which still exists but has mutated into the NSCoder london night).

I figured that it would be handy to list them all in one place, for anyone who might find themselves in a strange town for a while in need of geek-based social contact…

I’ve updated my uk-mac-dev-meeting page accordingly, so that it now lists all of the ones I’ve heard about.

If you know of one I’ve missed, please let me know.

more...

February 01, 2010

Day 1 of the conference was excellent, though I spent the second half of it feeling absolutely shattered, having had less sleep over the last week than I would have liked through a combination of illness, early morning starts, and perhaps a tad more beer than was wise. Which is why I’m writing this now in my room, when by rights I should be in the bar.

We started in a refreshingly human manner, with talks by Scotty and then Mike Lee, focussing on the big picture rather than the nitty gritty details. Of course the details are our meat and drink, and we’ll get plenty of them this week, but it’s good to have our eyes dragged off the floor and onto the horizon every now and then.

I particularly liked Mike’s talk, as much for the effect that it had on the room by confounding our expectations. It was emotional, and personal, and reminded us that there’s more to life than programming, but also that the skills that we love to use in our programming can be applied to life.

I think it wrong-footed a few of us introverted programmer types, who were expecting nerdery and got philosophy instead. “What is this emotion of which you speak, human? I have no time for this frippery. Take me to your loader (sic)”…

Perhaps it was also just a bit too heartfelt for us cynical Europeans, who get a bit confused when someone is open and honest with us. There’s usually a little voice in the back of our head wondering if we’re having the piss taken out of us in some way which is so fiendishly subtle that we haven’t worked it out yet. Not so in this case. Anyway, good on you Mike, nice job.

Luckily for those in the room teetering on the edge of an existential crisis, this was session was followed by a full on geek fest from Wolf Rentzsch, who gave us a whistle stop tour of the tools and techniques needed to rummage around on the internals of OS X and applications written for it. Hurrah for insanely micro-focussed detail. Now were back on familiar ground. There were some excellent pointers, particularly tantalising for me since there are any number of really irritating things about XCode that I could probably sort out now given sufficient time. Like why the fuck my Data Formatter plug-in only works when there’s a full moon.

Rentzsch’s talk was followed by a session from Dave Dribin on clean code, which I’ve already blogged about (http://www.elegantchaos.com/node/405), so enough said here.

After which was another good lunch, including another far too nice pudding. May have to hire a people carrier to haul me back to the station at the end of the week…

One thing I definitely think that they’ve got right this year is the amount and length of breaks between the sessions, and the overall pacing, with just two sessions in the afternoon. Today these were a talk by Drew McCormack on data presentation, and a brief overview of Core Animation from Marcus Zarra.

Drew’s talk started with an overview of some existing ways to present data, but was interesting to me mostly as an introduction to a framework he’s been involved in creating for graphing and plotting. This looked like a great resource when you’ve got any set of data that you want to display as something better than a big table of numbers.

Marcus’ talk was tantalising, as I felt I knew a bit more about what Core Animation was than he assumed, and was hoping for a little more in the way of code examples or teccy stuff.

To be fair though, it was late by then, and he probably pitched it perfectly for the level of fatigue we were all experiencing at that point. And I guess if I want the details I can buy his book :)

All in all it was an excellent first day. The speakers and the general conversation was of the highest quality - something that came as no surprise after last year, but which still takes a great deal of effort to sustain.

So many thanks to the organisers one and all. I can’t wait for tomorrow.

more...

February 01, 2010

Dave Dribin was preaching to at least one of the converted (me), in his “Clean Code” session at NSConference today - but then I have to wrestle with very large bodies of C++ code every day, much of which was written by other people not following any of his guidelines!

Most of the stuff he said was uncontroversial, but it was amusing to see a few people in the audience bristling at one or two of the suggestions that Dave made - you could hear the cogs turning in their brains as they thought “but I do that all the time, and I’m smart, so he must be wrong”.

I can’t really offer an opinion on KVO vs Delegates, not having done enough Cocoa work, although I think it’s all a storm in a teacup anyway as he was simply offering a personal order of precedence. Having had to debug very complex systems I can see where he was coming from though. KVO sounds like a lovely way to decouple systems, but it can get scary when just “setting values” can cause a rich ripple of side effects that extends way beyond the object you thought you were playing with.

I do think Dave’s right about singletons - at the end of the day they are globals, but somehow we’ve ended up with design pattern books telling us about them, and people like Scott Meyers telling us how to implement them efficiently, and it’s blinded us to the fact.

The point that some people seemed to be missing was not that they aren’t useful (they can be), or even that they aren’t the right or pragmatic solution to some problems (they can be). It’s just that they often aren’t the best solution, and yet it is dangerously easy to fall into the trap of making them when you don’t need to - I know, I do it all the time, with the best of intentions. And Dave was right - using a singleton you can easily end up with annoying hidden dependencies and inflexibilities which you can avoid if you instead use a pattern where you pass in the services/resources that you need. And it does make life particularly hard if you want to do test driven development and unit test the hell out of everything.

I never felt that Dave’s tone was in any way preachy, but maybe some people wondered why he was telling them stuff that “we already know”. Perhaps it’s also just a very healthy skepticism in the audience towards received wisdom, which is fair enough - I’m all for that. But just because it’s received wisdom, it doesn’t always make it wrong, any more than it makes it right!

In any case I’m not at all convinced that everyone in the room does know all that stuff. There were plenty of indy developers in the room, who are working on there own a fair amount of the time, many of whom are 25 or younger. I’ve also met plenty of developers in my life who’ve been doing coding professionally for years and still haven’t got a clue!

When I was 21 and just out of college I was lucky enough to get a great job working in an university research department, writing educational software in Hypercard (with plenty of lovely XCMDs that I wrote too). It was a brilliant job and a fantastic environment in many ways, with loads of freedom for someone just out of college. At the tender age of 21 though, I was the only full-time developer and with the benefit of hindsight I realise that I missed out on a great deal of stuff that was going on at the time in the wider software engineering world, because there was nobody at work to point me in the right direction. I was totally focussed on what I was trying to make, and not on the process of how it got made. Things are a lot better now than they were in 1992 of course, and it’s a lot easier to stay in touch with the current trends in computer science through the sort of social networking that we now have. But you still occasionally need people to tell you stuff, even stuff that you’re supposed to already know.

There’s definitely no harm in being reminded of some of the basics from time to time, and having some of your assumptions challenged - whether you’ve been doing programming for 1 year or 5 years or 30.

more...

For a couple of weeks the Console application on my laptop has been crashing every time I started it up. This was a bit weird, and also very annoying, since I use it from time to time whilst developing, and to check that the system isn’t doing anything particularly heinous.

The stack for the crash log appeared to be in a call to the file system, so I figured that the problem was file related in some way. I tried removing the Console preferences, to no avail.

After a bit of thought, I realised that I could probably use Instruments (part of Apple’s Developer Tools suite) to work it out.

So I launched it, chose the “File Activity” template, and set it up to run Console. This is a great way to see what an application is doing with files.

Lo and behold, the last thing Instruments did was open a file in /var/log/, then repeatedly try to open some file in /.vol/.

Doing a quick ls of /var/log/ revealed a symbolic link to something that I thought that I had removed (some crappy VPN software called SecureClient that I used to rely on but don’t any more as it doesn’t work on 10.6 anyway). Further investigation revealed that the symbolic link pointed to another symbolic link, which pointed… to itself. That would do it!

All in all it took about 5 minutes to find and fix this crash once I realised that using Instruments was more sensible than just sitting around guessing what might be causing Console to crash…

more...