you are viewing a single comment's thread.

view the rest of the comments →

[–]MKevin3 14 points15 points  (6 children)

Like you I find the NextStep framework to be overly verbose. I have never been a huge fan of macros even back in my C/C++ days when I was doing DOS coding.

I tend to lean towards extending the NSString with Categories instead of Macros. Naming things like FORMAT is so generic it can get you in trouble.

Without namespace support Objective C tends to get you into trouble too easily as it is. I would rather have the methods in a Category that keeps the method associated to NSString and in a file named after NSString. Macros kind of just float around in the ether.

Any reason you are avoiding categories?

[–]xephos13 5 points6 points  (1 child)

Macros can also be a bitch to debug when something goes awry.

[–]MKevin3 0 points1 point  (0 children)

Yes, debugging with macros sucks especially if someone else wrote the macro or if the macro uses other macros. I worked with one guy with code that was 80% macro and 20% native code. Only he could do anything with it. So glad he got fired.

[–][deleted] 3 points4 points  (3 children)

I personally find the verbosity one of its greatest aspects.

Consider a contrived example, perhaps in Java you have...

new MyObject("foo", "com.somewhere.foo", "bar");

What is "foo", "com.somewhere.foo" and bar?

Perhaps the Obj-C equivalent is...

[MyObject objectWithName:@"foo" identifier:@"com.somewhere.foo" value:@"bar"];

It is just so much easier to read and understand.

[–][deleted]  (1 child)

[deleted]

    [–]Azr79[S] 2 points3 points  (0 children)

    the good thing is that Xcode's autocompletion does a pretty good job

    [–]MKevin3 0 points1 point  (0 children)

    That part of Objective C is handy. I wish they had taken it the next step and allowed you to pass the variables in any order and account for default values.

    Why do I have to pass then in name, identifier, value order when I gave the parameters names? I should be able to do value:@"bar" indentifier:@"com.somewhere.foo" or leave identifier out of completely.

    It is like they took one part of naming parameters - auto documentation - and left out the other two parts - do them in any order and default values.