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.

+28  A: 

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!

Paul Dixon
Same exact story for me.
Pat Notz
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.
Redbeard 0x0A
I am working on learning it right now for the exact same reasons

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 :)
+1  A: 

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.

Nolte Burke
If you mean "Programming in Objective-C", a 2nd edition was published last December:
Dour High Arch
Thanks for the tip, Dour.
Nolte Burke
+7  A: 

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.

Adam Byram
+3  A: 

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.


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.

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.
+59  A: 

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.

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.
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
@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.
"...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: 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.
If that of yours is a reference to Hume, then it's a tratise on the human nature. :)

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?

Pat Notz
+66  A: 

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.

Yes the 2.0 does allow the . syntax.
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.
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
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
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
@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

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. Where as I use underscore separated 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.
+18  A: 

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 - 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: 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, 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 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.

Phil Nash
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.
Phil Nash
Edited to reflect that now
Phil Nash
+1  A: 

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.

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.
Phil Nash
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.)
@kendall: how about symbols that have no mathematical meaning? @ # $ ~ _ (no i'm not cursing)
@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
+73  A: 

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.

Brad Larson
well said, comrade
+4  A: 

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.


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.

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
Phil Nash
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
+10  A: 

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

10 Things I Love about ObjC and 15 Things I Hate about ObjC

Paul Robinson
That was published in 2003, which makes me wonder how many of the negative points were addressed by Objective 2.0?
Kent Boogaart
In Objective 2.0 were addressed at least:Hate 8: Hard to Write Good Getters/SettersHate 11: Class unloading
You can also pass objects on the stack (#7) via blocks.
Kendall Helmstetter Gelner
The linked article is dead.
Seamus Campbell
+2  A: 

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.

Chris Stewart
+4  A: 

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.

Andy Dent
+3  A: 

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

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" ?

Preference, familiarity, insecurity, and jealousy varies.

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

Jas Panesar
+2  A: 

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.

Paul Lefebvre
"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
You tend to prefer languages you don't yet know? I like to learn new languages too, but I find that odd.
Paul Lefebvre
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
"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.
+4  A: 

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.

Caleb Vear
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
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.

For me it boils down to one solid thing:

Every time I try to write something in Objective-C I feel like I've jumped back in time 20 years.

Let me explain the big ones for me:

  • No namespace support

  • Manually allocating/deallocating memory for objects:

    ExampleType *instance [[ExampleType alloc] init] to invoke the default constructor, and then having to remember to call [instance dealloc] or [instance autorelease].

Seriously. It's 2009. I'm STILL expected to deal with pointers and manually allocate memory? That's the epitome of the kind of code my dad wrote in the 80's.

Also, I don't know if Apple's heard about it but there's this little thing out there called AUTOMATIC FUCKING GARBAGE COLLECTION that bypasses the need to explicitly state that your object needs to be released when it goes out of scope. Not having that was excusable 10 years ago. But not now. When code exits a function, it should be smart enough by now to know what goes out of scope and deallocate it.

  • Manually boxing primitives. .Net gets this right by automagically mapping things like int to System.Int32, Java 5+ has autoboxing (at a albeit minor performance cost), but with objective-c, we're still left to the pitfall of primitives and objects

  • Generics. Ok. I get the whole dynamically-typed vs strongly-typed argument. Use NSMutableArray. blah blah blah. Why can't I make a NSMutableArray<NSDate> or NSMutalbleArray<MyCustomType>? C++ has it. And Yes, I understand I can include C++ in Objective-C projects, but that's a similar mindset of saying just reference C# projects in your VB projects to get the features you want in your solution.

  • No single standard for method documentation. Java has JavaDoc. .Net has xml comments. What does objective c have? Doxygen? Yeah... Thanks for INCLUDING THAT IN THE FREAKING SDK

Saint Domino
ObjC 2.0 has automatic tracing garbage collection.
Pavel Minaev
Lol. Garbage collection is only useful if you are writing slow poor performing C# / Java applications. Try write a server app, or some other sort of high performance data manipulation tool with garbage collection. You need some more experience before you can make such judgements.
I think if you are claiming you need to ever call [object dealloc] you don't really know enough about the language to critique it.I personally miss namespaces a little, but only from the standpoint of being able to lazily import an entire namespace worth of classes. Otherwise the naming convention is OK.Also, you don't need NSMutableArray<NSDate> since you can just have an Array filled with NSDate objects and send any messages in you like. That's the whole strongly/weakly typed thing coming up - I prefer that area weakly typed than have a ton of verbosity.
Kendall Helmstetter Gelner
I think your find that C# garbage collection is in most cases more efficient than hand coded deallocating of memory. In the same way that optimization is usually far better done by the compiler these days than most people hand coding assembler. The actual structure of the language is designed to be good at optimizing. Things have moved on. Have you heard anyone say C# is too slow for GUI development?
Tony Lambert
+1 I don't fully agree with the premise but I love the salty language :)
+1  A: 

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.
Jeremy Friesner
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

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.

Sumit M Asok

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!).
So what? Most real Mac developers find Visual Studio horrible.
+3  A: 

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.

Kendall Helmstetter Gelner
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.
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
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.
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

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.


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.


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.

+2  A: 

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.

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
+1  A: 

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.

Isn't this the same in C?
David Liu