A Pro-Grammar Nerd: Beautiful Code Makes Beautiful Language

A Note from Aaron: I published this post on my old blog when I was in my 20s and thought I knew more than I did. When launching my new site, I could either trash old content like this or port it over. I decided to port it over as a personal archive and reminder of my own evolution. In other words, sorry it sucks.


For my birthday, my RocketBolt cofounder, Matt, sent me a $20.00 Starbucks “eGift” card.1 Take a look at the notification email:

Do you see the error? I noticed it immediately because, in addition to being a developer, I’ve spent six years teaching Freshman Writing, and it’s an error my students constantly make. Let me break out one of my giant red pens in the hopes that, just like my students, both you and Starbucks might learn to hate me appreciate my constructive criticism.

Because Matt Hofstadt is one person, he can’t be the antecedent of a plural pronoun like “they.” The sentence doesn’t make any sense, and the mistake is surely damaging the “high quality” brand Starbucks cultivates in order to sell $5 coffee. If Starbucks is lucky, one of its employees is reading this blog post and correcting the problem right now. If not, I can’t help but worry that poor use of the English language is causing Starbucks to alienate the pretentious-douchebag-grammar-nerd demographic.2

Speaking of pretentious-douchebag-grammar-nerds, allow me to explain the evolution of the “I’m going to refer to a singular noun with a plural pronoun” linguistic phenomenon. It’s a product of increased gender equality. People used to generically refer to everyone as males, but you guys probably already knew that, right? As women (rightfully) began to take offense to always being referred to as dudes, a writer could either refer to gender-neutral, singular nouns with a clunky “he/she” type of construction, or he/she could opt for a less-awkward-to-write but absolutely wrong “they” or “them” pronoun. If you’re wondering what option writers tend to prefer – even though it makes no sense – scroll back up to that image of a Starbucks email.

Despite what this post might imply, I’m actually not the kind of guy who believes writers should unquestionably adhere to every grammar rule. To paraphrase Winston Churchill, strict adherence to grammatical rules simply for the sake of following rules is the sort of English up with which I will not put.

I don’t care if you end a sentence with a preposition. I don’t care if you put periods inside or outside your quotation marks. And I certainly don’t care if you start a sentence with a conjunction. However, even in a digital world where text without professional editing is globally accessible and likely to have errors — including this post — I don’t think I’m being unreasonable by suggesting we maintain the grammar practices that computers actually make easier.

Luckily, we still have time to fix a grammar problem, and the programmers of the world can help. By using programmatic logic when we code dynamically generated text, we can determine which gender a noun is referring to and then fill in the pronoun accordingly. It goes something like this:

[if $person == female :  return she ; else : return he ;]

In a case like the generic email I got from Starbucks where the gender of the purchaser is likely unknown, the solution is even easier. Try this little programmatic trick:

[$first_name] [$last_name] wanted to make your day so [$first_name] sent you a $20.00 USD Starbucks Card eGift to spend on your favorite beverage.

Wasn’t that easy? And yet, every day I witness discussions about the importance of beautiful, efficient, semantic code that never mentions outputting proper sentence structures. Why is it OK to harp on things like “semantic css classes” but it’s not important for dynamically generated text to use proper grammar? Let’s not forget that the end result of beautiful code is more than functionality and design. The code we write often dynamically outputs the words our users read, which means no matter how much you hated your Freshman Writing instructor, he or she probably taught you a lesson that could improve the quality of your code.

Update

This post made the front page of Hacker News because people apparently have some very strong (and in some cases) strange notions about both grammar and morality. Anyhow, I should do what I always tell my students. If the structure of the sentence causes so much controversy that it distracts from the meaning, change the sentence. Allow me to offer an alternative that solves everything:

Matt Hofstadt wanted to make your day by sending you a $20.00 USD Starbucks Card eGift to spend on your favorite beverage.

Wasn’t that even easier?

Footnotes

  1. Thanks, Matt! It was really a $100 gift card, but I want everyone to think he’s cheap.
  2. Judging by the comment threads on most websites, that’s a surprisingly large demographic.

Share

I teach in Duke University’s Innovation & Entrepreneurship program and founded RocketBolt. I write about startups, pedagogy, entrepreneurship, engineering, and poetry. They’re all related, I promise.

Leave a Reply

Your email address will not be published. Required fields are marked *

Instagram

  • Today, I lead the first meeting of a @dukeinnovation faculty committee about creating a methodology for teaching #entrepreneurship that can apply to any type of #venture.
