My Nightmare, and an Apology

My Nightmare, and an Apology

rom 1981 through 1986, I taught high school. I was fresh out of college (OK, a semester of engineering grad school which “didn’t take”), didn’t really know what to do, had helped teach a few courses while an undergrad, and figured “Hey, I can do this!” At the time, private schools were paying less than $10K per year, and even then, it seemed pretty puny. The first year I taught at a small private Catholic school-clearly a mismatch, given my own severely un-Catholic upbringing. I had a friend teaching at a prep school nearby, and I jumped ship. I spent six years guiding preppies through geometry, algebra, and calculus.

At this particular prep school, like most, all teachers were required to coach a sport. Those who know me know I don’t coach sports. It’s just not happening. So as a trade-off, I was relegated to the school’s music program. I prepared the yearly musical (with the school’s local sister school), and conducted the glee club. Each year we put on a number of concerts, and each was, well, a trial. Most of the kids I corralled into the glee club did it only for college “points” (something to put on their application), and it was a struggle to get kids to rehearsal. To be honest, I wasn’t all that good at running rehearsals, getting kids to rehearsals, or maintaining discipline during rehearsals. Combined with the school’s general lack of support for musical activities (in deference to sports-did I mention that sports was important?), each concert we gave was a hair-raising experience (and I did have hair at that point).

In 1983, the school bought a single-floppy IBM PC. A year later, we got a second floppy (and this was a big deal). I learned to program. Hoping to extract myself from the music program, I convinced the powers that be that I could program their PDP-11, got the job of IT manager for the school, and then proceeded to learn how to actually program in PDP-11 BASIC. (Yes, I lied. I can live with it. It all worked out for the best in the end. Sometimes the end does justify the means, and a little white lie.)

By 1986 it was time to leave (it had been time to leave for five years, or so thought my parents) and I took a job providing tech support at Ashton-Tate, and here we are, twenty-some odd years later. But the fact is, I still have recurring nightmares about teaching high school. You know that dream you have where you have to take an exam, but you’re not prepared? I have the one (I’m guessing most of you don’t have this one) where we have the Christmas concert coming up, and we haven’t rehearsed. I try to get 50 boys to slog through choruses from the Messiah, and it’s not pretty. Twenty years later I still have the same stupid nightmare. It’s getting old.

In my current “job”, I also have a recurring nightmare, and this one actually came true a few months ago. (Unwitting plagiarism is actually my greatest fear, but I’ve been lucky on that one so far!) When you spend your days writing content for various publications, often on material you’ve just learned enough about to sound like you actually know something, you worry (a lot) that you’ll say something that’s completely wrong. Or write up some bit of complicated bit of code that turns out to be totally unnecessary.

And that’s exactly what I did. In the CoDe Magazine, March/April 2007 issue, I wrote up an article containing a scenario that involved creating an e-mail attachment from data stored in a string. To be honest, the column started when a friend asked me how to solve this particular programming problem. His issue was that although the Attachment class provided a constructor that took a string as a parameter, that string represented the name of a text file. Not actually reading the documentation beyond confirming that indeed, the constructor wasn’t going to help, I figured that the best solution was the one I knew-that bit you saw in the previous column that created a stream, read the contents of the string into the stream, and then used the appropriate Attachment constructor taking in the stream value. Yes, it works. Yes, it’s overkill. And finally, yes, I feel pretty stupid.

About a week ago, I got the following e-mail from David A. Cohen. He was polite, but the e-mail was still crushing. He wrote:

I work a lot with attachments, and I thought your article was very well written. However, it was also kind of unneccesary. There is a static function in the Attachment class, Attachment.CreateAttachmentFromString that I believe would do everything in the article (while also being infinitely easier to maintain since it’s built in).

Oops. Look at that! One method call, rather than the stupid code I had written to work around the lack of a method (so I thought) to accomplish this particular goal. Let’s rewind: If you need to create an e-mail attachment, and your data is stored in a string variable, call the Attachment.CreateAttachmentFromString method. Can I recall that column from two issues back? It works just about as well as recalling a message you sent via Microsoft Exchange.

Here’s what I’ve been saying, while talking about the .NET Framework, for the past six years: If you find yourself writing code that you figure is something that every .NET developer will need, stop. Don’t do it. Investigate the documentation. Most likely, it’s in the .NET Framework. (Of course, this isn’t always true: Case in point, determining the amount of free space on a drive in the .NET Framework 1.x. But I’ll forgive them for that?it forced me to learn how to use the System.Management namespace, a useful trick.)

I apologize. I feel terrible for misleading all the readers here, and many of you probably already determined my error. I worry about this problem constantly, and clearly didn’t worry enough, or at least, didn’t perform the requisite research, this time. Learn from my nightmares: avoid teaching high school unless that’s what you really want to do, and make sure you read the documentation carefully before prescribing a solution to a problem that really doesn’t exist in a very public place. I’m sorry. I’ll try harder next time, and I hope you’ll accept my correspondingly public apology.

Editor’s Note: This article was first published in the July/August 2007 issue of CoDe Magazine, and is reprinted here by permission.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes