Stack OverflowWhy do Programmers Love/Hate Objective-C?
[+89] [33] Genericrich
[2009-01-12 16:30:05]
[ objective-c programming-languages apple ]

So I have noticed that there is a lot of animosity towards Objective-C among programmers. What's your take? Is it a vendor lock-in thing against Apple? General antipathy towards Apple? The syntax? What's your view on this?

With the advent of the iPhone SDK, Obj-C has gotten a lot more attention lately, and I am curious what people on SO's opinions are.

I personally fought the syntax at first but have gotten more and more used to it now. I really like the named arguments. I have some pet peeves with how things are done in Obj-C vs other languages, but I will refrain from comment on them here.

[+135] [2009-01-12 18:03:15] Brad Larson

Honestly, I think that most of the complaints are coming from Windows / Java / web programmers migrating to the platform who just plainly don't want to learn something new. Witness the number of "how can I do development on Windows" or "how can I program the iPhone using JavaScript" questions that have been asked around here. Many of the posts I've read bashing Cocoa and the related development tools come from long-time Windows programmers who are upset that Xcode is not Visual Studio and Cocoa is not .Net. Developers typically choose to write for the Mac because they want to and are willing to invest the time to do it right, but the gold rush on the iPhone is bringing in a lot of people who just want a quick buck.

I don't love Objective-C, nor do I love any other language (however, there are some that I hate). What I do love are the frameworks that make up Cocoa. They are (for the most part) consistent and well-architected. They have allowed me to create better quality applications in a much shorter period of time than any other platform I've worked on. For example, I keep discovering cool things in Core Animation that would be unbelievably painful to do elsewhere. Even simple Foundation classes like NSString and NSDictionary have made my life easier.

(17) well said, comrade - community_owned
you're right. I don't like xcode because i have experience in .Net. and the whole framework and in c++ and in java. The problem with cocoa/objective-c framewowk adoption is apple's choice, which is limiting what you can do. The OS is limited, though it's pretty. But limited. Consumers will love such simple pretty applications. But we, developers, don't really like to put a couple of buttons and tableviews and handle them while having the ability to customize a TVCell by swapping the places of the label and the image. just for the look and feel of some doctrine. - LolaRun
@LolaRun: "Consumers will love such simple pretty applications." True. And who are we programmers working for? Consumers, for the most part. Brad: I like this quote: "I don't love Objective-C, nor do I love any other language (however, there are some that I hate)" - LearnCocos2D
xcode (especially ios) developers works for consumers who love shiny things...true, but other developers are working on lhard ibraries for other developers or ciritical utility apps for a targeted audience... now that's interesting. you see, running after consumers, and complicating your life because some UI requirement has changed, and stress, and all that so he can understand to press "Press me" button ; that's pretty much a waste. It shouldn't be because "they like it" and "it's pretty" we'll build it, it's supposed to be "they need it pretty bad". - LolaRun
@LolaRun - I build robotic systems for my day job which use controlled ultrasonics to print microcircuitry and biological diagnostic tests. These systems are driven by Macs through control software I wrote in Objective-C and Cocoa using Xcode. Is that hard enough, or enough of a targeted audience for you? My most popular iOS application is a molecular modeler with 3-D visualization capabilities currently unmatched on any other mobile platform. The Objective-C language and Xcode are in no way limiting the development of complex, powerful applications. - Brad Larson
yeah that's hard enough. And actually some of ios's sdk limitation also exists for j2me and BB and android. And concerning the macos, i never did any app, though i see it can be interesting. Though i wonder why you had to make it in Xcode/Obj-c, i mean C++ is better and easier, and i think it has richer frameworks. The thing is that i've developing in Obj-c for a year now, i developed in other languages and IDEs, but still this one is hard to swallow, and i don't know exactly from where the annoyance is originating? - LolaRun
[+84] [2009-01-12 17:24:38] felideon [ACCEPTED]

It really doesn't have to do with the language itself. It's more of a question of programming style and religion.

First off, as others have mentioned, is the syntax. C-style programmers are used to dotted syntax. Objective-C, on the other hand, uses brackets. (Though I believe Objective-C 2.0 allows you to use dot notation for getting/setting properties.)

More importantly, however, is the paradigm. It's the perennial debate between statically typed and dynamically typed languages. Programmers are biased between them, so they will choose their language accordingly.

Objective-C and C++ appeared roughly at the same time. Whereas C++ added object orientation to C by combining it with Simula, Objective-C combined C with Smalltalk (which in turn took inspiration from Lisp).

So, in my opinion, it's not a question of why programmers hate or love Objective-C, it's a question of what OOP school of thought they are aligned to.

