Mark Jason Dominus on the importance of giving fish

November 2, 2011 Communication, Open source, People 2 comments , , , ,

By Mark Jason Dominus, from a talk in 2003, reprinted here with permission. Sadly, it’s still relevant today.

The #perl IRC channel has a big problem. People come in asking questions, say, “How do I remove the first character from a string?” And the answer they get from the regulars on the channel is something like “perldoc perlre“.

This isn’t particularly helpful, since perlre is a very large reference manual, and even I have trouble reading it. It’s sort of like telling someone to read the Camel book when what they want to know is how to get the integer part of a number. Sure, the answer is in there somewhere, but it might take you a year to find it.

The channel regulars have this idiotic saying about how if you give a man a fish he can eat for one day, but if you teach him to fish, he can eat for his whole life. Apparently “perldoc perlre” is what passes for “teaching a man to fish” in this channel.

I’m more likely to just answer the question (you use $string =~ s/.//s) and someone once asked me why. I had to think about that a while. Two easy reasons are that it’s helpful and kind, and if you’re not in the channel to be helpful and kind, then what’s the point of answering questions at all? It’s also easy to give the answer, so why not? I’ve seen people write long treatises on why the querent should be looking in the manual instead of asking on-channel, which it would have been a lot shorter to just answer the question. That’s a puzzle all right.

The channel regulars say that answering people’s questions will make them dependent on you for assistance, which I think is bullshit. Apparently they’re worried that the same people will come back and ask more and more and more questions. They seem to have forgotten that if that did happen (and I don’t think it does) they could stop answering; problem solved.

The channel regulars also have this fantasy that saying perldoc perlre is somehow more helpful than simply answering the question, which I also think is bullshit. Something they apparently haven’t figured out is that if you really want someone to look in the manual, saying perldoc perlre is not the way to do it. A much more effective way to get them to look in the manual is to answer the question first, and then, after they thank you, say “You could have found the answer to that in the such-and-so section of the manual.” People are a lot more willing to take your advice once you have established that you are a helpful person. Saying perldoc perlre seems to me to be most effective as a way to get people to decide that Perl programmers are assholes and to quit Perl for some other language.

After I wrote the slides for this talk I found an old Usenet discussion in which I expressed many of the same views. One of the Usenet regulars went so far as to say that he didn’t answer people’s questions because he didn’t want to insult their intelligence by suggesting that they would be unable to look in the documentation, and that if he came into a newsgroup with a question and received a straightforward answer to it, he would be offended. I told him that I thought if he really believed that he needed a vacation, because it was totally warped.

Mark Jason Dominus has been doing Perl forever. He is the author of Higher Order Perl which belongs on the shelf of every Perl programmer. Follow him on Twitter at @mjdominus.

How to deal with busybodies at work

October 17, 2011 Work life 5 comments , ,

They’re young or old, male or female. Every workplace has them. They’re the busybodies who want to tell you how to live.

  • “I can’t believe you’re using an iPhone.”
  • “Are you and Kathy going to get married some time?”
  • “Another diet Coke? That aspartame is no good for you.”
  • “You’re going out without a coat?”
  • “You’re eating THAT?”
  • “Your kids shouldn’t be watching that much TV.”
  • “Why wouldn’t you drive an American car?”
  • “Have you thought about exercising?”

The busybodies at work can find anything to discuss and let you know what we should be doing differently. They tell us that we should be doing things their way. The right way.

As geeks, we are good at discussing the merits of an argument. We think we can explain our point of view and the other person will leave us alone, having seen the logic of our answers. We might think that explaining “I’m well-versed in vi, I have a large ~/.vim directory of plugins, and it fits my work style” will leave the emacs fan satisfied that we’ve made the right choice for us.

But it doesn’t work that way. The busybody comes back with an answer that takes ours into account, but still tells us we’re wrong. “Sure, but emacs probably also has all those plugins, and it can also…” For every argument we make, the busybody has a counter-argument.

It’s an interesting game, but the only way to win is not to play.

The way I don’t play this game is with a simple, non-judgmental response of “Thanks, but I don’t care to discuss that.” It doesn’t give the busybody any foothold to argue further. If he comes back and says “Oh, I know, but don’t you think you’d feel a lot better if you just smoked less?” I can reply, unchanged, with “Thanks, but I don’t care to discuss that.” If he still comes back, I can say “Thanks, but I don’t care to discuss that. I need to get back to work now.”

I’ve also found that providing justifications for our choices in life has a negative effect. Explaining our actions to others who have no business in our lives tells the busybody that he is right to be meddling in our lives. This is the wrong message to send, as no justification is necessary. It only encourages him in the future.

If you’re old enough to have a job, you’re old enough to make decisions about your life by yourself.

I don’t begrudge the nosy their motivations. I like to assume that they’re only looking out for what they imagine are my best interests. It doesn’t make their comments any less rude, but it does make it easier for me to not feel insulted by them.

On technical issues, I have to give the busybodies a little leeway, but not much. If a co-worker wants to turn me on to a new tool or technique, then that’s certainly OK. What’s not OK is badgering me about it after I’ve made my choice. I typically will say something like “I see that there are merits to using zsh over bash, but I prefer bash. If you think that zsh should be mandated in the department, why don’t you take it up with Dave and we’ll see if we should set shell choice as a standard.” That often gets the busybody to back off because he doesn’t want to risk losing his own freedom to choose.

Dennis Ritchie, pioneer of programming, has died

October 13, 2011 Programming, Unix 1 comment , ,

Dennis Ritchie, pioneer of programming, creator of the C programming language and one of the creators of UNIX, has died.

Tim Bray said it best: “It is impossible — absolutely impossible — to overstate the debt my profession owes to Dennis Ritchie. I’ve been living in a world he helped invent for over thirty years.”  If you’ve written a program on any computer in any language since the mid-1970s, you’ve been influenced by the man’s work.

In his honor, the choir will now sing one of my favorite programming songs, “Write in C”.

When I find my code in tons of trouble,
Friends and colleagues come to me,
Speaking words of wisdom:
“Write in C.”

And as the deadline fast approaches,
And bugs are all that I can see,
Somewhere someone whispers:
“Write in C.”

Write in C, write in C,
Write in C, yeah, write in C.
Don’t even think of COBOL
Write in C.

If you’ve just spent 30 hours
Debugging some assembly,
Soon you will be glad to
Write in C.

I used to write a lot of FORTRAN,
For science it worked flawlessly.
Try using it for graphics!
Write in C.

Write in C, write in C,
Write in C, oh, write in C.
BASIC’s not the answer,
Write in C.

Now, let’s move forward with our lives, and remember to always place the opening brace of a block on the same line as the control statement, as he would have wanted it.

Which of my PostgreSQL indexes are getting used most heavily?

October 10, 2011 Open source, Programming No comments , , , ,

Ever since we got the fast new database server with SSDs, I’ve been monitoring which tables are getting heavy traffic and should go live on the SSDs. We have two tablespaces, “fast” which is faster but smaller, and “slow” which is bigger but slower. I’ve been using this query to determine which indexes should live in which tablespace. There are different forms of this query around the web, but I needed to see the tablespaces, too.

SELECT
    i.idx_scan,
    i.idx_tup_read,
    i.idx_tup_fetch,
    i.indexrelname AS index,
    it.spcname AS index_tablespace,
    i.relname AS table,
    tt.spcname AS table_tablespace,
    pg_size_pretty(pg_relation_size(i.indexrelname::text)) as index_size
FROM pg_stat_all_indexes i
    INNER JOIN pg_class ic ON (i.indexrelid = ic.oid)
    LEFT OUTER JOIN pg_tablespace it ON (ic.reltablespace = it.oid)
    INNER JOIN pg_class tc ON (i.relid = tc.oid)
    LEFT OUTER JOIN pg_tablespace tt ON (tc.reltablespace = tt.oid)
ORDER BY 1 desc, 2 desc, 3 desc

The output looks like this (in \x mode because of the width):

-[ RECORD 1 ]----+----------------------------------------------------
idx_scan         | 395974172
idx_tup_read     | 432974893
idx_tup_fetch    | 426070104
index            | testbook_pkey
index_tablespace | fast
table            | testbook
table_tablespace | fast
index_size       | 289 MB
-[ RECORD 2 ]----+----------------------------------------------------
idx_scan         | 133416135
idx_tup_read     | 133441801
idx_tup_fetch    | 133413399
index            | lists_listid_custid
index_tablespace | fast
table            | lists
table_tablespace | fast
index_size       | 7096 kB
-[ RECORD 3 ]----+----------------------------------------------------
idx_scan         | 50310975
idx_tup_read     | 1286116
idx_tup_fetch    | 742639
index            | listdetail_bkkey_listid_where_ctr2_is_zero
index_tablespace | fast
table            | listdetail
table_tablespace | fast
index_size       | 682 MB

I have one case where a heavily-trafficked table is still staying on the slow tablespace. It’s a log of user login history that is only ever appended to, and is searched only a few times a day. SSDs are great at random reads, but not much faster than physical spindles on sequential writes. Therefore, my login history would not benefit much from moving to the SSD tablespace, and I can allocate that precious space to another table or index instead.

You’re not a genius? Says who?

October 10, 2011 Open source, People, Social 2 comments , , , , ,

Who says you’re not a genius?  Who are any of us to say?  And why would anyone bother telling someone that?

In my last blog post, I talked about how it was unnecessary and counterproductive to justify your projects to your detractors. It only wastes time that could be spent doing something positive, and it’s not going to change anyone’s mind.  One of the commenters took issue with my premise, basing his disagreement on the glib comment “You ain’t Steve Jobs.”

Of course I’m not, but so what? How much of a genius do I have to be before I no longer have to justify myself to others? (Don’t answer that; it only encourages them.)

The unspoken corollary to comments like “You ain’t Steve Jobs” seems to be “Therefore, you must listen to how others want you to be.” Fortunately, even in the absence of a Jobs-level genius, we’re all able to stand on our own, to live and work as we see fit, without having to take mandatory guidance from others.

I wonder at the thought process that it takes to tell someone “You’re not as _____ as you think you are.”  Near as I can figure, comments like these have one or more of these subtexts:

  • “You need to be more like me.”
  • “I’m trying to save you wasting time or risking failure.”
  • “I have taken it upon myself to take you down a peg and put you in your place.”  (This one often appears with the phrase “I’m just saying…”)

Fortunately, none of these are valid, none of them need concern you.  You can, and should, ignore them.  Ignore them for your own sake, and for the sake of the awesome things you have in you to share with the world.

I wonder how many Jobs-level brains are out there but never flower because the person was told too many times that he (or more likely, she) isn’t as good as he thinks he is. Neil deGrasse Tyson makes a brilliant point about how we teach children, that parents spend the first years of a child’s life teaching him to walk and talk, and the rest of his life telling him to shut up and sit down, quashing their sense of wonder and thirst for knowledge. “You ain’t Steve Jobs” is the adult version of “shut up and sit down.”

Whatever your level of genius, one thing we can all share with Steve is his perseverance.  He kept working at what he believed in, despite public derision about his public failures.  Before the success of the Macintosh, Apple released the Lisa, and before the iPad, the Newton. How much poorer the world would be if Jobs had listened to his critics and packed it in!

I’m not saying that there isn’t value to be found in criticism, even unsolicited criticism, about your work.  I’m not suggesting that you shut out the world around you.  If you can take what you find useful and leave the rest, then do it.

I am suggesting that you shut out those who tell you you’re no good, or who want to put you in your place. When people tell you you’re not awesome, ignore them.  Who are they to say?  And why does it matter if they think you’re awesome or not?  Eventually, you’ll prove them wrong.

 

There’s only one useful way to handle your detractors

October 6, 2011 Open source, People, Social 8 comments , , ,

Here’s a Reddit/Slashdot/whatever thread that never happened:

Internet crank on Reddit: “Hey, Steve Jobs, I guess that new iPad looks cool, but I think iPad is a stupid name, it makes me think of sanitary napkins.”

Steve: “Yeah, well, here’s why we called it that. (Long explanation justifying his choices)”

Crank #2: “Well, why didn’t you call it the iTablet? I think that would have been a good name. What does everyone else think?”

Crank #3: “What does it have to be iAnything? I’m tired of the i- prefix.”

Steve: “We thought about that, but … (More explanation about his choices)”

Crank #1: “And really, isn’t it just a bigger iPod Touch? I would never carry that around with me. And come on, you’re just trying to redo the Newton anyway LOL”

Steve: “My logic behind the iPad is (vision, business plan, blah blah blah)”

Can you even  imagine Steve Jobs in this sort of time-wasting and emotionally draining tit-for-tat in a thread on Slashdot? On reddit? In some blog’s comment section? Of course not. Justification of his plans would take away from the amazing things that he needed to achieve.

Naysayers are part of every project. How many people do you think pissed on Jimmy Wales’ little project to aggregate knowledge? Nobody’s going to spend their time writing encyclopedia entries! And yet there it is.  On a personal level, if I listened to everyone who thought I was wasting my time improving on find + grep you’d never have ack.

We all have to persevere in the face of adversity to ideas, but there’s more than that.  We need to ignore our detractors. Despite how silly and time-wasting it is to argue your motivations and reasons for undertaking a project, many of us feel compelled to argue with everyone who disagrees with us.  I suggest you not waste your time.

On the Internet, the attitude is “Why wasn’t I consulted?” Every anti-social child (measured by calendar or maturity) with a keyboard thinks it’s his responsibility to piss on everything he doesn’t like. They’ll be there always. You can no more make them go away than you would by arguing with the rain.

What are you hoping to achieve by arguing with someone who doesn’t like your project? Do you expect that he’ll come around to your way of thinking? It won’t happen through words.

Not only does arguing with your critics waste your precious time, but it tells them, and every other crank reading, that you’re willing to engage in debate about what you’re doing. Don’t encourage them! Let them find a more receptive target.

I’m not saying that factual misstatements need to be ignored.  If something is provably incorrect, go ahead and counter it with facts.  However, most of the time these message thread pissing wars get down to “I would not be doing what you are doing, and therefore you are wrong for doing so.”

The only thing that has a chance of silencing your critics is success at what you do. Arguing with the naysayers doesn’t get you any closer to that.

“The only way to do great work is to love what you do.”

October 6, 2011 Career No comments ,

As most everyone who knows me knows, I wrote a book called Land the Tech Job You Love. The word “love” is in the title very specifically. As I discussed with my editors at Pragmatic what we’d title the book, the one point on which I was adamant was that “love” had to be in the title. I didn’t want you to find a job you liked, or tolerated, but one that you loved. I wanted “job you love” to be a constant reminder to the reader.

Every so often, either in person or in an online forum, someone will make a snarky comment along the lines of “Work sucks, work is supposed to suck, why fool yourself into thinking that you’ll ever enjoy going to work in the morning?” I always answer yes, I do believe that it’s possible to get a job you love, and if you’re not in one now, then you can find the next one that you do love, or you can work to make your current job into one you love.

And if you don’t believe me, perhaps you’ll believe our dearly departed Steve Jobs, from his
commencement address to Stanford in 2005:

You’ve got to find what you love. And that is as true for your work as it is for your lovers. Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do.

If you haven’t found it yet, keep looking. And don’t settle. As with all matters of the heart, you’ll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking. Don’t settle.

The other drum that I keep beating is “Life is too short to spend in a crappy job.” Steve agrees.

For the past 33 years, I have looked in the mirror every morning and asked myself: “If today were the last day of my life, would I want to do what I am about to do today?” And whenever the answer has been “No” for too many days in a row, I know I need to change something.

Please, if you’re in a job you don’t like, change it. Change the job, or change jobs. If you’re stuck in the job because of the crappy job market, then at least make a little change in that direction. Start a side project that scratches an itch. Release it to the world. Do something awesome and spread it around.

As Steve said, quoted here: “Being the richest man in the cemetery doesn’t matter to me. Going to bed at night saying we’ve done something wonderful… that’s what matters to me.”

Thanks for everything, Steve.

Where to find me online

October 4, 2011 Internet, Social No comments , , , , , , , , , , ,

Although I mostly write to my blog and my Twitter feed, here’s a dump of most of my online presences.

petdance.com
My blog is where I post about technology and job hunting and careers.
@petdance on Twitter
My main outlet for posting short thoughts and links to interesting stuff. (I try not to engage in conversation on Twitter, because I think it’s annoying for everyone but the two people involved in the conversation.) If you were following @theworkinggeek or @techworklove on Twitter, switch to @petdance.
Perlbuzz
Perl news and the occasional original article. Most of the blog traffic is a weekly recap of the news bits posted to the @perlbuzz Twitter feed.
Facebook
I’ve whittled down my Facebook friend roster to mostly friends and family and people I know in day-to-day life. I’ve found that I’m not interested in the day-to-day lives of people I only know from the world of open source. Therefore, most of the friend requests I get from people I only know online get ignored.
Google+
I’m not sure how I’m going to wind up using Google+. Mostly I’ve been posting longer-form blurbs or embedding media.
Slideshare and Speakerdeck
I’ve always been posting slides of my talks on Slideshare, but Speakerdeck has just popped up and I like their interface much more, so I’ve put some content there, too. Look for Speakerdeck to gain more traction in the programming community.
LinkedIn
I have yet to have anything useful come out of LinkedIn, but I maintain a network there as well. My rule for adding someone as a contact on LinkedIn is that it has to be someone with whom I’ve actually worked on a project.
Github
Github is where I host most of my open source projects. Love love love.
Flickr and twitpic
I’m not at all a photographer, but there you go.

Did I forget one? Leave me a comment.

Trying to get your boss fired means you’re looking at the wrong problem

September 30, 2011 Career 4 comments , ,

I found a thread a few days ago where someone asked “I want to get my boss fired, because he’s incompetent and is ruining the department, so how can I do this?” This idea is broken at many levels, and the stuff of delusional daydreams.

If you’re ever in a situation like this, stop and take a breath and consider a few facts.

First and foremost, you’re not a superhero, and you’re not smarter than everyone else. It is not your job to come in and single-handedly save the IT department from ruin. That level of hubris is self-delusional and dangerous to your career. And if you ARE smarter than everyone else in the company, then you’re in the wrong company.

Second, you can’t “get your boss fired” by yourself. If you imagine that you can walk into your grandboss’s office with a list of the boss’s stupid moves, you’re fooling yourself. That’s not how things work. Do you think your grandboss is going to look at your well-documented list of the boss’s sins, say “Thank you, Johnson” and then can the boss? That’s fantasy. What’s more likely to happen is that you’ll get fired for insubordination. At the very least, you’ll piss off your boss because he’ll find out about it.

Note that I’m not talking about times when the boss is doing something illegal or unethical. In times like that, it’s your responsibility to take these issues up with upper management. I’m talking about when the boss makes bad decisions (or more likely, decisions you don’t agree with and have dubbed “bad”), or is a jerk, or is just somehow a bad boss.

Finally, what do you think is going to happen when you “get the boss fired”? Do you imagine that a better boss will be hired in his place? Why do think that upper management will get it right the second time? They screwed up once, and they’re not fixing the problem, so what will change the second time around?

Realistically, when you’re in a situation like this, one of two things will happen. Either upper management is aware of what a loser your boss is and he’ll be gone soon enough, or they can’t tell he’s ineffective, and no amount of your documentation of his bad decisions is going to change that.

So the question is, which situation are you in? Do you trust upper management to take care of things and get rid of your bad boss? If so, sit tight and do your job. And if you think upper management is as dumb as your boss himself, then you are in a crappy company and need to get out.

The bad boss is not the problem. The company that allows him to be a bad boss is the problem.

What I learned hanging out at the vascular surgery conference

September 26, 2011 Career 7 comments ,

I spent a couple of days this month at Postgres Open in Chicago.  It was a fantastic conference with a ton of good technical information. (Here are my notes from the Postgres Open sessions). However, my favorite part, by far, was going to check out the vascular surgery conference at the other end of the hotel.

I’ve always enjoyed peeking into other subcultures.  I’ll devour any trade magazine I can get my hands on. If you’ve never read Pit & Quarry Magazine, you probably never considered the importance of maintenance of the belt system on your aggregate conveyor. For all the differences between programming and, say, running a brake and alignment shop, the core business principles are still there.  Everyone still wants to do a good quality job, do it cheaper, do it better, and without going crazy from unreasonable demands from customers or the bosses above. The wisdom of other groups can lead to insight to help our own.

I’d seen the signs for the conference in the hotel earlier that day, so I moseyed down to see what was going on. Inside a room full of exhibits, the vascular surgery community was having its opening get-together. I didn’t see anyone checking badges at the door, which was good because I sure didn’t have one.  I figured they would probably ask me to leave, since I was so out of place, the only one without a suit, but no harm could come from trying, so in I went.

The first difference in parties thrown by medical companies vs. open source database consultants is just how much money the medical guys have.  There was an open bar with a guy in a tux, and another guy was serving little roast beef sandwiches carved off the biggest piece of cooked meat I’d ever seen in my life.  I hope that someone from the kitchen staff got to take home the leftovers and feed his family for a few weeks.

A sales rep in a suit came up and asked if I was familiar with his company’s products.  I figured it was obvious I wasn’t one of the actual conference attendees, standing there in jeans with a laptop bag over my shoulder, so I said, “I have to confess, vascular surgery is just a hobby of mine, I just dabble on the weekends in the garage.”  Blank look. He didn’t get that I was making a joke. “I’m not really a vascular surgeon,” I confessed.  He lit up, “Ah, what’s your main area of practice then?”  I guess it wasn’t that obvious at all.  I said, “I’m not a doctor at all, I’m from the database conference down the hall.”  He huffed back to his circle of friends in suits.

The range of products and needs of the vascular surgeons is amazing.  There are instruments to go inside the vessels, and there are wrappers that go around them.  Some products are fabric, and some are coiled wire. Signs trumpeted the capabilities of one brand of wire mesh over another, allowing 60 degrees of angulation over a 10mm distance, or up to 75 degrees of angulation over a 15mm distance.  Who knew it was so tough to wrap blood vessels in wire?

At another booth, a rep started her spiel and I explained right off that I was from the database conference.  She thought that was the most amazing thing ever, laughing and saying “That’s incredible, I’ve never heard of that!”  I explained “Hey, we’re all geeks, we like science, we like learning.  How could I not?”

She was selling surgical tools, and she explained a little about the various doodads that the doctors put in and around the arteries during surgery, although she was light on tech details. I asked her about the buying process, and who makes the decisions about which tools from which companies get bought by the doctors. Purchasing processes are interesting to me because my company at my day job sells books to school libraries, and how those purchasing decisions have become more centralized over time. She was more eager to talk about the sales process, and explained that it each surgeon decides which tools and appliances he or she will be using during the surgery.

Finally, I talked to a guy who was selling his company’s form of thrombin. I told him right off that I wasn’t going to buy any because I was not a doctor at all, but he was more than happy to give me a crash course in thrombin.  Thrombin is a substance that helps close bleeds in blood vessels, and it’s in our blood normally, but sometimes during surgery the patient’s body needs help.  The two major forms of thrombin are from human blood and bovine blood, but his company sells thrombin from Chinese hamster ovaries, which is better than the other two for some reason I don’t recall.

I asked him about the purchasing decision behind thrombin, and he explained that it’s usually made at a hospital level, but with a lot of hospital-wide debate.  Some doctors only want human thrombin because they want as few potential complications as possible, and others want bovine for other technical reasons.  The doctors also have to coordinate with the hospital pharmacy because they have their lists of concerns, not least of which is dollar cost of the products.  Sounds like the eternal struggles between programmers and sysadmins, no?

I thanked him for his time and left the exhibit room to see…

… a dozen huge bulletin boards showing the research papers that were to be presented at the conference’s sessions.  Large full-color banners, 10’x3′, gave the details of the research, often with large full-color photos of blood and guts and “frank purulence”.  Clearly, when you’re presenting at a medical conference you can’t pull a Schwern and crank out the slides in the hallway the morning of your talk. They were so detailed, I wondered what would actually get presented in the sessions.  Would the doctors just restate what was already on the banners?  I guess I’ll have to crash another conference to find out.

I can’t overstate how important I think it is for us to branch out and learn about more than just the jobs we do every day.  We are all programming for some sort of business, and there is much to be learned from other businesses around us.  Even more, we can learn from other communities as well. For example, at this year’s OSCON, the convention hall also hosted the Sock Summit, a few thousand sock knitters getting together. Ricardo Signes paid a visit and found that they have a similar problem to the open source community: The sock knitter world is almost all female, and they want to attract more men to sock knitting, but the men that do show up often feel alienated.

What other communities and subcultures have you visited? What did you take away from them? Please post your stories in the comments.