I was designing a class and I realize that I've got several methods that the only parameter they have is the output parameter for errors. The problem is how should I name this methods, because they can get very confusing. I've been reading the Apple's Code Guidelines and it saids nothing about this. Here is an example:
-(BOOL)loginError(NSError **) anError;
-(BOOL)loginWithUsername:(NSString *)aUsername password:(NSString *)aPassword error:(NSError **) anError;
The sec开发者_运维问答ond one is very clear but the first one seems to be very confusing to me.
What do you think?
Apple use names such as
- (BOOL) saveValuesAndReturnError:(NSError **) error;
So, perhaps:
- (BOOL) loginAndReturnError:(NSError **) error;
精彩评论