(1) Yes the 2.0 does allow the . syntax. - J.J.
(5) Objective-C 2.0 only allows you to use dot syntax to get and set properties (regardless of whether declared via @property). It does not allow arbitrary method call via dot syntax, which is what C++/Java/C# developers might expect from "allow the . syntax." - Chris Hanson
Thanks for the clarification. Edited my answer to reduce confusion. - felideon
(8) Actually, Chris, it does allow any method which has no argument to be called using the dot notation. As in, pool.drain; - it might be icky, but it's permitted. - Graham Lee
(3) Yes and no. I agree that it's the classical religious debate between static/dynamic and the syntax or whatever, but coming from other "modern" languages/frameworks/environments/ides, I just can't believe that this is the best Apple can come up with. As a developer, would you rather write an Android app in Eclipse/Java or an iPhone app in XCode/IB/Objective-C? For me it's not even close - Rich
(23) Objective-C isn't something Apple came up with. Objective-C was at the root of NeXTstep and was inherited by its descendant, Mac OS X. Debate rages on both sides, but one could easily ask whether C++ was the best Stroustrup could come up with. ;-) As far as developers' preference... the platform sure doesn't seem to inhibit people from flocking to the iPhone. Java is nice, but for GUI apps on a single platform, I'll take well-developed native tools that save me programming time any day of the week. - Quinn Taylor
(1) @Rich: Having spent almost a decade on Java programming before moving to Objective C (I was doing pretty much all Java from 1.1 on including desktop clients), I prefer Objective-C, or at least like it just as much. It makes some dynamic things a little easier. Objective-C has just as rich class frameworks as Java, and the language has quite a lot of thought and time put into it at this point. - Kendall Helmstetter Gelner
(1) -1 for you; IMHO this is a terrible answer, and I can't believe Brad Larson has accepted it as the top answer. What you've written is a totally non-pragmatic response. The question is explicitly about the language, otherwise the question could be asked about C/C++/Java with no difference in answer, which clearly isn't the case. - KomodoDave
In objective-C it seems that properties are referenced by dot operator whereas methods are called by using message passing to the object inside square brackets. What's the reason for the double-standard? - Arunabh Das
To those who say "this is the best Apple can come up with".... The NS, in something like NSString, stands for NeXTSTEP, the company (founded by Steve Jobs) that Apple bought and turned into MacOS X. Although not a part of Objective-C itself (it's Cocoa, the foundation API on top of the language), it shows that Obj-C was around long before Apple got their grips on it. Don't blame your hate and insecurity of a language on Apple. - Ethan Allen
[+73] [2009-01-12 16:55:54] Chuck

Objective-C is kind of primitive compared to other languages in the same mental space. It's radically object-oriented, but only to a point and then all of a sudden it's just plain C. The way it combines a Smalltalk-style type system with a C-stye type system has a lot of seams showing. And the named arguments are great for their self-documenting nature, but other modern languages get the same benefit with greater flexibility. Languages like Ruby, Python and, heck, even Lisp manage to have named arguments (and often more per method) without having every method call read like a treatise on the human condition.

Now that I'm done bashing Objective-C: I'd still much rather program in Objective-C than, say, Java or C++. In its day, Objective-C was a pretty clever hack. But now there are other major languages that operate in the same space as Objective-C and are more powerful.

I've been using Objective-C for seven years. Others have been using it longer and still seem to be happy, and I don't hate it, but I enjoy working in Ruby more.

(2) I have to agree for general purpose it's had it's day compared to something like c# the thing I like most is the garbage collector which can save so much time. Their is an optional garbage collector for objective c 2.0 but it's not well supported and doesn't work on the iphone. - PeteT
(1) Why do you say the GC is not well supported? It doesn't work on the iPhone yet, but will probably make it's way there before too long. Weak reference support is good enough for me... - Kendall Helmstetter Gelner
(1) @Kendall: There were several hidden caveats and provisos attached to garbage collection in Leopard (the current OS when petebob's comment was posted). For example, Core Graphics performance seriously suffered under GC, and Core Video would actually leak memory until your app exhausted the system's resources and crashed. - Chuck
"...I enjoy working in Ruby more." I think that the people at Apple have the same feeling, which is why they threw their weight behind MacRuby. Too bad it can't be used on their managed platforms. - Pinochle
@Pinochle: Actually, there's work going on to use Ruby on the iPhone. Two approaches are being proposed: 1) Port a garbage collector to the iPhone (somebody has apparently gotten MacRuby working with Boehm), or 2) Use autorelease pools. I would expect to see one approach or the other implemented by the end of this year. - Chuck
If that of yours is a reference to Hume, then it's a tratise on the human nature. :) - gurghet
[+38] [2009-01-12 16:34:44] Paul Dixon

A good language helps you think in a different way. I came to Objective-C after getting an iPhone and fancied learning how to write for it. I liked what I found! I'm an experienced C++ developer, and the concept of categories struck me as an interesting way of constructing and extended class libraries, so in that regard, it was worth learning!

(2) Same exact story for me. - Pat Notz
(23) I truly appreciate it when people have an open mind about different technologies compared to their own go-to technology. It makes for a better developer who isn't scared to take a look at something different, I commend you. - Bryan Rehbein
(2) I am working on learning it right now for the exact same reasons - instanceofTom
(1) it is worth learning - LolaRun
[+32] [2009-01-12 17:59:02] philsquared

I think there are two things that put people off the most initially:

  1. The association with Apple. While Objective-C was not invented by Apple language - nor is theirs the only implementation [1] - it's only really Apple who are using it in any mainstream way.

  2. The syntax, which looks very alien at first to people from a C/C++/C#/Java background.

When you start using it for a while, other differences tend to build on prejudices from those initial reactions and reinforce them (e.g. the static vs dynamic thing).

Like many, I started using ObjC to write iPhone software (here's my plug cue again: [2]). It took me a few days to "get it", and a couple of weeks to really feel comfortable with it - but further a-ha moments where further down the line. The things I really like now are:

  1. The argument labelling syntax. While many people think of these as named arguments they are not exactly the same thing. And when you get used to the narrative naming style it's actually very useful. I find it difficult to go back to languages that don't have it now.
  2. The dynamic dispatch nature. ObjC has the best of both worlds. Where performance would really be harmed by the dynamic lookups for method calls, you can still drop back to raw C - and most low-level APIs (in the Apple stack) are still C. But, really, for most applications - especially GUIs - it's absolutely fine (after all the iPhone is a constrained environment and I've not yet found it to be an issue).

Beyond the initial "getting used to it" phase, the biggest moment for me was when I ported a big chunk of my original code into C++ (because I wanted to do a lot of small allocations into different types of containers efficiently, and C++ seemed to be a better fit). Although I used boost libraries - including BOOST_FOREACH (which handled a lot of boilerplate), I still found that the C++ code was vastly more verbose, full of boilerplate and less expressive (and I've been doing C++ for about 18 years).

I don't know if I'd say it's my favourite language - or if that even has any meaning these days - but it certainly has it's place and I'm glad I learnt it - even apart from the iPhone development.

[Edit] I originally had a plug here for my ACCU conference presentation on Objective-C [3], which took place last April. Since people still seem to be reading this (I still get votes up from time to time) I'll update the plug to my Stackoverflow DevDays (2009) presentation on iPhone Development [4] that's coming up soon in London. I'll be spending about half the material on pure Objective-C.

[Edit 2] I'll update my plug for the Stackoverflow conference to my blog entry covering what actually happened [5].


Okay, this is ancient, but I just wanted to clarify - Objective-C IS an Apple language - they bought the company that owned it way back in 1996. - Charles Boyung
Fair point, Charles. I meant that it wasn't invented by Apple and there are non-Apple implementations. - philsquared
Edited to reflect that now - philsquared
+1 for you. If this answer emphasized the inherent readability of (a) Obj-C method signatures and the square bracket notation vs (b) dot syntax with no parameter naming then it would be perfect. - KomodoDave
[+15] [2009-01-14 00:16:27] Paul Robinson

Jonathan Wolf Rentzsch wrote the ultimate answer to this question way back in 2003:

Original blog post is dead, but here is a Wayback Machine link: 10 Things I Love about ObjC and 15 Things I Hate about ObjC [1]


(2) That was published in 2003, which makes me wonder how many of the negative points were addressed by Objective 2.0? - Kent Boogaart
(2) In Objective 2.0 were addressed at least: Hate 8: Hard to Write Good Getters/Setters Hate 11: Class unloading - IlDan
(1) You can also pass objects on the stack (#7) via blocks. - Kendall Helmstetter Gelner
(5) The linked article is dead. - Seamus Campbell
Just found its ghost :) - acjohnson55
[+10] [2009-01-12 16:44:49] Adam Byram

1) Syntax - I never liked SmallTalk and I'm primarily a C# dev these days, so the syntax was quite a change. The named arguments didn't make that much sense for a bit.

2) Framework/Base Classes - When I first started trying to do things in Objective-C, it was extremely frustrating because there were only a handful of classes to use...which felt like a lot of power was lost (compared to using something like the .NET framework). Everything just felt more difficult than it should have been for basic tasks.

After having used the language quite a bit more (and having built an iPhone app now), neither of those have been a problem. I do like the syntax now - it doesn't feel odd at all now - and the framework that is there has tons of power, it was just hidden away in additional methods that I hadn't noticed. Until you go through and really read all of the documentation on the core objects, it's easy to overlook the advanced methods that are already in place.

[+9] [2010-01-11 18:28:26] Kendall Helmstetter Gelner

I think a lot of this stems from people not getting past the syntax and C heritage.

They see the programming looks a lot like C, and so think programming in it must be like C. Only it's nothing like C. You are using whole different libraries, different method call syntax, not really using pointers, etc. etc.

They see you "have to manage your own memory" and assume that is like C. But reference counting is not really anything like using malloc, especially with Autorelease thrown in the mix. It's a lot more like working in a GC environment than dealing with Malloc.

They see braces around calls and named parameters, and think it looks way too cumbersome - even though as with any modern IDE the typing cost of a method is almost nil or at least constant for any degree of complexity. Also others have mentioned how they like named parameters being added to other languages now - well Objective-C has always had them, and furthermore has a very nice convention built up around how you do the naming. Also people cannot see the tremendous flexibility behind message passing for calls, they just think call() has been replaced by [self call] and think they are pretty much identical apart from syntax.

I've see the comment repeated a few times that programming in Objective-C is like going back 20 years. The remark is half-accurate - it's like going back in time 20 years and then going forward 20 again, only in a different direction. Objective-C is as modern as any language, it's just that it took a different path to get to where it is today rather than following the C++/Java/.Net evolution chain. Objective-C is a kind of alt-history (or even steampunk) variant of other languages, because it has come to where it is from different choices taken and once you understand those choices it makes a lot of sense. And it continues to evolve in well-thought out ways, which is really the most important thing.

Objective-C's "named parameters" are nothing like the named parameters people love in other languages. NSWindow doesn't have an init method that takes the named parameters contentRect, styleMask, backing, defer and screen — there's just an initWithContentRect:styleMask:backing:defer:screen: method. You can't reorder them, can't omit ones you don't care about. The name is atomic, and the only difference from a regular function call is that Objective-C syntax puts the argument values after colons in the method name rather than all after the name. - Chuck
(2) Since a real IDE would just insert the whole call for you OR present a method call choice with them explicitly ordered all at once anyway, why would you care if you could re-order them? As for optional arguments, you can usually either pass nil, or use variants that omit something you don't want to pass. Being able to omit any argument seems more flexible at first but makes writing the actual implementation harder, with very little gain for the caller. - Kendall Helmstetter Gelner
(3) I disagree. Writing several separate methods, each a slight permutation of the other, is much more taxing than (for example) Python's syntax of def init(contentRect, styleMask=NSCommonWindowMask, backing=NSBackingStoreRetained, defer=false, screen=NSScreen.mainScreen()). And the fact that an IDE can help you work around a language's failings does not fully negate those failings, it just makes them more bearable. Otherwise, it's like saying x86 assembly is an awesome OO language because you can write Objective-C and compile it down to assembly. - Chuck
(2) In practice it's two, perhaps three methods with different levels of use. I find mixing up defaults with initialization to not be that great for clarity, even if it's less typing. You are basically trading off intelligibility (which is needed repeatedly) for ease of typing a class definition (which is only done once). As for "bearable", the difference is that IDE's help you produce larger volumes of code you could read. In your example you could spit out a lot of assembly quickly from an IDE that produced higher-level blocks but would understand none of it. - Kendall Helmstetter Gelner
[+8] [2009-02-09 09:31:38] Unreality

I just started learning Objective-C, and there are two things about Objective-C that I don't really like


CGRect frame = imageView.frame;
frame.size.width = 100;
imageView.frame = frame;

I want imageView.frame.size.width=100; in one line


componentsSeparatedByString() instead of split()? :(

I want some short and common language function names that are easier to remember


oh and a new one:

3 Concating two strings: "one" + "two"

[NSString stringWithFormat:@"%@%@", @"one", @"two"];

Very developer unfriendly.

I feel that long method names is a problem that's completely solved by using XCode and auto-completion. I rarely, if ever, type out method names any more. Honestly, I think the readability it brings is worth it, and the extra typing burden is next to nil. - David Liu
usability of the programming language is the key. When trying to find a method name, don't ask your programmer to 'think'. Most languages used "split" as the function name, I guess most programmers can recall the word "split" without even needing to "think" ? - Unreality
(1) @Unreality Java's string concatenation isn't really any better, they just have syntactic sugar. "one" + "two" is converted to new StringBuilder().append("one").append("two").toString(), so the actual code is even worse. - CajunLuke
(2) If you really miss the split method on NSString, feel free to add it yourself using a category. - Dave DeLong
[+7] [2009-04-20 05:54:52] Caleb Vear

The main thing I don't like about Objective-C is that when you want to send a message to the result of another message it can be a pain if you forget to put your two '[' at the start of the line. This happens to me fairly often where I think I want to send this message and then straight after writing it I think I want to send some other message to the return value. I then have to move back to the start of the call and add the extra '['. I imagine as I use the language more this will probably happen less, but at the moment it's a pain.

Another issue is that the XCODE IDE code sense just doesn't seem as good as what I can use in Visual Studio. It suggests lots of things that aren't relevant and sometimes doesn't even suggest things that are. This can be a bit of a pain when you're learning how to use the provided APIs as you can't just browse through all the methods and properties that are provided by an object.

(3) That's may main beef with Scheme verses Python: it's so much more natural to write obj.method().method2().method3() than (method obj) oh wait I meant (method2 (method obj)) oh wait I meant (method3 (method2 (method obj))) -- in the end it's the same but it's more work getting there. - Jared Updike
Good Objective-C editors, including TextMate and Xcode (as of Xcode 3.2) will automatically add the additional opening bracket if you write [obj method] the decide to add [obj method] otherMethod]. - Barry Wark
(3) Actually in Xcode you just add another ] at the end and it inserts at the beginning too. no need to move back to the beginning of the line. - ADAM
[+7] [2009-09-06 04:51:27] Jeremy Friesner

I tried my hand at a bit of Objective-C programming (for an iPhone app) and didn't much like it, mainly for the following reasons:

  1. No constructors/destructors. That means that despite having reference counting, you are still required to remember a set of (fairly arbitrary) "conventions" about when to manually increment or decrement reference counts, and if you apply them wrong, your iPhone app will crash or leak memory. With C++, on the other hand, you just use a shared_ptr (or similar) and things "just work", resource-wise.
  2. Lots of errors that in C++ are caught at compile-time are not caught by Objective-C until run-time. For example, if you misspell a method name or leave out a required argument, the code compiles but then gives a run-time error when you run it. This means you spend a lot of time running, fixing, re-compiling, and re-running your program until all the dumb mistakes have been caught -- in C++, by the time the program compiles, most of the dumb mistakes are already taken care of
  3. Not really an Objective-C criticism, but I found the X-Code IDE really clumsy and annoying to use. I much prefer good old vi-and-make.
  4. Lastly, Apple's object model just didn't make a lot of sense to me. Maybe my brain is just too calcified, but there were so many managers and delegates and so on to keep track of that just building a simple GUI seemed like an exercise in black magic. By contrast, I've been using Qt for years and have always found its APIs to be immediately understandable.

(3) 1) You can have singletons in Obj-C too. And how is "dealloc" not a destructor? 2) You are given warnings when you call messages that will not be understood by the objects you are sending to. Ignore warnings at your peril. 3) XCode is much better than you think once you get used to it - I came from Emacs/make so I know what you mean, but honestly XCode is pretty good. 4) I find the API one of the best GUI systems I have used in terms of speed in getting a complex UI up and running. - Kendall Helmstetter Gelner
+1 for #2. Hate late errors. - Alex Feinman
[+7] [2009-01-12 16:47:48] mouviciel

