3 ms·
As someone who has done no Android development, could you elaborate?
by lamby 11y ago
As someone who has done no Android development, could you elaborate?
- HillaryBriss 11y agoMaybe it's just me but, when I see things like this, I lose confidence in the method naming process on the Android SDK: glEGLImageTargetRenderbufferStorageOES http://developer.android.com/reference/android/opengl/GLES11Ext.html#glEGLImageTargetRenderbufferStorageOES%28int,%20java.nio.Buffer%29 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/DatabaseUtils.html#readExceptionWithOperationApplicationExceptionFromParcel%28android.os.Parcel%29 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/GestureOverlayView.html#getGestureStrokeSquarenessTreshold%28%29 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/UrlQuerySanitizer.html#getAllButNulLegal%28%29 http://developer.android.com/reference/android/net/UrlQueryS... But wait: readMessengerOrNullFromParcel http://developer.android.com/reference/android/os/Messenger.html#readMessengerOrNullFromParcel%28android.os.Parcel%29 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/content/Loader.html#registerOnLoadCanceledListener%28android.support.v4.content.Loader.OnLoadCanceledListener%3CD%3E%29 http://developer.android.com/reference/android/support/v4/co... But wait: onGestureCancelled http://developer.android.com/reference/android/gesture/GestureOverlayView.OnGestureListener.html#onGestureCancelled%28android.gesture.GestureOverlayView,%20android.view.MotionEvent%29 http://developer.android.com/reference/android/gesture/Gestu... --- There's also this: http://blog.danlew.net/2015/04/18/is-your-user-a-goat/ http://blog.danlew.net/2015/04/18/is-your-user-a-goat/
- saurik 11y ago1) The OpenGL standard specifies functions that are capitalized like that, as "renderbuffer" is a noun. 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 :(.
- HillaryBriss 11y agoAha. Android SDK names aren't as bad as I thought! Nice comment.
- deleted 11y ago[deleted]
- HillaryBriss 11y ago(I wanted to add this to my other reply, but it's too late for that.) 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/+/refs/heads/master/core/java/android/database/DatabaseUtils.java 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.
- geofft 11y agoI parsed saurik's comment as a joke based on Objective-C enjoying long names containing the word "with". Objective-C is relatively unique among programming languages in continuing the method name when specifying parameters, and "with" is a usual way of specifying them. For instance, one of the constructors for NSString is named "stringWithContentsOfFile:encoding:error:", and the way you'd call that method is something like [NSString stringWithContentsOfFile:@"file.txt" encoding:NSUTF8StringEncoding error:NULL]. 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.