Design Element
Comment on "Objective-C, Ruby and Python for Cocoa"
by Tom — Feb 25
@Scott Guelich: The long Ruby line definitely looks odd to me. I'm a compulsive line-breaker/indenter/vertical aligner in scripting languages (which is why I never could use Python...), so I'd certainly reformat that.

Python doesn't care about whitespace between tokens. Lines can be joined explicitly with backslash and are joined implicitly within parentheses, brackets, or braces. So you certainly can line up your conditions, arguments, etc. in Python.

Neither Python nor Ruby will let you insert whitespace into a method name, though, so there isn't much you can do with the first RubyCocoa example (other than rewrite it for objc_send).

@Chris: Plus, indentation is not significant, and thus you don't have the Pythonian "why am I getting a random syntax error in perfectly legitimate code on line 2661?<...16 hours pass...>Oh, there's a tab instead of some spaces on line 45, and somehow it was OK until I added this new code..."

If you can't be consistent, run tabnanny.

@Ken: I can know at a glance when code is bracketed, I'm invoking an action, and when I'm using dot-syntax I'm accessing a variable.

Other languages do that with trailing parentheses instead of enclosing brackets, and ObjC 2.0 throws that out the window anyway.

@Scott Stevenson: Some of this may come down to project size and whether you're the only author or not, buy having a nice, summarized view of all the methods sure seems pretty nice to me.

That's (among other things) what doc tools are for.
Back to "Objective-C, Ruby and Python for Cocoa"
Design Element

Copyright © Scott Stevenson 2004-2015