Monday, December 27, 2004

My top reasons why Mac developement with XCode is a nightmare...

We've been working with XCode on the Mac for at least six month now. We used to build all our Mac products with CodeWarrior 8.3 and 9 but decided to drop it because it wasn't offering any support for the new Apple SDKs and it wasn't integrating at all in what we think is a morden build environment. (one of the worst thing in CW is that it still saves its projects as completely opaque binary files that are a pain to handle with CVS and any other non native mac programs). The obvious alternative was to go the Apple way and use XCode. The main appeal came from the fact that XCode uses the well known GCC compiler and all the suite of the GNU toolchain which would supposedly offer a much better development environment.
I've been quite disapointed with that choice. Here are the main problems we encountered with XCode:

- Very slow C++ compiling experience. Visual Studio.NET 2003 is compiling at least twice as fast in most cases. Even without heavy templates. CodeWarrior is also typically an order of magnitude faster at compiling the same code. Amazing.
- XCode's dependency system is broken. It forgets to rebuilt some needed source once every two or three builds. It also rebuilds files that haven't changed (and whose deps haven't changed either). I have a project that I can rebuilt 10 times in a row without modifying any source code and XCode will still rebuild some diferent random files each time. Visual Studio and CodeWarrior both do this perfectly.
- XCode sometimes forget to remove the previous error reports when you start a new build.
- The project depency is not only circumvoluted but also buggy as hell which renders it completely unusable. It doesn't change the working directory to the current building subproject which breaks all relative #includes and other files directive. This means that I have to manually rebuild up to FOUR external libraries I depend on MANUALLY and then switch to my test exectuable to debug. This is not manageable. Breaking big projects into small projects to cut the building phases have been a fundamental development paradigm for decades but it seems that Apple still doesn't get it. Weird. Once again this is something both VS.NET and CodeWarrior do very well (in a diferent way but still very reliable).
- The text editor is sub par. There is no virtual space a la visual studio (you can't get the cursor further that the end of the current line, some like it, some hate it). The key binding editor is showing strange behaviour. Some functions can be bound to multiple keys, some others can't, many functions are duplicated in between the menus and the text editor while some of them are not effective at all.
- "Developement Styles". This is a most unuseable feature. It is presented as some kind of template target system. But you can't have multiple targets with diferent building style in a project. And switching the Style is equivalent to hitting the "Clean Target" button: you'll have to recompile EVERY file in every target! This means switching from debug to release mode takes ages... Better forget about that "feature"....
- XCode would crash unexpectedly every so often: adding files, editing source code, compiling, debuging, and all of a sudden, boom, it crashes. Sometimes it even crashes as you are not using the app at all. CodeWarrior also does that quite often (one of the reason we wanted to get rid of it: sometimes it can't even read back its own project files...). The Apple zealots should have a look at VS.NET which barely crashes at all and NEVER lost any of my file. Even VC 6 was ultra reliable.
- XCode adds files to a project with absolute paths! That amazingly stupid. You have to revert to relative path manually at least once per codding session as it will use your last setting as a default for the next add operation (until you restart XCode...). Even better: the dialog box says "default" instead of showing the actual reference mode it plans to use. What does Default means? CodeWarrior show the exact same kind of stupid decision in some corners. VS.NET doesn't.
- Microsoft have been one of the first to add automatic code completion to their IDE. It works beatifully, never ever getes in the way of the programmer, always work in the background, as a minimal set of keybindings to trigger the code completion, disable it, choose the wanted completion when multiple choices are availables (basically it only hijacks the cursor keys and one or two other keys to trigger/disable the feature). I wish Apple ingineers had used Visual Studio at least 2 minutes before hacking their new wheel... XCode's automatic completion is slow, get things wrong 9 times out of 10, starts to display completion choices when I have actually finished typing a method or variable name (very useful... :-/). And worst than anything: it hijacks ALL the keybindings when it starts displaying it's contextual choice menu! This means that if I start typing a method name it will not propose any choices until I have finished typing it, and then once it does I can't continue typing or run a command (like "build") until I have pressed the Escape key. The equivalent feature never really worked in CodeWarrior, but at least it wasn't annoying, it just wouldn't show up.
- The API formal doc and useability doc is amazingly bad. One can wonder how Apple zealots can continue bashing microsft's pratice with a straight face when once compares the MSDN Library/Visual C++ documentation with the Apple provided one. The doc is a complete joke. Units are never specifier, niether is there links to the types definitions (as an example I was looking at the Carbon Timer API doc lately: some parameters are said to be delay times but their units are not defined in the docs: is it second? milliseconds? days? centuries?). Sample code is ultra ulgy and hides the feature demonstration in tons and tons of stupid formal code hacked together: there is no concistent code conventions, no cross references, no broad explanations or the general usecase guidelines, or when these exists they are just too general (like "Macintosh Apps live inside a window", yeah right, I couldn't guess that... ). There is even some original Mac OS docs: everything is defined in Pascal. Very useful... Not!
- XCode forgets to include updated resources in a targets. This means we have to manually delete the build forlder and rebuild the target completely to be sure that our updated files are correctly copied. Who can you trust? Do we really have to do everything by hand?
- The UI is dog slow: press the Build button with the mouse and it will think you want to display the build submenu instead of launching the build command. You then have to press the button twice: once to close the frigging menu and once to actually re-launch the command.
- Window Clutter: XCode LOVES windows. It loves to open new windows for no apparent good reason. And it doesn't know what dockable window means. This means that if you use five diferent projects (because you broke your main project into librairies...) you'll have at least 5 main windows. Of course the debugger open another window. So does the debug output. And the build output. And if you ask to open a source file it will probably open in another top level window. CodeWarrior shows the same behaviour. It's highly impractical and stupid. And don't tell me to use Exposé to manage these windows because it isn't worth any thing more than the eye candy factor. The only useful Exposé feature is that it enables one to access the desktop at the touch of one keystroke (Windows can do this since 1995: hit the windows key + D and you're done).

My experience coding on a Mac is that the tools are totaly broken and slow. And when you can get past the irritating tools you meet the completely wrong Carbon API with its outdated design and half baked API. Of course there are also some gems (like Shark or MallocDebug) but for the moment my IDE of choice stays Visual Studio which I find much more reliable, fast and feature complete (and it produces faster DSP code too!).
And that's too bad, the Mac platform is very nice from a user's point of view and I wish I could enjoy the same pleasure developing on it that our customers have using our products on it...

8 comments:

Anonymous said...

Woowwww !
what an impressive and frightening advice!

But so, is there a modern and reliable coding API on MacOSX ?

Anonymous said...

strange
weird
here is my feelings after reading your rant


xcode is not visual studio. xcode is not really an environment for C++ neither a clone of visual studio

xcode is mostly 2 years old

the "slow compiler" is not Xcode but GCC which has far more problems than simply be a c++ compiler for windows.

it's just : YES WE KNOW IT'S NOT VISUAL STUDIO CLONE !

Unknown said...

I know XCode is not a VS clone. I also know it is touted as the one and only solution to all C++ developement tasks on OSX. I'm not expecting a VS clone, i'm expecting a work environment for C++ dev. XCode currently misses that. It is not stable and doesn't do what it is advertised to. Actually not being a clone os VS doesn't prevent XCode from offering ways to perform the same tasks even if the UI is not the same. Codewarrior is on par, xcode is not.
I also know XCode is not GCC.
Gcc is a slow compiler, that's a fact I've been aware of for a long time. Even on x86 it's slower than most C++ compilers I've had to deal with (Watcom, Borland, Microsoft, Intel). But it seems that the mac port is even slower than the x86 one. I'm not pointing fingers, i'm just saying that XCode/GCC on a mac is a less effective setup than others for the time being.

I still manage to use XCode and I'm about to release some products built with it very soon, so it IS a viable solution for C++ development. It's convoluted, it's slow and it's buggy, you have to find workarounds, disable dangerous options and deal with it, but one can still work with it.

Anonymous said...

Xcode is free... What about VS .Net ??

Anonymous said...

Xcode is free... What about VS .Net ??

Unknown said...

XCode is NOT free. No more than OSX comes "free" with a Mac. XCode is sold with every copy of OSX which is sold as a bundle with every mac. Nothing wrong with that. I don't mind paying for software.
Digression: The funny thing is that joe six pack, the proverbial user, also pays for it even if he doesn't even know it's there on his mac :). But still bundling software with hardware is a well known marketing practice to give the ilusion that the software comes "for free" when in fact its price is merged in the global hardware price.
Anyway. I'm comparing equivalent apps. Not equivalent "products". They are equivalent in the way that they are supposed to provide the same kind of tools to solve the same kind of problems. I'm not comparing price tags. Actually, as a profe"ssional develope I don't really care about the price tag of my tools (as long as they stay reasonable of course ;) ). I'm a registered apple developper, as well as an MSDN subscriber. I own multiple copies of Codewarrior (7 to 9.2), I even paid for every copy of OSX since the first beta.
Had I started my blog 3 years ago you would have seen many posts saying VS.NET 2001 sucks. Most of the issues I had are now fixed in VS.NET 2003 and it works as expected :).

Anonymous said...

XCode is Free. He can be freely downloaded on Apple Web Site.
It's absolutly normal than you have to recompile all files when you change profile (from developement to deployement).
You change all compiler flags (like O0 to Os, and precompiler macros, and more) and you would all of that be perform without recompilation.
Two possibililties, you don't know what compile a source file mean, or you dream about a wonderfull unexistant IDE.

Unknown said...

This last assertion is completly false. You don't HAVE to recompile everything is you do things in a smart way. What smart people do is put the compilation results in diferent folders (like debug/, release/, profile/) so that switching from one build style to another doesn't requite a complete rebuild of ALL the files a la XCode but only the ones that have changed, a la every other IDEs (VC6, VS.NET, Borland, Codewarrior, you name it, every single one except XCode). It's not a dream its a reality every where. Only in XCode land it is a nightmare.
So I suggest YOU get a clue.