Kristian Glass - Do I Smell Burning?

Code Tools

I think I’ve hit on one of the biggest reasons I prefer the parts of my job that involve writing Java to the parts of my job that involve writing Objective-C.

No it’s not that the Java code is a server while the Objective-C code is an end-user-facing client (though I do prefer that). No it’s not that I get generics in Java but don’t in Objective-C (though I do prefer that). No it’s not that Java is a lot easier to statically check than Objective-C (though…).  It’s not that Java is more Simula-style while Objective-C is more Smalltalk-esque (and I’m undecided on that one!)

It’s the amount of tools that I get.

I can fire up Eclipse with a chunk of Java code, and easily extract Interfaces (protocols) or superclasses, rename entities, push code down or pull code up, get a list of functions I might want to override via tab completion, and much more. Tonnes of Java-friendly Continuous Integration systems exist that take mere moments to set up. Dropping in an analysis platform like Sonar is trivial, which gives me test coverage metrics, lots more static analysis, and other such useful information. I get tools like Maven that make dependency management easy.

I start Xcode and open some Objective-C. I get the Xcode refactor tool, which is flaky at best (and as I go to try it right now to see what options it gives me, it’s just greyed out, making it entirely non-obvious what it lets me do). Continuous Integration wasn’t actually too bad to set up, except Hudson (the CI system we use) seems highly Java-focussed, so I’m having issues wiring in warning counts and test failure counts - I acknowledge that as a fault of the choice of tool, though I’m yet to find anything else that seems significantly better for this, and am open to recommendations. Static analysis, well, I’ve got the Clang Static Analyzer, which, while a great piece of kit, seems incredibly young, and there’s only so much it can pick up. For dependency management, the best we’ve found is svn:externals, which just feels nasty, but is quite honestly the best solution we’ve found so far. Sure, I can measure test coverage with gcov, but the process is far more involved and takes much more effort and time than being able to just throw things at Sonar and ask for a percentage.

Now, I recognise that some of these problems are as much to do with the nature of the language as they are with the tools - there’s only so much static analysis that can be done on code written in a dynamic language like Objective-C. However, hopefully this shows some of the reasons why sitting down to write Objective-C in Xcode feels like such a massive step backwards.