2 ms·
Based on the comments, seems like most people's objections of Objective-C are really objections about C: header files, manual memory management, function pointe
by jinushaun 16y ago
Based on the comments, seems like most people's objections of Objective-C are really objections about C: header files, manual memory management, function pointers, strong type system, too low level, no native string object, etc. I grew up with C, so learning Objective-C took maybe 10 minutes because it's basically C with some extra syntax for OOP. In general, one only encounters the "strange" syntax when dealing with methods. I personally love the method syntax because it's basically self documenting.
Which leads me to wonder, how many programmers both on HN and in general know C? I'm too young to already be a dinosaur in this industry... Where did all the C programmers go? Seems like programmers nowadays started learning how to code with Java or Ruby/Python and expect all other languages to be just as high level. Objective-C is low level, which makes it harder, but doesn't make it suck.
As a language, I think Objective-C is a fine one, but I must admit that it is a "dinosaur". The real problem is OOP paradigm. Remember, back in the late 70s and early 80s, OOP was new and exciting and C was the dominant language. People were trying to figure out what OOP should look like and how to make C more OO. NextStep (Apple) just happened to bet on the wrong horse. Obj-C went with Smalltalk syntax, while the rest of the world went with C++ syntax and ultimately the Java style syntax we know and love today. Seems like some developers can't wrap their heads around a non-Java syntax for OOP.
All that said, Objective-C survives only because Apple hasn't chosen another language to replace it for Mac and iOS programming.
- schrototo 16y ago> Obj-C went with Smalltalk syntax, while the rest of the world went with C++ syntax and ultimately the Java style syntax we know and love today. It's more than just a syntactic difference. Objective-C implements true message passing which is not the same as "method calling". You can send messages to a nil object, or have an object dynamically respond at runtime to a message it didn't declare at compile time etc. Some seem to think the brackets are just some kind of whimsy, but it's important that sending a message is not to be confused with calling a function.
- ams6110 16y agoI know C, but haven't used it in years. I had done a couple of projects in assembly language prior to picking up C and I think that really helped as I had no difficulty with the concepts of allocating and freeing memory, pointers, and the like that seem to be pain points for some.