So these past few weeks I’ve been toying a little bit with Objective-C and Cocoa using a couple of books from Apress: Learn Objective-C on the Mac: For OS X and iOS and Learn Cocoa on the Mac. Both are very good at introducing the subjects, not going too deep but generally deep enough to get a good understanding of the basics. I did get tired of toying with the example projects, so after much procrastination, I started doing things on my own.
I figured I’d start by trying to access data stored in the MySQL database I use for my web site,. I’ve been using a crappy MS-Access interface for nearly 12 years and I’d like to retire that thing. So I went out looking for an Objective-C interface to MySQL. No such luck – none is offered by the MySQL group at Oracle. I didn’t find a couple of open source projects meant to fill the gap, but they were pretty old and abandoned. So I set out to do it the hard way: I download the MySQL C API. After all, you can do C in Objective C.
So yeah… My first Objective-C experience (doing a project of my own) is starting as “plain old C”. I hadn’t done any C in 8 years, and that was for a very small program on Windows. Things are slowly getting back to me, but want it or not, it does make you appreciate what frameworks such as .NET do for you. So far I’ve managed to call three stored procedures for adding, updating and retrieving bands from the database. Which reminds that I need to delete as well. *sigh* I’m not crazy about stored procedures, but for what I’m setting out to do, it’s going to be easier than writing the SQL directly in the C code – less housekeeping with the strings.
Back to Objective-C – that is some weird-looking language at times, but after and writing some of it, it’s looking less alien. Even though Apple have added a lot of features over the years, it does show its age here and there – lack of namespaces, the relatively ambiguous status of private methods being two. But throw in Cocoa and things already get more modern. That’s a pretty cool framework that I can’t wait to start using for real (once I’m done with the database code). Would be nice if Core Data supported MySQL though. (Hint, hint…)
I also got an idea for an iPad app, but I can’t do everything at once… 🙂
That’s all for now…