Cocoa project

The Cocoa/Mac project that I’ve been working on is pretty much done. It’s not a really big or complicated program, but I just ran a ‘wc’ on it, and it’s a bit over 1400 lines of code, so it’s not trivial either. I’m betting that, if I was more experienced with Cocoa, it could probably be, maybe, 900 lines instead of 1400, but that’s still a reasonable size. Oh, and if I didn’t have to support OS X 10.4, and could have used the garbage collector and other stuff that only works in 10.5+, I could probably have shaved off another 100 lines of code.

My program is replacing an old program written in FutureBASIC. Looking back at the source code for that, it was a bit over 600 lines of code, all in one file. You can definitely write a shorter program if you don’t have to declare variables, or allocate and release memory for them.

Overall, I had some fun learning a new language and a new framework, and figuring out how to solve problems that would have been trivial for me to solve in .Net/C#. I’d like to learn some more Cocoa stuff now, and maybe try writing an iOS app. I don’t really have a specific idea for an app, but I’ll figure something out.

StackOverflow

StackOverflow has been very useful for me lately, both at work (with the usual .Net stuff) and at home (as I try to figure out Cocoa programming). I asked them to merge my work and home accounts today, so I’d have just one account. I hit a 100 reputation score recently on my work account, and I don’t want to risk losing it, if I change jobs, or the company goes bankrupt or something. So here’s my StackOverflow flair:

profile for AndyH at Stack Overflow, Q&A for professional and enthusiast programmers

NSTableView

I just spent what seems like an inordinate amount of time getting an NSTableView to work exactly the way I wanted it to. This page was a good reference, even though it’s a few years old. And thank god for Stack Overflow. I have the feeling that I’ve cobbled something together that a serious Mac developer would laugh at, but it does work, so I’m happy.

Mercurial and Git with Xcode 4

I’ve been reading up a bit more on Xcode 4. The prior version, Xcode 3, had SCM integration with Subversion, Perforce, and CVS. The new version has support for Subversion and Git. (I’m not sure if they dropped CVS and Perforce, but I’ve only seen Subversion and Git mentioned.) And, of course, I decided a couple of weeks ago to use Mercurial instead of Git. Oh well. It’s not a big deal to do version control outside of the IDE, but it’s always nice to have it integrated.

I think I’ll be sticking with Mercurial anyway, since Bitbucket allows unlimited private repositories under their free plan, while Github doesn’t.

XCode 4

I was surprised to read that Apple released Xcode 4 today. Usually, I’d know about something like this in advance, but I seem to have missed this entirely.

I’ve been doing a lot of work in Xcode over the last few weeks, trying to learn Cocoa programming, and working on a small contract job, rewriting an old OS 9 FutureBasic app.

I’m a little disappointed to see that they’re charging $5 for it now. That’s not much, compared to, say Visual Studio 2010 Professional, but of course you can get VS 2010 Express for free. I wonder if Apple will make a limited version of Xcode 4 available for free. I think it would be in their best interests.

I think I’m going to stick with Xcode 3 for now, since I need to get this project done, and all my reference material right now is oriented towards Xcode 3. Once I’m done with the current project though, I’ll probably download and install Xcode 4. I’m not sure how I feel about the switch to a single-window interface, but I like the fact that Interface Builder will no longer be a separate program, and it looks like they’ve made a number of other cool little improvements.

progress on Cocoa programming

I’m making some progress, working my way through the Cocoa Programming book that I’m reading right now. I’m including a screenshot from Bitbucket below, showing my check-ins over the last week. I have also started working on the actual Cocoa project that I’m supposed to be working on. I haven’t gotten very far with it, though. Messing with Cocoa has made me realize how proficient I’ve gotten with .Net programming over the last few years. In Cocoa, I’m struggling with stuff that I could do in .Net in my sleep.

Also, I’m realizing that .Net is a much more programmer-friendly environment that Cocoa and Objective-C. I’m not looking to start any language/framework wars, but there are a lot of things that are much easier to do in C# than in Objective-C. And wiring up a GUI for a Windows Forms app is a lot easier than creating a desktop Cocoa app.