Tuesday, July 16, 2013

My On-Again, Off-Again Relationship with Cocoa

My personal logging program.
It's been a long time ago, but I did Mac development when it was new. I started in August 1984, which was pretty much on the ground floor. My employer switched me back and forth between Mac and DOS, and later Windows development. I really loved doing Mac development in those days. But, in 1994, they abruptly ended all Mac work and later that year filed Chapter 11. I left the company about six months later.

I found another job that was part-Mac, part-Windows. That lasted until they laid me off in 2002, just after WWDC. Those were pretty dark times to be a Mac developer. The Windows hegemony was nearly complete -- with over 90% of personal computers running Microsoft's operating system.

Apple tried very hard to get developers ramped up on Mac OS X. Although you could certainly port over a classic MacOS application using Carbon, the writing was on the wall. Cocoa was the future. At WWDC 2001, Apple seeded every developer with the book Learning Cocoa with Objective-C by Davidson. And in 2002, again with Building Cocoa Applications by Garfinkel and Mahoney. I'm sure these tomes jumpstarted many developers.

I tried. I worked nearly all the problems in both books. In those days, there was no Xcode, just Project Builder and Interface Builder. And they were pretty klunky compared to Metrowerks CodeWarrior. But I only had one machine that could run Mac OS X in those days. I was still fooling around with CodeWarrior and PowerPlant. At least, until I got laid off.

The best I could do at the time was a job that was solely Windows. I figured I'd take it as a bridge job, and here I am still at it ten years later. But, that's another story.

I still love the Mac. My whole family uses Macs. I use mine each day. 

Back in the fall of 2003, I started uploading all my logbooks to Logbook of the World (LotW). All my electronic contest logs were pretty easy, even one Field Day log that had a corrupt binary file was eventually rescued and uploaded. 

The hardest part was entering all the hand-written logs. Some time in 2005, I finished this job. While my contest contacts were in electronic form, I was still hand-writing my casual contacts. By spring of 2006, it was time to give the hand-written logbooks the heave-ho. 

I decided I wanted a Mac program. So, I set about to write one. Back to those Cocoa books again. I wrote a very simple program designed to replace the paper log and not much else. You can see a screen image of it above.

With that immediate problem solved, it seems like I forgot what I learned. A couple of years later, when the iPhone SDK came out, one of the best ways to learn Cocoa was the Aaron Hillegass book, Cocoa Programming for Mac OS X. I managed to get one the earliest copies of the third edition, and was again working my way through a Cocoa book.

But, life intervened, and I never did quite finish all the problems. I've since gotten a couple of other books on iOS programming (and I still need to work my way through those, too). What amazes me is how quickly these books go out of date. They try to hand-hold you through every step in using XCode -- except that XCode has likely changed since the book was printed.

All this came to a head recently a work when another team asked me to put together a presentation on how to get started with iOS programming. This team had an iOS application that was developed by an outside consultant, and they needed to take over development.

Well, despite the absence of recent experience, I manage to put together a pretty good introduction. It was heavy on the things I understood well, such as Objective-C, Interface Builder and many of the design patterns used in Cocoa. If anything was lacking, it was details on the classes in the Cocoa Touch framework. But I felt like I gave them the tools to figure it out.

I've used a number of different object-oriented frameworks over the years, MacApp 2 and 3, TCL, PowerPlant, and even a smattering of MFC before tackling Cocoa. Like any framework, understanding really comes from experience -- the more you use the framework, the better your understanding will be.

Now, where is that book...?