
I loved C. But it always fell short for me. Objective-C fixed that. - falling
http://www.red-sweater.com/blog/2256/objective-c-is-the-language
======
praptak
Meh. I do not program in Objective-C but I think I can provide more reasons
for liking the language than the linked article contains :)

Reason 1: When you need what C provides, it is right there for you (being a
superset of C)

Reason 2: When you need what C does not provide (basic reflection, generics,
polymorphism, whatever) it is in the "bracket" part of Objective-C.

Reason 3: The two above do work quite well together - the impedance mismatch
is minimal, compared to e.g. Python with extensions written in C.

~~~
IPlusOneYou
Or you could pick a well thought out OO language like Java or C#, maybe even
Python. Unfortunately you're trapped using the abomination for iPhone
development unless you pick Monotouch.

~~~
plinkplonk
"well thought out OO language like Java"

Not even Java's fans would defend it as a "well thought out OO" language.

Since this is _Hacker_ News, it maybe appropriate to point out that nothing
prevents you from building whatever specific flavour of OO you want on top of
the Objective C runtime, if you want it badly enough.

------
simonh
Would anyone care to comment on the state of Obj-C outside the Mac/iOS
platforms? The impression I get from previous posts on this is that the
utility of Obj-C is closely tied to the functionality provided by the
(proprietary) Cocoa platform.

Since there are so many developers from outside the Apple ecosystem learning
Obj-C in order to develop for iOS, is there any signs of a movement in the
other direction? Are developers who don't think of themselves as purely
Mac/iOS developers trying to take Obj-C back with them to other platforms?

Posts about how great or poor Obj-C is as a language are kind of irrelevant
really as long as it's (effectively) the mandatory language for development on
Apple platforms, and isn't much used beyond that. In that situation there are
no choices to be made based on opinions about the language's merits or flaws,
so they are largely moot.

~~~
atomicdog
I get the impression most developers use Objective-C because they _have_ to,
rather than because they want to. Take a look at the Tiobe graph for
Objective-C:

[http://www.tiobe.com/index.php/paperinfo/tpci/Objective-C.ht...](http://www.tiobe.com/index.php/paperinfo/tpci/Objective-C.html)

I have a feeling it would see a distinct dropoff in usage if Apple were to
change their focus to, say, Java or C++.

~~~
gte910h
It's my favorite C variant (including C itself).

~~~
Derbasti
I agree. It is exactly what the name implies: a somewhat minimal object
orientation layer on top of C.

I wouldn't say the same thing about Cocoa though. Cocoa is good, but not
_great_.

~~~
gte910h
And I'm not without my criticisms of ObjC. I can't stand the lack of
namespaces, for instance.

------
cageface
Objective-C is a nice UI glue language but I wouldn't want to write anything
of any algorithmic complexity in it. The data structures are just way too
awkward and manual boxing/unboxing of primitives puts it way over the top.

I write my iOS app UIs in Obj-C but the brains are in a C++ core. The new
C++11 support in LLVM 3.0 has tipped the balance that much further.

~~~
blub
If you think Obj-C is nice, try Qt's QML - it's a declarative language with
JSON-like syntax that also allows you to embed JS and interact with C++.

Probably one of the easiest and more powerful ways to create an UI, but not as
mature as other consacrated frameworks and not available on iOS anyway.

By the way, how do you handle unicode in the C++ core?

~~~
cageface
I'm kind of stuck with Obj-C on iOS but I can totally believe you could build
an abstraction layer like the one you describe over vanilla C++ that would
give you most of the benefits of Obj-C. Clang's Obj-C++ support makes it
pretty painless to mix Obj-C and C++ as long as you clearly delineate
responsibilities.

So far I haven't had to do any serious string handling in my C++ engines
(mostly audio apps). The new unicode stuff in C++11 ought to make this
manageable but I haven't actually tried it yet.

------
TorKlingberg
Is anyone using Objective-C as a systems language? That is, without Cocoa and
other Apple libraries and APIs? Otherwise, why is it worth comparing it to C?
Is anyone suggesting that Linus could write the Linux kernel or git in
Objective-C? Objective-C is more fairly comparable to Java, C#, Qt or GTK
rather than plain C.

Most people who say they like Objective-C actually mean they like programming
for Macs and iPhones.

~~~
jensnockert
Yes, I am. And it is fine, either using ObjFW, GNUstep (which is essentially
Cocoa) or just writing it raw with my own framework. It is a nice language,
and the C apis to the runtimes are pretty nice.

------
atomicdog
>Objective-C was Apple’s response to object-oriented programming

Apple's response? At its inception it had nothing to do with Apple and for a
long time was the language of NeXT. It's only since OSX that Apple has adopted
Objective-C.

~~~
rbanffy
NeXT bought Apple for minus US$400 million and renamed itself Apple ;-)

Apple's CEO came from NeXT, as did their lead software architect. OSX is NeXT
(ever wonder why so many things extend NSObject?).

~~~
codehalo
FYI, NeXTs' CEO was Apple's CEO first. The parents point is correct.

~~~
jballanc
Actually...no. Jobs was never CEO until after the NeXT merger.

------
Inufu
Am I the only one who thinks Objective-C is complete crap compared to Scala,
Haskell and the likes? Hell, even C++ is way faster to code in and provides a
better experience. Obj C is just immensely verbose. I'd love to be able to use
Qt + C++ to program iOS instead..