.
Mind you, by “lead the meeting” I mostly just mean I was lucky to be in the same room with an amazing group of #scholars and #entrepreneurs who didn’t need any help from me to have a fascinating debate about how to accomplish a nearly impossible task.
.
But at least I got to take a picture from the head of the table 😁
.
#mycolleaguesarebrilliant #innovation #entrepreneur #wholetmein
  • Brought my daughter with me to watch my @dukeinnovation students graduate. She got to see dozens of examples of the kind of person I hope she becomes: brilliant, kind, thoughtful, articulate, talented, caring, confident, and really good at producing high quality work despite a propensity for procrastination 😁
.
Thanks, #duke2018 #graduates for making me love going to school every day. I hope your journeys beyond @dukeuniversity take you into jobs as amazing and rewarding as mine.
.
#graduation #innovation #entrepreneurship #classof2018 #bluedevils
  • Drinks at the @thelakewooddurham with the @dukeuniversity Junior Faculty Association to celebrate the end of another great semester.
  • Congrats to all my @dukeinnovation seniors who gave their final Capstone presentations yesterday.
.
No more #homework. Now it’s time for the #realworld.
.
#duke2018
.
.
.
#innovation #entrepreneur #entrepreneurship
  • Threw an LMOC (Last Monday of Classes) party in my #learningtofail class.
.
The students had to convince their friends to bring food, and they earned points based on how many calories they got delivered to class.
.
Lots of cookies and candies. But the winner was the student who convinced his friend to deliver 30 pounds of flour. 🤣
.
#innovation #entrepreneur #entrepreneurship #startup #ldoc #partytime
  • Asked my #learningtofail students to sell a @jollyrancher for $100 today. For the first time ever, everyone #failed.
.
In related news, I heard a report from a campus tour guide that dozens of prospective students and their families were continuously being solicited to buy absurdly expensive candy during their campus visits.
.
What a strange coincidence. Must have been someone else selling candy today, too...😒
.
#innovation #entrepreneur #entrepreneurship #sweettooth #collegevisits
  • Finally had a freshman discover the Duke-sponsored free lunch opportunity.
.
I forgot to ask Julia about the most important thing she’s learned in my class, but she’s taking another one with me next semester, so I feel like that’s a good sign she’s not just using me to get free food ☺️
.
#innovation #entrepreneur #entrepreneruship #socialmediamarketing #teaching #freelunch
  • The end-of-semester FLUNCH parade continues... this time with Thomas, one of my soon-to-be-graduating seniors in the @dukeinnovation capstone who’s heading off to work @txinstruments.
.
When asked to share the most important thing I’ve taught him about #entrepreneurship, Thomas had trouble coming up with an answer. Sounds about right 🤔
.
.
.
#entrepreneur #innovation #teaching #freelunch #duke2018
  • “When you go into a company, whatever you decide to do, you want to be closest to the money. That’s the safest place to be in every business.” - @cleithe, VP of Sales for @adwerxre, who I conned into speaking to both my @dukeinnovation capstone classes.
.
.
.
.
.
#sales #marketing #startups #entrepreneur #entrepreneurship #innovation
  • Doing a little FLUNCH with @adam_kershner,  Ben Lee, and Adam’s freshman roommate who was just there for the free lunch ☺️
.
Adam says the most important thing I taught him was: “How to think differently and approach problems in an unorthodox way, and how that approach to problem solving is one of the most valuable lessons from Duke.”
.
Honestly, I don’t think I taught him that. I think he already knew it when he showed up as a freshman in my very first class @dukeuniversity. Now he’s a graduating senior in my @dukeinnovation capstone, and it’s been a privilege to watch his Duke journey. I’m sure he’s going to do great things, and I look forward to following his post-college journey via Instagram.
.
P.S. Adam, tell Ben to follow me here so I can keep tabs on him, too 😉
.
.
.
#innovation #entrepreneur #entrepreneurship #startups #teaching #duke2018
  • “I’m not tasked with trying to sell you anything. Thankfully. There’s nothing more boring. What we’re looking to do is be magnetic. Pull you into our orbit. Be interesting.” -  @gavinohara, the global social creative lead for @lenovo, talking with my @dukeinnovation class about the importance of sharing good content online instead of trying to “sell.”
.
.
.
.
.
#entrepreneur #entrepreneurship #innovation #socialmediamarketing #socialmarketing #startups #corporatemarketing
  • Here’s the final viral #meme  video created by my @dukeinnovation #learningtofail class: #piggybackchallenge
.
Would you randomly take a ride on a stranger’s back? 😁
.
.
.
.
.
.
#innovation #entrepreneur #entrepreneurship #startups #socialmediamarketing #viralvideos #memes #memestagram

Follow Me!