Live data from Hacker News

In defence of Objective-C

splinter.com.au

31–40 of 122 posts

Re: In defence of Objective-C

#31
post #24

Earlier quoted context omitted.

So, languages that have primitives like this typically are designed to be used by people who don't know much about algorithms, or simply don't want to be hassled with it, either now, or ever: they want to write code, they want it to "work", and they want to move on to something else; in essence, we are talking "scripting languages". Languages that some look at as "real programming languages", in comparison, tend to n…

Ah, I get it. Convenient container-syntax is only found in toy scripting languages for stupid people like -uh- Haskell? :)

Your parent poster never said anything about intelligence in his post. In addition, Haskell does not have syntax for dictionaries/hashes, or really any "container type" other than lists (and list comprehensions).

Re: In defence of Objective-C

#32
post #31

Earlier quoted context omitted.

Ah, I get it. Convenient container-syntax is only found in toy scripting languages for stupid people like -uh- Haskell? :)

Your parent poster never said anything about intelligence in his post. In addition, Haskell does not have syntax for dictionaries/hashes, or really any "container type" other than lists (and list comprehensions).

I believe my key mistake was using the term "real programming languages" as the alternative to "scripting languages": the word "real" is quite harsh; I have softened the statement slightly by changing "we look at" to "some look at".

I will also, though, point out that I write almost as much (if not more) Python as I do Objective-C++ these days: I therefore can be said to certainly not consider Python to be for "stupid people", without including myself in that set. ;P

Re: In defence of Objective-C

#33
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 the EU regulations on "the common organisation of agricultural markets".

I had to create a couple of iPhone apps, and I probably will have to create some more in the future.

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

And yeah, this article did not work for me, as you would have already guessed.

Re: In defence of Objective-C

#34
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 documentation required, unless you actually need in-depth information.

Re: In defence of Objective-C

#35

I wonder if I'm the only person that thinks that Xcode is the problem, not ObjC. Having experience with C I feel just fine writing code in Objective-C, but only the thought of trying to use Xcode instead of Emacs is painful. I'd love to know what Eclipse/VS/NetBeans users think about it, maybe it's easier if you're already used to working inside a huge IDE.

I am a fan of Eclipse, but I hate xcode - it hasn't got half of the features it should have and the code completion is just horribly bad.

Re: In defence of Objective-C

#36

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…

> The first major point (which is found at the end of this post) in any "defense of Obj-C" should be that this is a very pragmatic language.

"Pragmatic", much like "practical", is utterly worthless for programming language discussions. It means something different to everybody, and it's basically the tool you'll reach for when you have absolutely nothing good to say about the language you're trying to "defend".

Both "pragmatic" and "practical" should be the godwin points of PL discussion. They're complete bull.

> The point is to understand why we have brackets, because they allow for named arguments without colliding with existing C syntax.

Just because there are reasons it's done that way does not mean it's any less ugly, does it?

> Additionally, they make it clear to the user that what is about to happen is not a traditional method call, it is a message send.

For pretty much all OO PL languages, the distinction is just cutesy, the end result is that you're synchronously calling a method on an object, whether you call it "message" or "method" has little relevance.

> This is because you can do both in Obj-C

Do you mean that in a "function pointer in a struct" sense? This would use the `->` sigil would it not? And obj-c 2.0 managed to include dotted property names, so that could have been used (obviously, it wasn't because obj-c merges Smalltalk syntax into C and Smalltalk's message-send syntax does conflict with C if unbracketed)

> It's possible to take Obj-C without Cocoa, and write a framework that is just as non-verbose as Python

Not quite, Obj-C has structural deficiencies (in part inherited from C) which mean it has boilerplate you can't do without, such as the duplications between header and implementation files.

For much of its history, it also lacked any form of "blocks" (and those added in obj-c 2 are pretty verbose), meaning your Obj-C code would have a harder time with scoped resources than the equivalent Python code.

Other intrinsic verbosity issues of obj-c: iterations pre-Obj-C-2 (and fast iterators), type annotations, retain/release calls (we'll see how ARC fares), ...

I would say embracing Cocoa's chosen verbosity (although I sometimes find it misplaced) is a much better strategy than claiming Obj-C can be as terse as Python.

Re: In defence of Objective-C

#37

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…

I stopped reading at: "Things like factories, adapters, and other design patterns are all thankfully not there."

Huh? Design patterns are "thankfully not there"? What does that even mean?

Re: In defence of Objective-C

#38

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.

Re: In defence of Objective-C

#39
post #37

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…

I stopped reading at: "Things like factories, adapters, and other design patterns are all thankfully not there." Huh? Design patterns are "thankfully not there"? What does that even mean?

I took that to mean that the objective-C community as a whole is not obsessed with the gang of four.

Though, to be fair, my exposure to the community is limited to AP CS AB (why they decided to use java is beyond me ...)

Re: In defence of Objective-C

#40
post #29

Earlier quoted context omitted.

Ah, I get it. Convenient container-syntax is only found in toy scripting languages for stupid people like -uh- Haskell? :)

Languages with macros and (often) monads allow developers to redefine the syntax and types to accomplish these goals. The point I am making here is that there is a reason why language designers make this tradeoff: it isn't at all obvious that languages should have a built-in container syntax, and when you find languages that don't you can (and should) notice a pattern. (C++11 is actually an interesting thing to analy…

> Languages with macros and (often) monads allow developers to redefine the syntax and types to accomplish these goals.

You can't redefine haskell's syntax unless you're using Template Haskell (which is a language extension, not part of Haskell itself). It also has nothing to do with monads. Likewise with most MLs, or with Erlang. All of them have a literal list syntax.

And if containers have no reason to be special, why would strings be special? They're just sequences of unicode codepoints after all.

Continuing your argument into absurdity, why have literal syntax for most datatype at all really? You could just shove a bag of bytes into a constructor when you want integers or floats as well. Now you've got one literal syntax (which isn't even for a datatype): bunch of bytes.

Post reply on HN