I neither love nor hate Objective-C, this is just another language. But I do love Cocoa for its ability to let the developer focus on its application.

totally agree... - chanok
[+7] [2009-01-30 07:59:51] Andy Dent

Whilst it has a far richer OO model than either Java or C++, it suffers all the shortcomings of traditional C. I think the C side leaves many people on the beach.

More seriously, it comes down to whether you think of OO as function calls or messaging. Objective-C emphasizes the Smalltalk model of messaging.

A much better language to use is Objective-C++ which you enable by using the .mm suffix on your files. It also allows you to use C++ classes but, more relevantly, the C++ language extensions over C.

the problem with obj-c++: you'll have to write a lot of code to stitch c++ objects and obj-c ones, e.g. you have a C++ string and want to use a cocoa API which wants a NSString*, or struggle with object ownership and reference counting. The way of doing things in a language is fairly different from the other one, and unless you have to you generally want to avoid mixing both. Not always having choices is the good thing, especially if you want to preserve consistency. - pqnet
You should note the main point in my reply was "more relevantly, the c++ language extensions over C." There are a lot of benefits in C++ other than the OO which can be used with Objective-C to provide more robust code inside your methods. - Andy Dent
[+7] [2009-01-12 18:30:58] Nick

Personally it wasn't the brackets that got me on the syntax, it was the use of colons in arguments. It was like remembering to use "$" in PHP. I am just not used to typing that character in programming.

