iOS Development options

Btw for anyone interested; the verbosity of parameters is optional. You can avoid named parameters if that's your preference. I.e. Objc programmers choose to use named parameters to make the code more readable, or more specifically to avoid extraneous comments,

Let me know if you'd like an example of this (streamlined parameters; not named)
 
arb example of self documenting code, that doesn't look like a backyard abortion :p

Code:
public String concatenate(String string1, String string2)
 
Last edited:
[)roi(];12631421 said:
Btw for anyone interested; the verbosity of parameters is optional. You can avoid named parameters if that's your preference. I.e. Objc programmers choose to use named parameters to make the code more readable, or more specifically to avoid extraneous comments,

Let me know if you'd like an example of this (streamlined parameters; not named)

I find it useful when you don't have to see the source to get at the comments to get the gist of what a method does. And the source isn't always available. But I guess if you have jammed 10000 lines of code into a single class, then comments will do :D
 
arb example of self documenting code, that doesn't look like a backyard abortion :p

Code:
public String concatenate(String string1, String string2)

So what's wrong with the objc equivalent?

Option 1: typical verbose parameter approach
Code:
+ (NSString *)concatenateString:(NSString *):string1 withString:(NSString *)string2 {
}
Usage example:
Code:
[self concatenateString:@"ABC" withString:@"DEF"];


Option 2: non verbose approach, verbose parameters not used
Code:
+ (NSString *)concatenate:(NSString *):string1 :(NSString *)string2 {
}
Usage example:
Code:
[self concatenate:@"ABC" :@"DEF"];

Practically though these adaptations of the NSString class will more typically be implemented as objc categories; i.e. By way of "class extensions", that simplifies the use even more.
 
Last edited:
I find it useful when you don't have to see the source to get at the comments to get the gist of what a method does. And the source isn't always available. But I guess if you have jammed 10000 lines of code into a single class, then comments will do :D
Yip; yet arguably with the newer IDEs comments are visible during code completion lookups;

Objc was of course developed in a time prior to much of the IDE magic, yet even with that I'd argue it's verbosity encourages the developer to follow clean code practices delivering self documenting code, and basically avoiding the necessity for comments all together.

As to 10000 lines in a single class --> that developer should either be shot or forced to maintain that mess in perpetuity.
 
[)roi(];12632757 said:
As to 10000 lines in a single class --> that developer should either be shot or forced to maintain that mess in perpetuity.

amen...!!
 
Top
Sign up to the MyBroadband newsletter
X