Engineering ethics

Brent Simmons has a good post today on ethics for programmers:

Were software engineer a profession like doctor or lawyer, we’d have a strong and binding set of ethics.

There is a code of ethics for software engineers—over and above the ACM code Brent mentions—but it’s known mostly to licensed professional engineers, and few programmers are licensed.

If you’re a regular reader of this blog or my Twitter feed, you know how hard it is for me to write the phrase software engineer. Deep down, I still think engineering should be reserved for work in the physical world, not in the conceptual world where most software resides. But the writing has been on the wall for a long time, and I don’t really expect the traditional definition to prevail. Nowadays my complaints about programmers calling themselves engineers are done as a joke in the “get off my lawn” vein:

@danielpunkass @caseyliss You software people are so cute with your ideas and stuff.
Dr. Drang (@drdrang) Jan 14 2015 7:44 AM
@drdrang @caseyliss Excuse me, I am a software ENGINEER. I should know a thing or two about ENGINEERING, thank you very much. Look it up …
Daniel Jalkut (@danielpunkass) Jan 14 2015 7:45 AM
@danielpunkass @caseyliss Look it up? OK…


Dr. Drang (@drdrang) Jan 14 2015 7:59 AM

Not that long ago, Daniel couldn’t be a licensed engineer, because there was no licensure procedure for software engineers, but that changed a couple of years ago. Now there’s a licensing exam for software engineering, although I don’t know how many states currently accept it.1 Each state has its own rules for the licensing of professional engineers, and some of those rules would probably have to be altered to allow programmers to get licensed, even with the availability of an exam.

(I am, by the way, curious what programmers think of the topics covered by the exam.)

Professional engineers are guided by the NSPE code of ethics. Licensed software engineers are no different. Strictly speaking, the NSPE has no statutory power—it’s just a professional organization like ACM—but state boards of registration do consider it when conducting disciplinary investigations.2

The six fundamental canons of the code are:

  1. Hold paramount the safety, health, and welfare of the public.
  2. Perform services only in areas of their competence.
  3. Issue public statements only in an objective and truthful manner.
  4. Act for each employer or client as faithful agents or trustees.
  5. Avoid deceptive acts.
  6. Conduct themselves honorably, responsibly, ethically, and lawfully so as to enhance the honor, reputation, and usefulness of the profession.

I’d say the Brent’s concerns about spyware and monitoring software fall under the “avoid deceptive acts” canon. Another section of the code states

Engineers shall avoid all conduct or practice that deceives the public.

I think that fits, too.

The purpose of licensure is to protect the public by guaranteeing a minimum level of competence in licensed practitioners. Typically, this means protection from physical harm. Since most software poses no risk of physical harm—beating your head against your desk when a program eats one of your files doesn’t count—licensure of software engineers may not seem that important. But as software threads its way into more aspects of our lives, our definition of protection will broaden, and more software will have to be approved by licensed software engineers.


  1. When this article was written, thirty states had software engineering licenses. 

  2. The NSPE is an American organization, but most nations have a similar code of ethics for engineers. Several years ago, I was working on a project with a Canadian engineer who wore an iron ring on his right pinky. The Iron Ring ceremony is a wonderfully Victorian ritual (complete with text by Rudyard Kipling) to instill the ethics and obligations of the profession in young engineers. 


Nuts

When I ran across this New York Times article last night, I had a bad feeling. In classic inverted pyramid style, the gist of the article is in the first paragraph:

Turning what was once conventional wisdom on its head, a new study suggests that many, if not most peanut allergies can be prevented by feeding young children food containing peanuts beginning in infancy, rather than avoiding such foods.

Today I saw it at the top of the “most emailed” list the Times runs in its sidebar. This could be because lots of people are interested in peanut allergies, or science and medicine in general, but I suspect it’s really because the article confirms many people’s preconceived notions about overprotective parents, malpractice-averse doctors, and an alarmist press corps.

In fact, I don’t believe the reported study turns conventional wisdom on its head at all. Most of the people I’ve met who don’t have a child with peanut allergies were already certain that the problem was, if not entirely in the heads of a group of Munchausen-by-proxy parents, then certainly due to kids being raised in environments that are too clean, too safe, and too antiseptic. For these people, it’s obvious that exposure to peanuts will toughen up a kid’s immune system, and it’s about time doctors recognize that.

I am, as you’ve surely guessed by now, not a disinterested party in this matter. I’m not exactly sure when my wife and I realized our third child, Matt, had peanut and tree nut allergies, but he was pretty young. A little peanut butter at the corner of his mouth caused that side of his face to puff up and squeeze his eye shut. We thought back to a couple of times when he was even younger and had become suddenly sick for seemingly no reason. In one case he’d just eaten a piece of cookie that—we guessed in hindsight—had traces of nut in it.

Had we been especially cautious in what we fed Matt? Not really. He was, as I said, our third child, so we had the cavalier attitude common to experienced parents. Matt certainly didn’t get the intense scrutiny our oldest did. We fed him what seemed right based on what his older sister and brother had eaten when they were his age, adjusted for his apparent tastes and tolerances.

His tolerance for peanuts and nuts was essentially zero. When he went in for allergy tests, his reactions to the pinpricks on his back were so severe the allergist would stop the test before it was finished. When Matt was in elementary school, my wife once had trouble getting his EpiPen prescription filled at Walgreen’s. The pharmacist had no experience with a boy his age getting the full-sized EpiPen. He was sure the prescription should have been for an EpiPen Jr., but he was wrong.

