Objective-C?

by Jonathan Gennick

A few weeks back I asked for comments and suggestions regarding future C and C++ topics. Many of you sent me some thoughtful and enlightening notes, and, frankly, I'm delighted by the response. Several readers suggested I look at Objective-C, so that's what I've spent much of my spare time doing these past few weeks.



Objective-C is really cool! I used to program in C, and had Objective-C ever been put before me I might well have become an object-oriented developer. I recall finding C++ very intimidating when I tried to learn it, especially with all the issues surrounding static versus virtual methods. What confusion! Objective-C, on the other hand, has a much simpler model: everything is dynamic, and any object can send any message to any other type of object. You can even send messages to an object that the object doesn't recognize. This fits much better with my vision of how object-oriented programming should work.



I also like the way Objective-C per se is a minimal syntax layered over existing C syntax. Rather than having to learn a new language (C++) that is confusingly similar to an existing language (C), I can leverage my existing C knowledge and move gracefully into the object-oriented paradigm. Why, I wonder, did C++ win out in the marketplace?



Good as it is, Objective-C seems to have been on its way to becomming a "dead" language. It's first major success (I believe) was its use on the NeXT platform, but as NeXT went, so, apparently, did Objective-C. Apples' use of Objective-C for the GUI framework of Mac OS X has resurrected interest in the language. (Perhaps Latin will be next?) I've heard people claim that OS X now represents the largest installed Unix base. Regardless of whether that's true, OS X is certainly out there in big numbers, lots of people are developing for it, and many of those people are using Objective-C.





Post your thoughts on Objective-C. Will it make a comeback that extends beyond the Mac OS X platform?


6 Comments

canyonrat
2002-05-17 15:06:56
It's all in the frameworks
Much as I like ObjC, it really needs good frameworks in order to be useful. Right now those frameworks are tied completely to Cocoa. Since Apple abandoned Yellow Box, GNUStep is the only hope for ObjC to flourish outside its little ghetto.
anonymous2
2003-03-29 20:52:15
newbie
What books can teach me Objective-C programming? I have never-ever programmed.
anonymous2
2003-04-16 19:49:26
C++ is easy
C++ is a very large WOW when you look at some code without knowing the language, I'll admit that. But it is a WONDERFULL programming language. once you got down OOP you are set. OOP in C++ is like a gift from god and I HIGHLY recomend that EVERYONE give it a chance, not a try, a CHANCE. It alow you to do so much with your program, and it also makes it so you can make really cool libraries that you may end up using in 25%+ of your programs.


PLEASE GIVE IT A CHANCE!!!!!

Jonathan Gennick
2003-04-17 05:46:20
newbie
That's a good question; I wish I had a good answer for you. We do have a Learning Cocoa title. Cocoa is the Objective-C framework you use when writing programs for Mac OS-X. Learning Cocoa does contain a chapter or two on Objective-C. However, the book does assume that you know and C and object-oriented programming to begin with. I don't know of any Objective-C books targeted at those who have never programmed before.
Jonathan Gennick
2003-04-17 05:51:19
C++ is easy
OOP is what Objective-C is about too. People I know who write in Objective-C have similar good things to say about that language. But there's probably no point in arguing which is better, because Objective-C is just not a force outside the world of Mac OS X. If you're programming for the Mac, then you probably want to learn Objective-C. Otherwise, C++ seems to me to be the only viable, C-based language choice.
anonymous2
2003-05-24 02:16:50
C++ is easy
That's funny - I make really cool libraries that I end up using in 25%+ of my programs with plain everyday C too...


The problem with C++ is it tries to hide code in the name of making it easier, but in the end, hiding the code makes it harder to figure out what's going on if you're not familiar with the internals of a class.


Code should be self-explanatory, in that you only need to know the language to understand it. C++ requires that you know a lot more than C++ to understand someone's code. You've also got to know what's in all the background stuff they're conjuring forth that isn't shown.


Well, regardless of that. The point there was that Obj-C offers many of the OO things that programmers seek, and more, without the extra baggage of C++.