I also recently had a "port some obj-c I had written to another language" moment where I realized how articulate some of the code I had written was and how much excess glue was required in other situations. My latest opinion is that the mistakes made while internalizing the syntax (which are easily caught in the IDE) are well worth the trade off in flexibility and power.

[+5] [2010-08-31 13:26:52] Mikeyg36

I've been learning Objective-C for a few days now, and trust me, I want to like it but I'm having great difficulty finding the beauty. This is not a case of fearing change and different - when I first saw Python I thought it was beautiful, heck I even quickly found Perl to be a nice language, in spite of being littered with $ and other syntactical irregularities coming from a C background. We just have to face it, a language that needs explicit, verbose methods for such primitive operations as STRING concatenations is lacking. Since I want to get into iphone development, I am stuck learning this, so I pray that in a few weeks I'll have a moment of clarity and be able to return to this thread and renounce this post.

(1) The language doesn't NEED verbose methods for anything. It could easily use the same exact short method signatures as everyone else. It just doesn't need to because modern IDEs make dealing with verbose method signatures a non-issue. - David Liu
[+5] [2009-03-01 01:02:59] Paul Lefebvre

I can't say I hate Objective-C, but I find it's syntax to be just different enough to keep me from diving into it.

I really ought to spend more time with it. Like anything else, everyone tends to prefer the programming language they use most.

