I know I’m late to the iPhone development party, and consequently I’m also late to the Objective-C debates. But I can’t help but chime in; so here goes . . .
Back in the Day
Back in the C programming days (while I was apparently sleeping), there seem to have been two directions: The C++ road, and the objective-C road. I have never seen Objective-C until OS-X, and I have never worked with it until a couple of weeks ago, but there is certainly a lot of goodness going on here – much more than C++ ever attempted. In hindsight, I can say that every large C++ project I’ve seen has grown into a mess – that includes apps using UI frameworks, as well as apps using STL, boost, and other frameworks and libraries. Objective-C does show its age from time to time, but it contains many things I mistakenly thought were “invented” later (probably invented earlier – even before smalltalk – I’ll have to do some research sometime). Here are a few thoughts from an absolute beginner in Objective C. It should be fun to read this a few months from now and reflect upon my initial impressions.
Learn a New Language Every Year
This advice from the Pragmatic Programmer is good advice, even if it is not really possible to follow every year. The advice is given so that you may learn a new way to think.
What I am learning to think about:
- Static typing and dynamic dispatch (and dynamic typing, too, if you want)
- Message passing vs method calling, including ignoring and forwarding messages
- Protocols vs Java/C# interfaces
- Categories to add (and replace) methods on a class
- Newer features, such as Properties, garbage collection
Some of the silliness
There still remains some silliness, like header files, much of the syntax, and the lack of namespaces (I am getting tired of prefixing all of the NextStep, err, I mean Cocoa APIs with ‘NS’), but that’s a result of the time period when all this stuff was developed, and the close relationship to the ‘C’ language, which is also touted as a feature but I could care less about. But all of this is very minor.
Overall, a much better extension of C than C++ in almost every way.