Live data from Hacker News

Why Objective-C is Hard

ashfurrow.com

101–110 of 156 posts

Re: Why Objective-C is Hard

#101
post #6

Earlier quoted context omitted.

It's because Objective-C methods are named according to the nouns that they return rather than the verbs they perform. For example, "[input stringByAppendingThing:thing]" rather than "input.append(thing)". Methods are actions, not objects, so the most concise description for a method is usually a verb. Describing it as a noun instead requires adding prepositions and turning verbs to the gerund '-ing' form. I realized…

Have you read http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom... ? Yegge basically completely agrees with you. Once I started thinking of OOP in these terms it helped me, as a programmer, a lot.

Thats a hilarious post but it sounds like Steve would love PHP. He could use nouns (objects) when he wanted yet add global functions (verbs) with no attachment to objects. I personally think that's a great way to make a terrible mess, but perhaps he knows something that I don't.

Re: Why Objective-C is Hard

#102

It's best to think of Obj-C method call syntax as a sentence, written in english, which happens to also be computer code. If you name your methods and variables succinctly and explicitly, the language is extremely readable and documents itself (assuming you know english). Obj-C was the first language I learned after Python. I remember the 2nd month in, it went from being difficult to read, to extremely easy. Obj-C co…

The same is true of most programming languages. Simple things like layout improve readibility, and thus productivity, immeasurably.

Re: Why Objective-C is Hard

#103

Earlier quoted context omitted.

Those aren't Objective-C objects, but I get your point. ARC does not relieve you of thinking about memory, it just makes it easier.

ARC to me is scary... I got over the huge learning curve, and the nuances of autoreleasing, and retaining, and it seems like now I gotta unlearn all of that??? And not to mention some third party libraries/source code don't support ARC. To me, I'm gonna hold off using ARC as long as possible.

[deleted]

Re: Why Objective-C is Hard

#104

I might be just me, but I've always found Objective-C's syntax very nice (compared to, say, C++). It might be verbose, but you have a clear separation between C and Objetive-C. If it doesn't contain "[]" or "@", my brain can just parse it as C code.

[deleted]

Re: Why Objective-C is Hard

#105
I know this is a short article meant to explain the basics but I don't like how under the History section it makes no mention of NeXT or Stepstone which were the creators of ObjectiveC.

Re: Why Objective-C is Hard

#106
Rather than performAction:firstParameter withTwoParameters:secondParameter which is kind of confusing. You should name it performActionWithTwoParametersFirst:firstParameter andSecond:secondParameter if you insist on calling your method performAction

Re: Why Objective-C is Hard

#108
post #99
post #42

People fret over language syntax too much. In most sane languages including Objective-C you simply forget about the syntax after a few months. What’s much more important is the conceptual complexity: the number of language features and the way they fit together. A second important thing is the standard library. Objective-C is a pleasant language by both these metrics, since there are just a few language constructs ab…

I couldn't disagree more. Objective-C is a product of the 1980s, when it kind of made sense that your program would crash if you did this: [NSArray arrayWithObjects:@"Hello", @"World"]; Of course it crashes! You have to add a nil sentinel value to the end of your list of objects, silly. And of course it compiles with only a warning, just like when you leave out the @ that makes the difference between a C string liter…

" And of course it compiles with only a warning, just like when you leave out the @ that makes the difference between a C string literal and an NSString."

How is the compiler supposed to know you meant NSString or C-String?

Re: Why Objective-C is Hard

#109
post #99
post #42

People fret over language syntax too much. In most sane languages including Objective-C you simply forget about the syntax after a few months. What’s much more important is the conceptual complexity: the number of language features and the way they fit together. A second important thing is the standard library. Objective-C is a pleasant language by both these metrics, since there are just a few language constructs ab…

I couldn't disagree more. Objective-C is a product of the 1980s, when it kind of made sense that your program would crash if you did this: [NSArray arrayWithObjects:@"Hello", @"World"]; Of course it crashes! You have to add a nil sentinel value to the end of your list of objects, silly. And of course it compiles with only a warning, just like when you leave out the @ that makes the difference between a C string liter…

Thankfully, the NSArray and NSDictionaru madness has been addressed: http://cocoaheads.tumblr.com/post/17757846453/objective-c-li...

Re: Why Objective-C is Hard

#110
post #64

Earlier quoted context omitted.

But I'm reaching the point thinking: it's 2012, I'm an application developer, why am I spending half my time debugging memory leaks and concurrency issues? Because Objective-C targets everyday desktop apps and mobile apps. In that space, manual memory management still wins the day. For example, in Windows and Linux DESKTOP those kind of apps are ALSO made in C++ or C. Java and C# are for the web server and the CORPOR…

There's also Minecraft, one of the best-selling videogames of 2011. :)

Nothing, not even a Flash video makes my MacBook Pro hotter than 5 minutes of Minecraft...
Post reply on HN