"Like anything else, everyone tends to prefer the programming language they use most." Not really, some find it quite fun to learn new programming languages. - Daniel W
(1) You tend to prefer languages you don't yet know? I like to learn new languages too, but I find that odd. - Paul Lefebvre
(2) Well I do prefer Haskell, and I don't really understand it. It's like a piece of art, a puzzle if you will. If you see enough people doing much with extremely little code you start to appreciate its conciseness. You also want to learn it. - Daniel W
I should also mention that I use Java, C++ and C# the most because of my employers and school forces me. And even my hobby projects are done in C++ because of its performance. - Daniel W
(1) "And even my hobby projects are done in C++ because of its performance" I am not convinced there is much of a performance difference between C++ and Objective C. - Jacob
[+4] [2009-01-12 18:02:05] jcollum

1) The use of the minus and plus (- +) operator for something other than math. A keyword would've been just as good and much easier to read. From "An instance method is marked with a hyphen/minus sign". That just seems like a terrible design choice. Other languages repurpose symbols like % but I can see reasons for that, % is just shorthand for "divide by 100."

2) All the brackets. Everywhere. The dot operator makes things much easier to read.

(1) Agreed on +/-. However, the square brackets are an aquired taste. I found them difficult to parse at first simply because I wasn't use to them. But now I think it actually makes things clearer. YMMV, of course. - philsquared
(2) I disagree, what characters would be better? A single character works well, and in the context in which they are used (method definition) there is simply no confusing them for math. Furthermore the fact the symbols are related is good since you are talking about instance level vs. class level - $ and # for example ave no relation (and frankly probably a lot more confusing due to presence in other languages). - Kendall Helmstetter Gelner
I use + and - all the time in plaintext to-do lists. They seemed like logical choices of fake-bullets that also provide a little additional info. (And the brackets are acquired, yes.) - andyvn22
@kendall: how about symbols that have no mathematical meaning? @ # $ ~ _ (no i'm not cursing) - jcollum
@jcollum :As I said before, I think that symbols that relate to each other but are not traditionally code related are much better - I think a method definition would look really weird with a preceding $, as you use those to denote variables in other languages. A # would look like a comment (and I think totally confuse auto-code-formatters such as the ones here on Stack Overflow). _ is usually used with variables... ~ might work, though again I prefer symbols that are related as +/- are, and ~ has no mate so to speak. - Kendall Helmstetter Gelner
On +/-: Hmm, I've only been working with Obj-C for a couple months now (as compared to Java/C through high school and college), and it seems like second nature now to me. I guess it's a little confusing at first, but it's not something that I would consider a downside after a while. But what I don't like is the lack of protected methods, and how you're supposed to do private methods (create a private category inside the .m file, though I suppose that makes sense). - David Liu
[+4] [2009-01-18 18:43:27] Chris Stewart

