Live data from Hacker News

I loved C. But it always fell short for me. Objective-C fixed that.

red-sweater.com

1–10 of 82 posts

Re: I loved C. But it always fell short for me. Objective-C fixed that.

#2
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.

Re: I loved C. But it always fell short for me. Objective-C fixed that.

#5
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.

Re: I loved C. But it always fell short for me. Objective-C fixed that.

#6
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.

Re: I loved C. But it always fell short for me. Objective-C fixed that.

#7
post #6

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.

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?

Re: I loved C. But it always fell short for me. Objective-C fixed that.

#8
post #2

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 toget…

One of these days I will write a detailed account of my experience learning Obj-C, but for now I'll say this:

The fact that Obj-C takes C and adds objects on top is its biggest flaw, just like with C++. Worse than C++ though, Obj-C doesn't even attempt to fix at least some of C's more glaring flaws... you get the whole language, quirks and all.

Re: I loved C. But it always fell short for me. Objective-C fixed that.

#9
post #7
post #6

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.

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?

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.

Re: I loved C. But it always fell short for me. Objective-C fixed that.

#10
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!)

Post reply on HN