6 ms·
Picking the proper names for software constructs is also part of that category. I'm always impressed at how choosing a slightly wrong-one can have a huge impact
by zimbatm 11y ago
Picking the proper names for software constructs is also part of that category. I'm always impressed at how choosing a slightly wrong-one can have a huge impact down the line. Somehow the brain doesn't map the name exactly to the current context and gets things wrongs, prevents clear thinking.
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 :)
- dclowd9901 11y agoWe are in precisely the middle of this. We have documents in our product that encapsulate an essential step in a workflow, but for some unholy reason, someone decided to call them "items." 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.
- tomsthumb 11y ago> someone decided to call them "items." I prefer to call my stuff "things."
- HillaryBriss 11y agoI like "entities" -- I feel so smart when I use that.
- shurcooL 11y agoThe only other name left is "entries", right?
- saurik 11y agoAn "entry" at least implies there is a list somewhere (as would "element"). Both "item" and "entity" are more like "thing". I could see adding "object" to the list.
- tomsthumb 11y ago"entry" is a fantasticly sinister name if you're writing the sql directly in your application though. object would be hilarious in java assuming the compiler lets you do that.
- dbenhur 11y agoHeh. Except for: element, action, slot, task, goal, task command, subject, target, source, destination, object, actor, path, key, memo, manifest, sender, receiver, self, this, thing, data, value, register, ... I think you enumerated them all.
- rvikmanis 11y agoIndeed. For example, I am deeply amazed at how in Flux and many of its derivatives Actions are not executable behaviours, but messages describing an action to be performed, while ActionCreators are the actual, well.. "actions".
- MereInterest 11y agoAbsolutely on naming. The python module "optparse", which was standard for quite some time, did not have any way to specify that a flag must be passed. As soon as the newer version "argparse" came out, this could be specified. All the documentation pointed that "mandatory option" was a contradiction, not realizing that they were the ones who had labeled it as an "option" in the first place.
- dasil003 11y agoI've thought about this particular issue quite a bit as well, but I haven't been able to come up with a great solution, because RAILS_ENV/RACK_ENV is ubiquitous and auto-detected by tools. So you can have multiple deployment targets running the same mode, but then you can't differentiate them by default in tools like New Relic, Slack, Honeybadger, etc. You can put a lot of effort into building custom solutions to this, but since there is no standard it's easy to run into brick walls. In the end I've found it to be more work than just adding a new RAILS_ENV setting across all the config files. Ugly but pragmatic.
- s_kilk 11y agoI think the lesson here is to not fuck it up in the first place. When inventing the new framework "Foo", call the variable FOO_DEBUG, not FOO_ENV. As you've observed, it's not really possible to go back and fix this kind of mistake after it's been made.
- crdoconnor 11y ago>Picking the proper names for software constructs is also part of that category. I'm always impressed at how choosing a slightly wrong-one can have a huge impact down the line. 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.
- zimbatm 11y agoIt's a good example. It also makes me think of "users" tables instead of "accounts".
- munger 11y agoUnless it's a financial application...
- bthornbury 11y agoThrow path in there for good measure. Often times I see path in code and have no idea if it's expected to be a directory, file, relative path, etc...
- HillaryBriss 11y agoAnother good example is 50% of the method names in the Android SDK.
- lamby 11y agoAs 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/
- selimthegrim 11y agoI would encounter this with the graduates of these 90 day coding schools when interviewing them. There would be total shock and incomprehension when I asked them to click through their github and revealed the secret key they'd checked into the public repository....