This post is hard for me to write.
The keenest of eyes may have noticed that the last time I released anything written in Cocoa was in mid-February. I still don’t like to talk about my job any more than is necessary, but this was before my new employment, although not before I’d come in contact with the place of it (I’ve known them for years). It is impossible for me to not make the connection. I’m writing significantly less Cocoa code nowadays, and despite getting a new computer in March, I have yet to transfer all my source code over.
Even though I’ve been writing code in both C# and Objective-C for the past several years, I would be lying if I didn’t say I’ve been writing more C# than ever. I have several reflections around this:
You can say a lot of things about C#, but writing C# in Visual Studio is a far smoother experience than is writing Objective-C in Xcode. Not only is the built-in Intellisense and refactoring great, there are really great plugins^W”add-ons” that take it to the next level. I know that this is harder to do with a C-derived language than it is with a new language whose supporting infrastructure you just made up yourself, and I know that clang and assorted infrastructure changes will help assuage the tremendous sinking feeling I get sometimes when I wait for the magic to kick in and realize that it’s not there. But it won’t be there tomorrow, and it’s definitely not there now.
Interface Builder is still far and away better than anything Visual Studio can muster, because there’s a much better culture around user interface design. In Windows Forms certainly, but even in WPF, the level of excellent controls I’m looking for is mostly just not there. Most of them look like crap (and offer a would-be-placating property or two to change the color or font or retarget the Office/Visual Studio/Windows version from which the control’s appearance is supposedly taken as an excuse), and many of them work like crap.
Maybe the biggest thing to cope with is that if you’re trying to do good interface design on Windows, you have to go the plain-but-default way, look increasingly dated and don’t attempt any moves that Microsoft wouldn’t pull which is a great damper on creative solutions, or you really have to do what feels good for your particular application from the imperfect tools that are there and risk being called out as just another skin app that’s got that “flashy” look (for Windows Classic-theme users) just for the hell of it.
The thought has occurred that moving to RubyCocoa might be worth it, since Ruby is a language that I really love, header-file-less, a better fit for Cocoa’s loose typing and heavy basic data structure use, and last but not least possible since I intend to make source code available for all my applications eventually. But there’ll be a transition period before I can tease apart Objective-C and Cocoa and adapt fully to all intricacies of writing code for the Ruby bridge (it’s the second part that’s hard). And Xcode’s support for Ruby is far less shining than is the Objective-C support.
Maybe I’m just spent at the end of each day and especially the weekend where I can really get stuff done regarding my own applications. The drawback, if I may call it that, of a fulfilling and interesting job may be that you’re all out-programmed at the tail end of those 40 hours.
I still love Cocoa. Writing an application in it is more satisfying than any alternative I’ve found. But the actual grunt work is dissuading, and some technologies I really want to use, like Core Animation, manages to combine graphical arithmetics (one of my great flaws since I have trouble context-switching between the two concepts without constantly keeping notes) and writing a lot of code.
I definitely still plan on updating my applications. But right now, I don’t know when that’ll take wings beyond a commitment and an intent. And this saddens me.
Moreover, I advise that the iPhone software platform must be opened.
I tend to prefer Visual Studio and C# to Xcode and Objective-C too. The main thing I dislike about Visual Studio is that it tempts you into writing unmaintainable “hackish” code. If I’m not careful, I always end up doing things like mixing UI and logic in the same source files. If I’m not careful in Xcode, I typically end up with a reasonably clean MVC solution.
Also, Visual Studio rots the mind :-) http://www.charlespetzold.com/etc/DoesVisualStudioRotTheMind.html
By LKM · 2008.10.19 12:30
That’s admittedly true. Writing C# in Visual Studio vs Objective-C in Xcode may be a fairer comparison than Windows Forms and .NET code in Visual Studio to Cocoa in Xcode and Interface Builder.
But for me the case is clear; the built-in support for statement completion, “Find all references”, code navigation and refactoring is better in Visual Studio 2008 than it is even in Xcode 3.1. Visual Studio has a history of where you’ve navigated in your code and you can jump very effectively around in big files by going “back” and “forward”. A good retort is that you shouldn’t create big files, but the right answer is that even so, there will be advantages to providing this.
I’m not a fan of the Visual Basic development model (double-click and write, effectively), but I do find that Visual Studio, with help from the way C# works, makes it easier for me to establish as many or as few layers in my code as I need.
Visual Studio rots the mind insofar that you may think it unbearable to write out full method names or manually lay out user interfaces or hook up events – and yes, perhaps that if you’re not careful, you’ll grow attached to how it’s done in the tool rather than how it works architecturally. But this is an insane point to make. Interface Builder works wonders by treating UI as UI and code as code and bridging the gap. If you know how to structure your program, you know, otherwise you don’t. Visual Studio or Xcode or Eclipse or any IDE is a MacGuffin in this argument. It’s keeping me focused on my code by abstracting away many of the tedious details of the actual typing, allowing me to write it more efficiently, and I can’t see how that’s a bad thing.
By Jesper · 2008.10.19 17:09
To be clear, I prefer writing C# in VisualStudio to writing Objective-C in Xcode. When I’m in VisualStudio, I often feel like I’m on autopilot; the IDE works the way I think, even when my thinking is a bit messy. Xcode does not allow messy thinking. Also, C# has grown into a really nice, modern language, while Objective-C is still struggling with its C heritage.
I thought about this some more after posting, and I think the main advantage Objective-C (at least on the Mac) has is its mature, complete, documented frameworks. The .net frameworks are still somewhat incomplete and often strangely undocumented, and sometimes, they’re obviously only wrappers around old apis, which results in strange methods with dozens of weird arguments.
By LKM · 2008.10.19 21:50
Ding! again. .NET is big and dumb and impossible to fully master. Sure they crank out new versions, but I’m still learning new things that were possible in the initial release, and I’ve been following it for nearly that long.
Cocoa is brilliantly designed. It’s an order of magnitude smaller (at least), and people will start throwing rocks at you if you invent your own special fucking collection just because it holds a new type. The brilliance with Cocoa is all in that there’s a limited number of well-made pieces that stick together in ingenious ways.
And now the moment you think I’ve picked a winner (I won’t), I mention LINQ and Intellisense and it’s right back to square one, right back to another few rounds in the same wheel.
I’m waiting for Apple to take off for real. (Because that’s more likely than .NET shedding its complexity and growing some organization beyond mere “crowd control”.) And I hope the first steps to that will be unlocked in Snow Leopard and in clang.
By Jesper · 2008.10.20 00:21
Great post. I’m particularly interested in this subject because I’m currently taking a beginning programmer taking a course on C# (using Visual Studio, though I’m also using X-develop when I’m on my old PowerBook G3). I’d love for you to revisit this subject/provide us an update on your views sometime soon(er or later). I’m considering picking up Objective-C right after I finish this course next month. I’ve found a book on the subject that gets rave reviews, “Programming Objective-C 2.0″ by Stephen Kochan. (BTW I have this wonderful book on C#, “Learning C# 3.0″ by Jesse Liberty and Brian MacDonald. I feel compelled to share this book with others because it currently has 0 reviews on Amazon and I’m finding this book to be an exceptional intro to programming. I’ve picked up and attempted to get through quite a few other “beginning programming” books, but this one is the first that is really clear and helpful for a beginner. A textbook that’s not quite a “textbook”! (That is, it’s an enjoyable read that’s not overly dry/boring.)
By Harold · 2009.01.21 23:15
A friend’s been talking well of Jesse Liberty’s books, so I can see why you’d recommend one. Myself, I don’t mind technical details, but I do mind dry, uninspired writing, or excessive technical detail for its own sake. And it’s been years since I read a full book on any language – I think the latest one I bought was about “CGI/Perl” back in the previous millennium – and the only one that’s tickled my fancy even a little since then has been the annotated C#3 standard.
Objective-C can appear savage after being immersed in C#, but it’s not as bad as it seems. It is built on top of C, with all that that entails, but it’s also the best object-oriented environment I’ve seen with the possible exception of Ruby.
The UI tools are so far ahead of anything Visual Studio throws you you’ll sob silently the next time you have to assemble a UI on Windows. (I have strong views on WPF’s insistence on you writing XAML by hand, as you might have noticed if you’ve been reading more recent posts as well.)
The truth is simply that C#/.NET and Objective-C/Cocoa are both good environments, but they’re both good in different ways. You’ll be a better programmer if you can get around in both, but you don’t need to be able to do magic in both to be a great programmer. Those have been my views for the past several years, and while the environments have changed and been updated, their strengths and their relationship has mostly remained. My fundamental position is not in need of revision, but I’ll hopefully post an update to this in the near future anyway.
By Jesper · 2009.01.21 23:43
Thanks for replying so quickly! Regarding the books: I had picked up another of Jesse Liberty’s books, one in his “Programming C#” series, about a month before discovering his beginner-level “Learning C#” series. I found myself walking home with the book in hand, surprisingly understanding quite a few concepts I had previously had trouble with. (Even the book “Learning to Program” by Chris Pine had given me trouble; I’ve yet to finish it but plan to eventually. Though truth be told, I wasn’t as committed to learning programming as I now am.) A well-considered, well-written, and well-tested technical book is a joy for me to learn from; it’s just one way I love to learn (and my current approach to learning programming–that, and paying for local community college courses. Money is a great motivator.)
Ruby’s been on my agenda off an on for quite some time now, too–I may even hold off on Objective-C in favor of learning as much Ruby as I can. I already have a few books (one of which I mentioned above). I should like to find out more about RubyCocoa, too, since I’m inclined toward programming on the Mac platform. (That’s not necessarily so, but I spend more time on Mac than on PCs, generally, and I get a a lot of pleasure simply coding and writing and producing other digital objects using the Mac OS.)
Thanks for listening. As you might be able to tell, I’m still working out which platform I’m going to be spending more of my development time on. It’s not an easy decision to make! It’s one of those things where you don’t really know which is better for you until after you’ve already learned it all, you know? I’m still in the early stages of learning programming, and though I can learn just about any scripting language using any platform, the languages C# and Objective-C (more or less) require the IDEs on their respective platforms. (Particularly on the Mac side, where Xcode is the only IDE available for Objective-C. As for Windows, I know there’s tons of C# IDEs available, but Visual Studio just makes the most sense to me for C# development.)
By Harold · 2009.01.22 00:23
There’s absolutely nothing wrong with using Visual Studio for C# development. It will always be up to date following major upgrades to .NET and C# itself, and it’s really quite good, even if it’s resource hungry. Resharper does a lot of additional thinking for me, and I see it has a $49 student license which may be of interest.
By Jesper · 2009.01.22 19:46
Yes, I’d noticed that offer on Resharper. If I stick with developing C# I’ll look into that. Right now I’ve got a couple more weeks of a free trial of X-develop going…
By Harold · 2009.01.22 20:30