Live data from Hacker News

In defence of Objective-C

splinter.com.au

81–90 of 122 posts

Re: In defence of Objective-C

#81

"Things like factories, adapters, and other design patterns are all thankfully not there." Not sure I understand this? How does Obj-c enable the developer to avoid factories?

Agreed. I've had to use factories in Obj-C plenty. I guess the argument that I would make is that they are much easier to implement in Obj-C and require less boilerplate (especially if you use blocks), not that the pattern doesn't exist in Obj-C.

Re: In defence of Objective-C

#82
post #76

Earlier quoted context omitted.

Yeah, I found that line hideous - ridiculously unintuitive and hard to read compared to the equivalent in say, ruby. Maybe the whole essay would have been better framed something like: "Objective C: not quite as bad as Java!"

Just curious, for comparison: what would the equivalent be in Ruby?

my_array.select { |item| item == somefiltervalue }

At least that's one way to do it in ruby.

Re: In defence of Objective-C

#83
post #21

As someone who likes Objective-C a lot, I have to say this is a pretty bad defense of it. No offense, clearly we are both fans of the language, I just don't think this will convince anyone on the other side. In fact, I find very little defense of it at all in this post. It seems his fundamental argument is "its a matter of taste", which while true, in no way conveys the many "whys" of the choices made in this languag…

They could have added garbage collection if they wanted to add as much ram to the iphone as the Android phones have but I guess they already made their choice long before one could develop code for the iphone.

The Android phones appeared a year or so later. Memory prices weren't the same.

And GC is always less efficient than no GC, even with more memory.

Re: In defence of Objective-C

#84

I'm (some what) proficient in many programming languages. Some more than others. I've worked in languages like Python, Eiffel, C#, C++, Prolog, Java, OCaml, F#, Ruby and as of recently, after a long hiatus, Haskell. I have such a strong dislike for Objective-C, I can't explain it. I mean C++ is insane in a way, and Haskell is a pure Mindbender. But Objective-C's syntax, to me, is indeed so verbose, I'd rather read th…

> Is there any way for me to overcome my unnatural dislike for this language?

Grow some taste?

Re: In defence of Objective-C

#85

For example, to filter an array is lovely: filteredArray = [allRecords filteredArrayUsingPredicate: [NSPredicate predicateWithFormat:@"someField == %d", someFieldFilterValue]]; A four-word name for filter and filtering for equality by using a string formatting DSL are not really on my list of lovely things. I'm sure Objective-C does something well but this guy is not pointing it out.

Hard to believe anyone would use that as an example. In C# you could do:

filteredArray = allRecords.Find(i => i.someField == filterValue)

EDIT: Not sure why the downvote, I'm simply stating that many other languages have far better syntax for filtering an array so I'm not sure why the author would think the syntax in Obj-c is all that great unless they have never done the same thing in any other language.

Re: In defence of Objective-C

#86
post #54
post #13

-quote- Go and look at some Lisp, then come back – obj-c will suddenly look better :) Trust me, it grows on you. You’ll soon learn to see through the brackets – just like the green vertical text in the matrix, it becomes invisible after a while. -end quote- Its ironic that a Lisp/Scheme person would say the same as to why s-expressions are good (the parens become invisible!) so I don't see why objective-c syntax is b…

"You’ll soon learn to see through the brackets" @I @hope @that @also @applies @to @the @the @at-@signs. ;-)

Huh? Obj-C only uses @ signs at a couple of places, like to denote a native @"dasdasda" string and in compiler instructions...

Re: In defence of Objective-C

#87

I love Obj-C message send syntax and I miss it dearly when using any other language. I love that a method implicitly documents itself at the call site, and that the delimiters occur between calls rather than in the middle of them. And it works great with code completion. You just type '[' and the editor immediately knows what you are doing. Choose a method and the parameters are right in front of you. No documentatio…

> And it works great with code completion. You just type '[' and the editor immediately knows what you are doing. Whereas in other languages you'd have to write... "."? > Choose a method and the parameters are right in front of you. No documentation required, unless you actually need in-depth information. Pretty much every somewhat advanced IDE does that, especially for mostly-statically-analyzable languages.

> Whereas in other languages you'd have to write... "."?

You write "." AFTER you've written the method name. In ObjC "[" immediately tells that you want a method/class name for autocompletion.

Re: In defence of Objective-C

#88
post #76

Earlier quoted context omitted.

Yeah, I found that line hideous - ridiculously unintuitive and hard to read compared to the equivalent in say, ruby. Maybe the whole essay would have been better framed something like: "Objective C: not quite as bad as Java!"

Just curious, for comparison: what would the equivalent be in Ruby?

    filteredArray = [allRecords filteredArrayUsingPredicate:
        [NSPredicate predicateWithFormat:@"someField == %d",   someFieldFilterValue]];
in ruby:

    all_records.select {|r| r.some_field == some_field_filter_value}
in clojure:

    (filter #(= % some-filter-value) all-records)
in haskell:

    filter (\someField -> x == someFilterValue) allRecords

Re: In defence of Objective-C

#89
post #21

As someone who likes Objective-C a lot, I have to say this is a pretty bad defense of it. No offense, clearly we are both fans of the language, I just don't think this will convince anyone on the other side. In fact, I find very little defense of it at all in this post. It seems his fundamental argument is "its a matter of taste", which while true, in no way conveys the many "whys" of the choices made in this languag…

They could have added garbage collection if they wanted to add as much ram to the iphone as the Android phones have but I guess they already made their choice long before one could develop code for the iphone.

Arguably far more important than the amount of RAM—which costs in dollars, battery, and sometimes even physical size—is the non-deterministic performance of GC, which directly costs in responsiveness.

Re: In defence of Objective-C

#90

I don't think these are the real problems with Objective-C. To quickly address this issues, before discussing the real problems: "Ugly" - get over it, "Verbose" - get over it, "Memory Management" - Obj-C memory management is in fact super simple as long as you follow some really simple rules, especially with ARC. Now the real problems I have: 1. Lots of unnecessary code. With the old runtime, you had to modify your c…

About #7: since the last WWDC, it looks like they will be strongly pushing http://lldb.llvm.org/

Once it matures I expect the Xcode debugging experience will become quite a bit different from the current (flimsy) gdb shell-out.

Post reply on HN