4 ms·
I mostly program in ruby, but have been working with objective-c more lately, so I can try to summarize what my thinking with a few examples: - Why do I have
by chrisa 16y ago
I mostly program in ruby, but have been working with objective-c more lately, so I can try to summarize what my thinking with a few examples:
- Why do I have to begin every string with @? I know the technical reason why, and the difference between having it and not having it, but I don’t want to type it all the time.
- Every time I type CGRectZero as an argument, I think "the method should just assume I want a CGRectZero, and if not, then I’ll tell it otherwise"
- It's distracting to my thought process to surround everything with []. That could just be a result of not spending enough time in the language
- Typing the name of every argument becomes tiresome after a while. Auto-complete does help some.
- I don’t see it in this example, but I often see cases which alloc an object, set another object to that object (usually doing some data massaging in the process), and then release the first object. In ruby, it would be a single (short) line.
I think (hope) that as I get better with the language, many of those annoyances fade away. Looking at it now, I think I could summarize it all with: The default of objective-c is to be verbose, and the default for ruby is to be terse.
edit: the "alloc, set, release" paradigm can be found in part 2, step 1.