~~~
zerostar07
You 're not the only one. I too think speed of development and maintenance is
key. It's just that lots of people live in (and on) the Apple bubble. I think
Obj-c was one of Jobs' obsessions or else i can't explain why anyone would
want to force people to write code like that in 2011. I have a feeling that
Apple may open up their APIs now that he;s gone.

~~~
shabble
Does submitting to the App Store require you to provide source? If so, it
seems like a compelling reason to enforce a single language to avoid the
explosion in skills required for the app reviewers.

Otherwise, I have no idea.

~~~
chc
You aren't forced to use Objective-C, at least not any more than you're forced
to use Java on Android. It's just the native language of the system
frameworks, which you _are_ required to use. You can literally just have a
glue layer to talk to the Objective-C underpinnings and write your whole app
in another language (as long as that language can compile for iPhone,
obviously). The reason people don't do this is because for most people it
turns out to be less productive, not more.

------
joelthelion
People who like C should definitely take a look at Go. I think it can be a
good alternative for higher-level projects.

~~~
stock_toaster
I was personally a little off-put by Go. Some things just _felt_ a little odd
to me, after an admittedly small amount of time with the language (implemented
a trivial app with it to play around).

That said, I did quite like some aspects of it: goroutines, channels,
functions can be added to structs.

I am hoping that rust makes it out of the lab at some point.

~~~
dubya
My biggest annoyance with Go is that Google, a search company, gave their
language a completely un-Google-able name. I'm pretty sure the term "Go"
invokes special handling.

~~~
luriel
If that really bothers you, you can either search for 'golang' or you can use
this custom search engine: <http://go-lang.cat-v.org/go-search>

But really if that is your biggest issue with the language, I think they are
doing a pretty damned good job.

------
cmelbye
Maybe I'm weird, but I actually really like Objective-C. My mind likes how the
language works. I just wish there was more of a community around it so that it
could more easily be used for things other than iOS/Mac development.

------
rbanffy
Having learned object orientation with Smalltalk/V, I never quite liked C++
(to the point of procrastinating for 8 years before really touching it). It
felt just wrong.

Objective-C was always attractive (I like C), but its close association with
NeXT and Apple (and corresponding little support from other platforms) always
puts me off.

------
xradionut
I like C. I really like Smalltalk. But Objective-C really doesn't do OO well
enough for me to enjoy dealing with it.

~~~
xsmasher
Doesn't do OO well enough? That's not a complaint I've heard before. What
makes you say that?

------
lowglow
When I first started coding in Objective-C, I hated it because it just felt
"wrong". The more I learned the language, the more I enjoyed programming in
it. I still think some things are a bit awkward, but like anything new, it
just takes time to learn to love it.

------
algoshift
These are just tools. Each has its place.

Example: I wrote a GA-based solver in Objective-C. It worked but it was
painfully slow. I re-coded in nice-clean C. The plain C version was incredibly
fast and efficient in every way. Best of all, it is highly portable too.

------
Derbasti
The only thing I really don't like about Objective C is that message passing
is considerably slower than function calling. You just can not manipulate an
image using the `setPixelX:Y:` method in anything close to real time. Using
functions in C, this is no problem.

So, there you go: Write your algorithms in C, write your program logic in
Objective C. Oh, and I love how the OpenGL C API interacts so nicely with
Objective C and Cocoa!

That said, I have a fair bit of experience with PyQt. I would ditch Objective
C for something like MacRuby any day, but then I would (sorta) lose the
ability to drop down to C if need be. (Still, does anyone have any solid
experience in MacRuby? I would love to hear some!)

~~~
davedx
I think the nature of OpenGL's API (internal state, very simple C-style
functions - contrast with DX) means it is very portable. Java also interacts
nicely with it, as does C++, and I've not worked with WebGL but the very fact
it exists says something about it.

OpenGL is great. Really well designed :)

~~~
angersock
OpenGL is a good API, but it's design is fairly terrible, and its
implementations range from quirky to terrible (cosnider Intel's support for
anything above 1.4).

The notion of internal state is fine and well for only the most trivial of
programs--once you start doing something requiring multithreading nothing but
sadness awaits.

------
rndholesqpeg
I wanted to play with Objective-C for some numeric computing, but until
Intel's c++ compiler supports it there really was no point in even getting
started with it for me (sorry gcc)

------
jayfuerstenberg
Objective-C is a natural language to learn for developers coming from Java
too.

And you don't have to give up the power of C (memory pointers etc...) either.

~~~
xradionut
Objective-C is the choice if you are developing for Apple products. But coming
from Java, C# and Mono were a much easier switch.

------
ramitos
I've only coded a (really) simple app in Obj-c, but disliked the syntax.

~~~
beej71
Now, I've coded a lot of stuff in Objective C for iOS, and it works just fine,
and I actually think it's a pretty good language. I'm glad that Apple has
helped bring it more into the spotlight.

But ramitos is right; it really is a Frankensteinian bolt-on addition of
Smalltalk, syntax-wise. The message passing code simply does not look like C.

That said, I'd encourage everyone to give it a chance. I, too, had a negative
reaction to it when I first encountered it ("It's so ugly!") but you get used
to it, and then it's fine.

~~~
msbarnett
> The message passing code simply does not look like C.

Arguably that's a very _good_ thing, because passing a message has very
different semantics from calling a function. Making the syntaxes of these
operations identical would encourage a lot of confusion between two very
different operations.

------
angersock
So, where in this article did the author actually state _why_ Objective-C
fixed C for them? Where was a listing of C's failings or Objective-C's
strengths for their projects?

This is not really a good submission--it's got the rhetorical content of a
tweet.