The more I use Objective-C, the more I appreciate it for being different. Personally, I like the message sending feel of the syntax. Not using the dot-operator gives me the feeling of sending a message to an object rather than calling something. Sounds stupid possibly, but it's a distinct difference for me.

I come from a C#/Java background and never learned C. Objective-C feels like a nice bridge from those higher-level object oriented languages to the lower-level C language.

You are probably not the only one seeing a difference between messages and method calls where there is none. - Christian Rau
[+3] [2009-01-12 16:40:57] Nolte

I think it has to do with the message-based threading and function-calls. The whole idea seems foreign at first. There also aren't a lot of good books on Objective-C outside of what Apple has to offer. O'Reilly has a book on Obj-C & Cocoa, but it's woefully outdated last time I checked.

(1) If you mean "Programming in Objective-C", a 2nd edition was published last December: - Dour High Arch
Thanks for the tip, Dour. - Nolte
[+3] [2010-07-19 01:16:35] Spanky

Platform. Up until the iPhone, how many Mac developers were there? I'm assuming a lot less than Windows developers. Not slamming Mac developers by the way, I was one of those minority developers.

On Windows though .NET and C++ are popular, well documented, and have tons of external literature and how to's and libraries.

Relatively speaking Apple was lacking in external literature until the iPhone really took off. Even now there is still a lack of solid external literature out there compared to what you can get for C++ or .NET.

Education too. Is Objective C taught in college? Java is, C++ is. Is there a college that teaches Objective C? Is there a class somewhere that goes beyond Cocoa and really gets into C and the memory management etc.?

