Similarly I'm often shocked at just how critical name disambiguation is. There's a shocking number of extremely similar concepts when writing code which, when given the same name ends up causing bugs.
A good example is 'file' which can be used to refer to a file handle, file name, file object of some other kind, a 'file' representing an aggregate of information on person, and often it ends up referring to directories, devices and links as well.
Now day in and day out, I have to deal with classes like ItemViewer, ItemListController, etc etc, and half the time I have no idea what the responsibility, location or relationship of any given class is supposed to be. So much time just getting contextual background before I start working in an area of code. Couple this with early bad coding decisions around encapsulating responsibility and lack of testing coverage and I've got a relatively miserable 2-3 years ahead of me.
I prefer to call my stuff "things."
As you've observed, it's not really possible to go back and fix this kind of mistake after it's been made.
glEGLImageTargetRenderbufferStorageOES
http://developer.android.com/reference/android/opengl/GLES11...
They capitalized Render but not buffer. Also: what does this even mean?
---
readExceptionWithOperationApplicationExceptionFromParcel
http://developer.android.com/reference/android/database/Data...
Do they really need to put the word Exception in this name twice?
---
getGestureStrokeSquarenessTreshold
http://developer.android.com/reference/android/gesture/Gestu...
What's a Treshold? (Yes, that's how they spelled it).
---
Ok, so the standard way they spell it is N-U-L. One L: getAllButNulLegal
http://developer.android.com/reference/android/net/UrlQueryS...
But wait: readMessengerOrNullFromParcel
http://developer.android.com/reference/android/os/Messenger....
---
Ok, so the standard way they spell it is C-A-N-C-E-L-E-D. One L: registerOnLoadCanceledListener
http://developer.android.com/reference/android/support/v4/co...
But wait: onGestureCancelled
http://developer.android.com/reference/android/gesture/Gestu...
---
There's also this: http://blog.danlew.net/2015/04/18/is-your-user-a-goat/
2) NUL is a character, while NULL is a pointer. These APIs are using the correct name for each scenario.
3) Checking if the user is a monkey (or now a goat) is a running gag. I don't think that is a naming mistake.
4) The usage of "exception" in that name is clearly different each time, though maybe it requires knowing Objective-C for that to feel "correct" (as the developer who named that function clearly is writing Objective-Java there ;P).
The spelling mistakes and inconsistencies are "awesome", though :(.
Is there a method naming convention in Objective-C where the phrase "withExceptionXYZ" in the method declaration means "this method may throw an instance of ExceptionXYZ"?
This is from https://android.googlesource.com/platform/frameworks/base/+/... :
public static void readExceptionWithOperationApplicationExceptionFromParcel(
Parcel reply) throws OperationApplicationException {
int code = reply.readExceptionCode();
if (code == 0) return;
String msg = reply.readString();
if (code == 10) {
throw new OperationApplicationException(msg);
} else {
DatabaseUtils.readExceptionFromParcel(reply, msg, code);
}
}
I don't know Objective-C at all. Would this method name truly feel correct in that language?Thanks.
However, in this context it's not used that way, because you're not taking an OperationApplicationException. Instead, yes, this appears to be a variant of readExceptionFromParcel that instead sometimes throws an OperationApplicationException. That use of the word "with" would not feel correct in Objective-C -- nor would the use of an exception, probably, since they are rarely used in Objective-C.
Nice comment.
A good example is the RAILS_ENV environment variable. It's a mechanism to select a running mode of rails applications. Now unlike most applications debug mode is the default. It's called "development" and the normal mode is called "production".
Because of these naming decisions developers always confuse the RAILS_ENV to be related to the deployment target. They add a "staging" running mode and they start bundling configuration secrets into the code. And invariably these secrets get leaked on github when they decide to make the repo public.
For a long time I felt something wasn't right and couldn't point the finger at it and it took conscious effort to disambiguate that. And that's just for a single variable. Mind your naming :)