Live data from Hacker News

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

red-sweater.com

51–60 of 82 posts

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

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

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

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

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

#53
post #38

Earlier quoted context omitted.

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

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 .

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

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

#54
post #34

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

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.

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

#55

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

Since it's not mentioned anywhere, Obj-C was invented by Brad Cox and Tom Love and NeXT licenced it from them.

to add, if you haven't read Brad Cox's books then you really should. They are not heavy technical, but give time to some serious ideas. They are a little hard to get ahold of these days.

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

#56
post #36
post #17

Earlier quoted context omitted.

I think it depends on what you want from the language. If you want to write C and gain some safety through the use of the message-passing abstraction, it's perfect. If you want a real high-level language, it's lousy.

With clang, ObjC is getting very interesting features that take it closer and closer to "real" high level languages, like GCD, ARC and blocks. I'd still like more type safety, but the evolution there is slower and would need more fundamental changes to the language and abandoning C compatibility.

I dunno--in an age where we have actual, halfway decent garbage collection, referring to ARC as something that might compete favorably with those "real" high level languages makes my eyes go a bit crossed.

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

#57

Earlier quoted context omitted.

You can actually go one step further with your "Reason 2". Many may not realize this, but everything that you can do with the "bracket" part of Objective-C you can also do with straight-up C and the Objective-C Runtime methods. This is where I get to promote my favorite page of documentation ever: http://developer.apple.com/library/mac/#documentation/Cocoa/...

That's an excellent page, thanks! This actually makes me wonder... how much overhead is in each objective c object over a similar struct in c?

In terms of size, they're almost the same (Objective-C classes are implemented with structs). In terms of speed, the difference is absolutely huge. You can generate a random number faster than you can make an Objective-C call.

But, it's fast enough for 95% of things people do with it.

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

#58
post #56
post #36

Earlier quoted context omitted.

With clang, ObjC is getting very interesting features that take it closer and closer to "real" high level languages, like GCD, ARC and blocks. I'd still like more type safety, but the evolution there is slower and would need more fundamental changes to the language and abandoning C compatibility.

I dunno--in an age where we have actual, halfway decent garbage collection, referring to ARC as something that might compete favorably with those "real" high level languages makes my eyes go a bit crossed.

When you're writing for underpowered chips, ARC is a godsend. If you're writing for a mac, there's GC available.

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

#59

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

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.

For what its worth, you can add functions to structs in C using function pointers.

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

#60
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…

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.

I would not call Python a well-thought out OO language. Its OO is essentially a cranked up dict; the abstraction over the dict is just barely papered over. It can get pretty awkward.
Post reply on HN