I'm not sure if there is an Objective C port to Widows, but I know I've never been on a project that's used it, whereas I have been on one that used Mono, a .net port, on the Mac.

I wish that there was more around Objective C in external literature, training, and porting. But regardless, it does a good job. It's just hard to pick it as my mainstay when I work across platforms and need to get up to speed quickly.

Stanford has an iOS development class. You can download videos of the lectures on iTunes. So Objective-C classes are rare, but they do exist. - wmil
[+3] [2010-09-15 18:29:20] morgancodes

I'm having a really hard time with the fact that I need to edit both the header and the implementation every time I want to add or change a method signature. I definitely have not found my groove with Obj-C yet.

(1) Isn't this the same in C? - David Liu
Yeah, it sucks in C too. Shouldn't modern languages eliminate that kind of cruft? - benjismith
[+2] [2011-07-21 14:03:02] Tavison

I've been coding in Objective C about 3 months now doing iPhone development. I've been programming C++ for about 20 years and c, basic, and assembler before that. My feeling is mixed. I don't think I like Objective C. I know I don't like XCode. I do very much like Cocoa Touch.

I admit that I am in the camp that favors strong type safety. I just can't for the life of me understand why this should compile and further why it's a good thing it compiles.

UITapGestureRecognizer* tap = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];

I wrote this code cutting and pasting to get a bunch of gestures in and missed one. It didn't even give a warning. Finding the bug was a nightmare.

I do like the named parameters, but they took a bit to get used to.

I don't like manual management of a ref count. It's bound to go wrong. If I don't have it like in C I am careful to manage my memory and have clear handoff functions. Factory functions clearly place cleanup responsibility on the caller. Objective C I find I have to learn which functions retain the object and which autorelease or if I alloc and hand the object off what retains it and what does not. It's memorization of too many things. In C++ if I have a raw pointer I should be responsible, if a shared pointer then I am not, and if a reference then I'm at the whim of the owning object.

There is no comparison when it comes to available libraries. STL, Boost, Loki, for example.

I don't like the inconsistent naming convention. The poor autocomplete just adds to the problem.

XCode is not fit for consumption. It has nice ideas half implemented. It in no way compares to what is out there for IDEs. No matter what anyone thinks of Objective C, there can be no defense of XCode compared to Eclipse or Visual Studio. When I work on game consoles like PS or Wii we develop in visual studio and plug in our own build chain.

Cocoa Touch is outstanding! Full access to a very good library and the ability to mix C++ when I want those features is very good, and I know is a feature of the language. I'm building almost every game using UIKit as the dominant technology. Complaints that it's too slow etc, are just wrong. I like UI builder a lot, but as with everything XCode it's largely unfinished. Often I set a value in UIBuilder and it doesn't come through. There's just no excuse for that.

Apple created the iPhone concept and drew a lot of us to Objective C. Android is allowing C++ and already Cocos2d-x is out and surpassing Cocos2d. Android is predicted to dominate the market. C++ is coming to an iPhone near you. It will be interesting to see if allowed to choose how many people will adopt Objective C over C++.

Regardless of what I ultimately think of Objective C, learning new languages help us become better programmers. Things we like in one language have a habit of creeping over and that is helpful to everyone.

[+2] [2009-02-09 09:55:32] Jas Panesar

Preference, familiarity, insecurity, and jealousy varies.

Every language has it's pros and cons or it would not have existed long enough.

[+2] [2010-03-29 04:57:41] ctpenrose

I have used Objective-C for more than 20 years and I have always been surprised that it hadn't become more mainstream among programmers. It is decidedly mainstream in the Apple sphere now, but this is actually only a recent development. I remember a somewhat soft-headed Apple exec telling me in 1998 that all MacOS X developers would soon be coding in Java. And many current Apple APIs are staunchly C++ friendly.

Objective-C is far from "a clever hack" as described earlier; it is a deeply elegant one which balances the machine pragmatism of C with the flexibility of dynamic typed object orientation. If you have an opinion about Objective-C but no exposure to NeXTstep or Cocoa APIs you are probably missing something about this balance I speak of.

[+2] [2010-04-02 03:10:36] Avizzv92

I learned Objective-C as a first language, so going into it I had no opinions or bias towards any other language. I enjoy writing in Objective-C, I personally prefer using the brackets instead of dot notation. Perhaps since I went into it with no prior experience in any other language, it made it easy to become accustomed to it and program myself to think in that way (no pun intended).

I'm now learning Java, although it seems to be a nice language so far, I like Objective-C more. Perhaps as I become more comfortable with Java I might begin to like it just as much, but for now I enjoy Objective-C. There isn't one definitive feature that makes me like Objective-C more, it's just as a whole the language "feels better" (for lack of a better phrase).