Don’t get me wrong. I’m not saying the study is invalid or unimportant or that the Times did a poor job of reporting it. It would be wonderful if it leads to effective methods to reduce peanut allergies. I do, however, think this passage could have come earlier than the 16th and 17th paragraphs:

The study, sponsored by the National Institutes of Health and other organizations in the United States and Britain, involved infants 4 to 11 months old deemed to have a high risk of peanut allergy because they already had severe eczema or were allergic to eggs.

The infants were given skin-prick tests for peanut allergy. Those already allergic to peanuts were excluded from the study.

So this study has nothing to say about kids who have a peanut allergy before their first birthday.1 But that won’t stop your crazy uncle from emailing you the article and saying he knew it all along.


  1. Actually, if you go to the New England Journal of Medicine article on which the Times story is based, you’ll learn that it’s more complicated than that. In the pre-trial screening, 542 children had no reaction and 98 had a relatively minor reaction to the skin-prick test. These were the children that were accepted into the trial. Excluded from the trial, and for good reason, were the 76 children who had a significant reaction to the pre-trial skin-prick test. 


Searching for awesome

Last week, after seeing the word awesome used several times for things that weren’t close to awesome, I started thinking about how much its profligate use annoys me.1 Then I wondered if I’d been using it here. It’s not such a terrible word, but it is kind of young for me. I’m too old for certain clothes, certain hairstyles, and certain words. Awesome is one of those words.

So the next time I sat down at a computer, I searched the ANIAT archives for awesome.

Was a little disturbed to find that the word “awesome” appears in 8 of my blog posts.
Dr. Drang (@drdrang) Feb 20 2015 4:45 PM

In my defense, in four of those eight posts I was quoting someone, and in the other four I was using it in a joking way. Still, it pays to be vigilant. It’s only a short step from awesome to awesomesauce.

The Markdown source of all my posts is in a set of year/month subdirectories in Dropbox, so it was easy to find all my awesomes. I navigated to the ANIAT folder and issued this command:

grep -ir awesome source/

One of the things I really like about grep is how it allows both -r and -R switches for recursive searching. If only cp were as forgiving. The -i switch makes the search case-insensitive.

Grep has a long, long history in Unix. The original version was written by Ken Thompson, extracting a common command from his ed text editor and making it available for command line use. For many, grep is a synonym for regular expression searching.

Several years ago, a new search tool, ack, started getting attention. It was written in Perl and was supposed to be very fast, especially when searching through complex source code directories, because it didn’t bother searching files you were unlikely to care about, like binaries and version control files. It became popular among TextMate users, mainly because there was a nicely done TM plugin that used it.

I never got into ack, even when I was using TextMate, mainly because the type of searching it was really good at wasn’t the type of searching I normally did. I don’t manage large software projects, so its efficiencies didn’t mean much to me.

Somewhat later came The Silver Searcher, which goes by the name ag on the command line.2 It’s supposed to be fast both because it ignores the same sort of files ack does and because its search algorithms are speedy on the files it doesn’t ignore.

How much faster? Well, let’s look. Here’s my grep search for awesome on a 2010 MacBook Air:

$ time grep -ri awesome source/ > /dev/null

real  0m0.658s
user  0m0.600s
sys   0m0.053s

And here is is with ag:

$ time ag -i awesome source/ > /dev/null

real  0m0.110s
user  0m0.060s
sys   0m0.065s

Pretty decent speedup, especially when you consider that the source directory has nothing but Markdown files in it—no files are being ignored.

So why did I use grep instead of ag last week? Old habits are hard to break. The word grep is so engrained in my head as a synonym for search—even when I’m not using regular expressions—that I start typing it before I think.

But there are good reasons for switching. Apart from the speed, if I happen to be searching a git repository (and my ANIAT files really should be under source control, shouldn’t they?), results that don’t correspond to the source code itself get in the way, even when there are only a few of them.

With luck, writing this post will inspire me to make ag my new habit. That would be awesome.

The Surfer

Image from Giant-Size Marvel, but ultimately from Jack Kirby.


  1. I was on an hour-long train ride and had exhausted my RSS feeds and Reading List items. I was primed to be annoyed. 

  2. Mercurial users will recognize the cute trick of using a chemical symbol for a command line name. 


Keep an eye on Weather

How many weather apps have you tried? It’s been a fertile field for as long as the App Store has been in business, mainly because Apple didn’t put much effort into the built-in Weather app. It was plain in looks and low in information, the kind of app you wanted to replace with something spiffier from a third party. If you’re like me, you tucked Apple’s Weather app into a folder on one of your back screens and forgot about it.

If so, you may want to bring it out and look at it again, because somewhere in the last couple of versions it has blossomed into a truly useful app.

Weather app

The hourly forecast scrolls horizontally, covering the next 24 hours; the daily forecast runs for 10 days; and the current conditions list everything I usually want. It is missing an integrated radar map, but The Weather Channel’s map is just a click away.

I used Weather for my example screenshots in the last couple of posts partly because its variegated background shows off the masking of both my statusbar cleaning scripts and the QuickTime mirroring, but also because it’s become my weather app of choice, back on my home screen for the first time in ages.