return to table of content

Brian Kernighan on “The Practice of Programming” [video]

fuzztester
12 replies
23h44m

I'm only one third of the way through the video, but could see that the podcasters are asking some good insightful questions.

Thanks for sharing, OP.

carterdmorgan
11 replies
23h41m

I just found out we cracked the Top 20 on Hacker News! Crazy! I’m Carter, one of the podcasters from the video. I’m glad you’re enjoying it! It was such a huge honor to talk to Brian Kernighan.

mettamage
5 replies
22h26m

How did you get him on your podcast? That's amazing!

carterdmorgan
2 replies
22h17m

To be totally honest, I just looked up his Princeton email and asked lol. I told him we loved the book and would love to interview him about it. He was like “What? I haven’t thought about that book in 20 years. But I’m sure we could find something to talk about for an hour.” He was so amazingly kind and generous with his time.

He’s not the only author we’ve gotten on the podcast! We’ve already published our episode with Mark Richards on “Fundamentals of Software Architecture” but we also have in the can and ready to go over the next few weeks Neal Ford of “Fundamentals of Software Architecture” and John Ousterhout of “A Philosophy of Software Design.” That’s not public knowledge yet, so consider it an exclusive Hacker News comment section scoop, haha!

We also have some pretty big names we’re in talks with, but I won’t make any promises until the interviews are actually recorded. But we’ve been so thrilled at the author response so far and are super excited about the future of the podcast!

dpb001
1 replies
18h1m

Years ago he was a guest lecturer for a class I was taking from Scott Bradner - as you said, incredibly nice an approachable guy. I could have listened to him for another hour or two.

carterdmorgan
0 replies
17h45m

We would have loved nothing more than to talk to him for hours. He was already calling in from England while on his vacation, so I didn't want to take any more of his time, haha!

mr_toad
1 replies
16h38m

Authors seem to treat podcasts the way celebrities treat talk shows, it’s basically free marketing.

carterdmorgan
0 replies
16h2m

That's been my experience so far, especially because the focus of the podcast is explicitly on the book. It's not, "Hey, come on my podcast to discuss the latest AI development and then maybe plug your book at the end," it's "Hey, come on my podcast solely dedicated to discussing the book you've written." Authors seem pretty eager to participate in that.

jjice
1 replies
23h34m

I hadn't heard of this podcast until just now, but an entire show dedicated to software book sounds like a dream come true! I'm going to download a few of these for the train. I love that you guys are diving into such a niche!

carterdmorgan
0 replies
23h30m

Thanks so much! When we had this idea, I was certain that it had to have been done before because it seemed like such a gap in the market. To my surprise, it didn’t exist! We love the format because not only do we learn a ton, but by focusing on the books we keep the discussions substantive and avoid becoming the millionth “tech news of the week” podcast.

dinkumthinkum
1 replies
20h30m

I found your podcast a few days ago on a different book. Keep it up, I think you have a good niche and doing something you rarely see, which are deep dives on programming books. The only other one I really know of is Connor Hoekstra has a couple nice playlists on SICP and something else but this is a little different, good job.

carterdmorgan
0 replies
20h25m

Thanks for listening! Which book was it that you found?

It’s definitely a breadth over depth kind of podcast, but I don’t think that’s necessarily a bad thing. We wanted it to feel like hearing two coworkers discuss a book over lunch. We don’t provide comprehensive reviews, but rather just highlight what we found the most interesting, while trying to keep it substantive.

fuzztester
0 replies
14h14m

gotcha, and agreed.

bwk is one of my software heroes, along with dmr, bs, lw, gvr, etc.

rramadass
10 replies
13h21m

This book is foundational; all Programmers (especially beginners) should read it. Like all Kernighan's books, the language is simple, concise and precise focusing on the foundations/essentials with no fluff and all in a little over 200 pages. Understand the principles from the examples shown here and then apply them in your own context. The beauty of K&P's books is that they do not overwhelm you with theory but show you the craft/practical applications of it after which a study of the theory becomes more accessible.

To give a concrete example; i had some experience in network programming/protocol implementations before i came across this book. In the "Notations" chapter, they show network message pack/unpack routines written in the style of printf/scanf functions with format strings specifying the packet layout! This was a eye-opening lesson for me in the use of proper notations and little languages. There is also some code snippet examples showing ideas behind Virtual Machines, Code Threading, JIT compilation etc.

Folks should also get Kernighan and Pike's older book "The Unix Programming Environment" to go with this. The chapter "Program Development" gives a complete example of developing a compiler for a small calculator language using compiler development tools (and no theory!) in around 50 pages. This is the smallest and simplest exposition that i know of on how to write a compiler.

In summary; get all of Kernighan's books and study them! :-)

kaycebasques
5 replies
3h28m

Just ordered the true Gang of Four:

* The C Programming Language

* The UNIX Programming Environment

* The Practice of Programming

* The Elements of Programming Style

I've read the C book before and also remember the writing to be excellent. I'm sure I'll pick up lots of programming wisdom but I'm also approaching this as a technical writer, figuring out what exactly makes Kernighan's books so good. I have a hunch that Kernighan has studied writing a lot, or has at least done a lot of "first principles thinking" about writing. The title "The Elements of Programming Style" for example is a reference to one of the most famous books about writing style, "The Elements of Style" by Strunk and White (which everyone should read once; it literally fits easily into your back pocket).

dehrmann
2 replies
3h7m

No idea what your background is, but since you just bought four books, make sure you're spending more time reading and writing code than reading books. Some people fall into the theory trap and don't spend enough time making use of that theory.

carterdmorgan
1 replies
2h39m

Agreed. Reading books is great if it's replacing Twitter and Reddit time. It's not great if it's replacing coding time.

kaycebasques
0 replies
1h28m

I'm also approaching this as a technical writer, figuring out what exactly makes Kernighan's books so good.

I am docs lead for https://pigweed.dev

I will probably also eventually post my findings to https://technicalwriting.dev

rramadass
0 replies
2h9m

To your first three above, add Marc Rochkind's Advanced Unix Programming and Richard Stevens' Advanced Programming in the Unix Environment and you have got yourself a complete course in C/Unix programming which is the bedrock for everything else; C is the "lingua franca" and Unix (via its variants) the "standard" OS.

Tip: Many of these old books can be had for cheap as used copies on Amazon/Betterworldbooks etc.

carterdmorgan
0 replies
3h22m

One of the great things about The Practice of Programming is how much it references other non-coding works. You can tell Kernighan draws his knowledge from many sources, not just technical ones.

mehdix
2 replies
8h24m

Can only second you. His style is by far my most favorite among all other technical authors. And thanks for the reminder, time to get another one of his books.

rramadass
1 replies
5h16m

His style is by far my most favorite among all other technical authors.

All authors should learn from Kernighan's books (co-authored with Plaugher/Ritchie/Pike) on how to write technical books. 90% of all the computer programming books published nowadays are too verbose (why the hell are they so huge?), meandering over inessentials, lack of clarity in language, a paucity of clear and precise examples and overall just a waste of paper. Reading them is more of a chore then enlightening whereas all of Kernighan's books are only a little over 200 pages, dense with knowledge and a pleasure to read.

Arisaka1
0 replies
4h47m

In discussions with colleagues they blamed the absurd demands of the publishers in terms of hitting specific volumes (in pages), which oddly reminds some past relationships I had with management and sales departments as a developer.

carterdmorgan
0 replies
12h2m

Thanks for the heads up on "The Unix Programming Environment!" I've been searching for a book with a concise explanation on how to write a compiler, and you can't go wrong with one from Kernighan!

opello
9 replies
18h55m

A nice value in this format (since it discusses books) would be to have a comment or portion of the description dedicated to listing the books (or ideally the media) discussed to a list.

I added "The Bit Player" (Claude Shannon documentary from 2018) to my watch list as well as "Recoding America," "Chip War," and "Endurance: Shackleton's Incredible Voyage" to my reading list.

carterdmorgan
8 replies
18h52m

What do you mean by this exactly? Like a list of all upcoming books we’ll discuss? If you’re curious, you can find that on our website at www.bookoverflow.io!

farleykr
6 replies
18h21m

I think they mean that the description of the episode should have a list of books (and maybe other resources) that were mentioned in the episode itself.

carterdmorgan
4 replies
18h19m

Oh yeah, that’s a good idea. We’ll have to do that. We’ve been debating setting up Amazon affiliate links to the books in the episode descriptions. We were going to wait until we were a little bigger, but after today we might have to speed up those conversations, haha.

opello
3 replies
18h10m

I can appreciate supporting the effort, but the "stickiness" of Amazon affiliate links seem pretty pernicious. I briefly tried to find a source for this and failed, but my understanding is that the affiliate can see any product purchased while the affiliation through the link is active, which is something like a 24 hour timeout or another link for a different affiliate is used. Maybe my perspective is out of date, if so my apologies, but that seems like a net negative contribution to personal privacy of viewers.

