December 7, 2017idioms thinking programming opinion
What does it mean to be idiomatic?
“Of, relating to, or conforming to idiom” - Merriam-Webster
So what is an idiom?
“The syntactical, grammatical, or structural form peculiar to a language” - Merriam-Webster
When we talk about idiomatic programming, we are talking about doing things because it is “the way” to do them, or because so-and-so says this is a rule that can’t be broken.
Why is it important to see past these idioms and understand why they are “the way?”
Just to be clear, it is not my intent to prove that you shouldn’t follow these idioms. In fact, I think you should follow them, but remember to “know before you go.” To convince you, I will try and reject the hypothesis that “you should always follow the best idioms regardless of the situation.”
Let me take as my example, the golden rule. For those of you that don’t know, the golden rule is something us Americans are taught in preschool that usually is somewhere along the lines of “do unto others as you would have them do unto you.” I think we can all agree that it is a pretty good rule to follow. In order to reject my hypothesis, I just need to find a situation where this is not the right thing to do. Does this mean that I am a bad person, or that I think any less of whomever came up with the golden rule? No.
Now, let’s say you have a cabin in the woods. I’m not talking up in Westchester, I’m talking Canadian wilderness area. Someone comes across your property, and they are obviously lost, probably hungry, cold and tired. You are like really into the golden rule, super idiomatic, and a very nice person. You invite them in, offer them food, share your fire, and even let them use your radio to call into town. This is a great scenario for both people, new friendships are made, a life is potentially saved. Now let’s make a slight adjustment.
What if you were a masochist? That is, someone who likes inflicting pain on themselves. It isn’t all that uncommon. A child goes through repeated, traumatic, painful experiences, and grows up taking pleasure in the feeling of pain. Now you are that child all grown up, have that same cabin in the woods, and are super idiomatic about the golden rule. What do you think you will do with this visitor?
I’m not going to continue because I think it is safe to say the hypothesis has been rejected.
So instead of being idiomatic, you can realize that even the most thoughtful and skilled individual can’t think of every possible situation in which their words can be applied. It is far better to understand the reasoning behind those words and use the lessons learned to improve your approach going forward.
This post was inspired by some Wikipedia edits pointed out by Dan Abramov on Twitter, followed by a barrage of worrisome opinions by an unnamed individual I spoke to. All tweets in question along with the Wikipedia edits are MIA at the time of writing this
*As usual, views expressed are my own, and do not represent those of my employer.