This is all coming from a person who programs as a hobby and not a job at the moment.

[+1] [2009-12-09 06:22:52] Sumit M Asok

I'm an iPhone trainee, and all others in my team, with Java background are hating Objective-C They don't even understand interface and implementation, because they are relating it with Java's interface and implements.

Many others are trying to relate it with C++. Avoid learning it by relating it to some language, learn it as a new language. All will love it as I do.

[+1] [2009-01-12 19:44:32] BeWarned

The biggest thing for me has nothing to do with whether Objective C is a good language or not, it has to do with targeting multiple platforms. I can share very little code right now if I want to develop for Android (Java), Symbian (C++), iphone(Obj-C), or whatever. You can't even share libraries between these platforms. Writing for the iphone kinda locks you into their ecosystem the most, since Objective C is the least wide spread of the aforementioned languages.

It would be nice if these mobile platforms supported some high level environment where the developer could leverage more of the mature, understood technologies being use outside the mobile world.

It will be interesting to find out more about Palms new approach.

(1) It's true that for the GUI, and certain other APIs, iPhone dev requires Objective-C, but you can still write C and C++. Many of the APIs are raw C APIs, which you can use any of those three languages with. In my app, my core processing component is all in C++, and I use Boost with that - philsquared
(1) Palm's new approach seems to be solely web apps which of course also work on the iPhone. So the most reuse would seem to be smart web apps. - Andy Dent
If the iPhone has the most number of users actually running applications, how is Objective-C the least-wide spread mobile language? I would argue the other way, that Objective-C is actually one of the most wide-spread (you could argue Java is, but I say that's not really true since Android development is nothing like MIDP J2ME development). - Kendall Helmstetter Gelner
[+1] [2009-01-12 16:55:32] Darron

It's a strange mix of a statically typed language (c) and a dynamically typed language (Smalltalk). That provides something for every developer to both love and hate.

(1) You mean "statically" and "dynamically" typed languages there - C is actually weakly-typed (supports casts), and Smalltalk is strongly-typed (has absolute object identity). - Chris Hanson
Okay, I'll clean up the terminology. - Darron
[+1] [2009-01-12 16:38:39] Ubersoldat

I don't hate Objective-C. Made a client app for Mac coming from a Java background and things were pretty slick. I believe people may dislike the language for being so MacOS centric.

But now there's Android and you can just write stuff in Java :) - jcollum
[+1] [2009-01-12 17:13:15] Pat Notz

Objective-C is not an Apple language -- it's been around for a long time and is usable on non-Apple operating systems. Cocoa, though, is all Apple. See also What’s the difference between objective-c and cocoa? [1]


[+1] [2009-01-12 17:36:28] J.J.

I don't have much of a problem with the language.

I at first didn't like the Frameworks I had to work with. They all use camel case [1]. Where as I use underscore separated [2] words for my variable names.

But the more I got used to Objective-C and Cocoa the more I liked the clash. It helped me understand what was part of the framework and what was not.


do you mean underscore_separated or really use hyphen-separated names? - Andy Dent
ya underscore. sorry. - J.J.
[0] [2010-01-11 17:15:48] Chris

Some of the hatred for Obj-C is time vs. money. When you've used a language like C++ for 15+ years you want to make money with a THAT.

You don't want to stop and go learn a whole new language that in two weeks will only have you doing basic buttons and simple tasks.

Then there's XCode and Interface Builder. These programs will have most developers pulling their hair out! Horrible!

All of this would be true for any language not just Obj-C. Java and ActionScript succeed because they are very close to C/C++ in the minds of developers.

You're wrong about Xcode and IB (at least the "most developers") part. Visual Studio is more powerful than Xcode in some areas, but overall I just cannot stand the interface. Window and panel management is a nightmare, the interface is cluttered, help documents are usually written by someone who knows no more about the software than I do ("Press the 'add new entity' button to add a new entity"… Thanks buddy!). - kubi
So what? Most real Mac developers find Visual Studio horrible. - Sven
I have to stand up for Chris. XCode is just not up to modern IDEs. You can bash VS if you'd like, but it doesn't compare to Eclipse either. - Tavison
[0] [2011-11-08 14:26:05] Marc

I come from a Java Background and I write Android Apps. All my Customers want an Iphone App as well, so I decided to learn Obj-c and I'm having a lot of fun doing so. I think the language looks very clean and stylish very apple ( I know its not an apple lang:). The main difference for me is Xcode I'm loving it. It looks so nice and works alot better then. I can get my Motodev eclipse working especially the bugs are not existant. I haven't written my first Iphone app yet but I'm really looking forward to it. I am excited about learning obj-c as I never knew that, it is basically build abon C which I always wanted to learn, but never saw the reason to do so other than interest. I like the brackets - makes the code more organized, I think. And I really like the header Idea especially for coders wanting to extend my apps.