Edit: This video humorously discusses the "leakage" I think of as bad: https://www.youtube.com/watch?v=M2PYgjgDdWg

carterdmorgan
2 replies
18h4m

Yeah, definitely not my area of expertise. We’ll need to explore it further and make sure there’s nothing sketchy before making a decision.

lokar
1 replies
16h6m

You can always provide two versions of each link (affiliate/direct)

carterdmorgan
0 replies
14h17m

Good idea. Now that I think of it, I've seen other creators do something similar.

opello
0 replies
18h15m

This exactly, yes, thank you. Sorry for being vague.

opello
0 replies
18h8m

Sorry, I didn't mean upcoming books, just the media discussed in the episode. Like the ones I mentioned adding to my watch/reading lists. It would have made finding them a little easier is all and could serve as value to the description since it's certainly the case that they were discussed in the video! :)

JetSetIlly
6 replies
21h11m

I love the Practice of Programming. Of all the books on programming that I've read, the lessons of that book are the ones that remain strongest in my mind. I've not read it in many years but I feel it influences my practice everyday.

carterdmorgan
5 replies
21h6m

It was the first time I’ve ever read it and I was surprised how much of it still held true given it’s 25 years old. Some of the specific programming examples are pretty outdated, but the general ideas are as solid as ever!

bigdict
4 replies
14h17m

Curious what examples you felt were outdated.

carterdmorgan
3 replies
13h44m

They mention at one point that Java doesn't have a way to pass a function as a parameter to another function. That was added in Java 8 with lambdas. That's just one off the top of my head.

dehrmann
1 replies
3h6m

Nit: it's still right. Lambdas are just functor sugar.

marcosdumay
0 replies
1h32m

The only mainstream languages where you can actually pass function references around, without them being sugar for some complex object that the compiler creates are C, C++ and Rust. And it's not trivial to do in Rust.

bigdict
0 replies
12h48m

Ah ok thanks.

zombiwoof
5 replies
20h50m

I wish interviewing now was more about knowing the concepts in that book versus leetcode

Brian Kernighan prob couldn’t pass a leetcode hard interview in this ridiculous new world

carterdmorgan
4 replies
20h45m

My last interview cycle I interviewed with some big names (Stripe, Square, Shopify, etc.) and was pleased that none of them asked any LeetCode style questions. All pretty practical programming stuff. Stripe had an interview where they had forked the Jackson Java library, introduced a bug, and then asked me to find and fix it. Pretty unique style, but much more applicable to the actual job of programming.

goosejuice
2 replies
17h50m

That's a clever interview question, but wouldn't that suffer from diffing origin/main? Or was this a in person / on screen interview with no git history?

surbas
0 replies
16h58m

I would say that I would hire that person if that was the solution. That said maybe repo wasn’t included in interview. (Would be even better if person figure out how to diff against a new clone)

carterdmorgan
0 replies
16h40m

It was an on-screen virtual interview, so while I believe they had scrubbed the Git history, you weren't allowed to look it up.

HumblyTossed
0 replies
3h34m

Stripe had an interview where they had forked the Jackson Java library, introduced a bug, and then asked me to find and fix it.

I think I would actually enjoy an interview like that.

commandersaki
5 replies
17h38m

Love Kernighan, such a humble person. In one of the videos that he was featured on in youtube, he spoke about how he was solving a difficult problem in his thesis which turned out to be NP-complete before the theory had been fleshed out. Emailed him for his thesis and got a pretty quick response, was a really interesting read.

carterdmorgan
2 replies
16h30m

It's a rare combination to find someone both as intelligent and humble as he is. Truly a blessing to our industry.

kaba0
1 replies
13h40m

I believe you are right as intelligent grows, but the very top end usually has people excelling in many things and personality as well. At least that’s what I noticed.

carterdmorgan
0 replies
13h25m

Certainly successful intelligent people often excel in personalities. Hard to get places without playing nice with others to a degree.

dgb23
0 replies
7h5m

Love Kernighan, such a humble person.

A perfect example: Just about 3-4mins into the interview he said that the motivation behind the book was "kind of pretentious".

To me, and many others, his opinions on programming are amongst the most interesting and useful. In large parts because he can convey them so clearly.

256_
5 replies
18h18m

I read the Elements of Programming Style and the Practice of Programming around the same time and they became completely mixed up in my mind. I'll often remember something from one of those books but be completely unable to remember which one it was from.

Both good books, and both were co-authored by Kernighan. I think they complement each other well.

carterdmorgan
3 replies
18h12m

We might have to add Elements of Programming Style to our backlog.

256_
2 replies
17h59m

Well if you're interested, the Elements of Programming Style, to me, was interesting for two reasons. It presents plenty of timeless insights about programming, but it's also very interesting as a historical document; it argues against old-fashioned GOTO-based programming in favour of structured programming, and for-loops executing 0 times, for example.

It has a list of rules of thumb at the end, which contains my favourite part of the book. Pretty much all of them are timeless, but right in the middle is "Avoid the FORTRAN arithmetic if."

The one big thing I disagree with it on is the weird idea that you should never have 2 IFs in a row.

mkehrt
0 replies
1h11m

Because I was curious: https://en.wikipedia.org/wiki/Arithmetic_IF

It's a three way if statement that scrutinizes a number rather than a boolean, with branches for negative, zero and positive values.

carterdmorgan
0 replies
17h36m

Sounds interesting! We're trying to figure out if we should be focusing on more modern books even if they're "unproven" or classics even if they're outdated. Sometimes reading the classics can be a lot of fun because, like you said, they serve as historical documents. As someone who started their career a lot later, it's crazy to me that GOTO used to be in style, but I suppose for it to fall out of style there had to be a book arguing against it at some point. It'd be interesting to read the original arguments!

richrichie
0 replies
14h19m

There is a talk he gave at IAS on this. Pretty good one. I think it is available on You Tube.

rramadass
1 replies
9h27m

Also his earlier slim Writing Efficient Programs book. What this teaches you is how to think about efficiency from the top down with an emphasis on Algorithm and Language and hence useful to all programmers. Pair it with modern books on efficiency which deal mainly with compiler-level/OS-level/Processor-level performance techniques by Agner Fog, Fedor Pikus etc. and you get a complete picture.

fuzztester
0 replies
5h55m

Also his earlier slim Writing Efficient Programs book.

Yes, that's a really good one. I own a copy of it, bought years ago, and have read it pretty much cover to cover. Have also applied the guidelines in it, some.

carterdmorgan
1 replies
12h3m

Added to the backlog! As our audience grows, we've debated doing live backlog grooming on YouTube so that listeners have a chance to chime in and voice their opinions on what we should read.

fuzztester
0 replies
9h58m

I think that's a good idea.

xyzzy_plugh
3 replies
15h54m

The "g" is silent, folks.

You should try to get Rob Pike on. He'd probably make it a point to correct your pronunciation. I can hear him now...

carterdmorgan
2 replies
15h46m

Yeah, someone on YouTube pointed out the same thing. D'oh. I wish Brian would have corrected us!

We'd love to get Rob Pike on too! Currently working on it, although he's a little harder to get a hold of.

nmz
1 replies
13h46m

You should ask the arraycast guys on how they did it. They got him to talk about ivy and apl/array style programming for an hour or so.

mseepgood
0 replies
12h41m

He's active on Bluesky and Mastodon.

fuzztester
3 replies
12h14m

I suggest you add Software Tools in Pascal to your list of books to podcast about. Also by Kernighan.

I own a copy of that book and think it is good.

AnimalMuppet
1 replies
5h45m

You might get more than you bargained for on that topic.

Kernighan and Plaugher had written "Software Tools" in RATFOR. Then they wrote "Software Tools in Pascal". And then, in direct response to the experience of writing that, Kernighan wrote a paper titled "Why Pascal Is Not My Favorite Programming Language". (Because writing in Pascal should have been way easier than writing in RATFOR, and it wasn't, and Kernighan gave some thought to why it wasn't.)

It's still an interesting read. You can find it online, for example at https://www.cs.virginia.edu/~evans/cs655/readings/bwk-on-pas...

Note well: This refers to the original standard version of the language. Extensions like Turbo Pascal fixed many of the problems. (Except that, as he said, there was no portability between the extensions. Even that kind of was fixed by Turbo Pascal becoming the "standard" extensions.)

pjmorris
0 replies
57m

Finding 'Software Tools in Pascal' in my local mall bookstore, before I even had access to a computer running Pascal, turned out to be a kind of cheat code for my career. I marveled at the ideas and the writing and it set me up to acquire much of the the rest of the Kernighan canon.

fuzztester
2 replies
5h52m

Kernighan is also a co-author of The Go Programming Language book, at least of the 1st edition.

voidUpdate
1 replies
4h45m

Is that why Go forces K&R brackets instead of letting you choose?

bxparks
0 replies
2h57m

Maybe you already know this and your comment was in jest, but the real reason is that the Go lexer automatically inserts semicolons (https://go.dev/doc/effective_go#semicolons) using heuristic rules which forces the opening brace to be on the same line.