| 1) It's redundant. It adds _nothing_ to the class. You can do useful | |
| things in an NSError subclass - you can localise the error description | |
| automatically. But you don't want to expose your subclass to your | |
| consumers unless there's a good reason for it. Dropbox could have used a | |
| category and got what they were trying to achieve (although I believe | |
| even that is redundant). | |
| 2) They change the type of NSError's code method from an NSInteger to | |
| their own enum. There's no guarantee that when I compile with their | |
| headers that the size of that enum _is_ the size of an NSInteger (e.g. I | |
| compile my project with -fshort-enums and they don't…). I'm surprised | |
| Xcode isn't bitching about this actually. Generally this doesn't matter, | |
| I doubt even -fshort-enums would break it But still - it's something | |
| you shouldn't do as a general rule. | |
| 3) They force me to use DBErrors in my code as well as NSError and then: | |
| NSError *error; | |
| if ([… doSomething:&error] == NO) | |
| return; | |
| if ([… doSomethingElse:&error] == NO) | |
| return; | |
| if ([… doSomethingMore:&error] == NO) | |
| return; | |
| Now it's: | |
| NSError *error; | |
| if ([… doSomething:&error] == NO) | |
| return; | |
| DBError *dropboxError; // This error is SPECIAL | |
| if ([… DBDoSomethingElse:&dropboxError] == NO) | |
| return; | |
| if ([… doSomethingMore:&error] == NO) | |
| return; | |
| So now I have an extra variable with a contrived name just because | |
| someone at Dropbox decided to make a subclass. Thanks guys! | |
| 4: In simple methods I sometimes pass my method's error parameter to | |
| methods I call so I don't even need an error variable. I can't do that | |
| with DBError: | |
| - (BOOL)something:(NSError **)outError | |
| { | |
| // Do some work here… | |
| return [… dbDoSomethingElse:outError]; // Compile error? | |
| } | |
| Imagine if they subclassed something else fundamental like NSURL or | |
| NSString, added no functionality to it, and then expected me to use it | |
| when interfacing with their APIs. | |
| It's really redundant. | |
| That combined with the DBError * vs ** parameters and I have to imagine | |
| that this code was written by someone with little to no experience. | |
| Jon. | |
| On Jul 10, 2013, at 6:07 XXXX wrote: | |
| the pointer thing is just embarrassing i agree | |
| Sent from my iPhone |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment