HackerTube.dev

Elements of Programming Style - Brian Kernighan

Institute for Advanced Study · 137.7K views · 2017-07-11 · 1:10:42

Open on YouTube ↗

If playback is restricted in your region, try opening the original video. Use Mark watched to add it to your marked videos.

Overview

Brian Kernighan's 2009 talk at Princeton on the Elements of Programming Style, discussing readable code, avoiding cleverness and flawed examples in programming tutorials.

On Hacker News

HN cites it as the author's own talk on writing clear code, useful as a companion to his book.

Discussed on HN; no positive recommendation is recorded in this export · HN mentions 2018–2024

Topics

Search by tags

What people said

jodrellblank · 2024-08 · Reference

Filtering a container by a predicate is 50 year old technology and a very common thing. It's unbelievable that a "modern" language has no shorter or clearer idiom than that convoluted boilerplate filled Ministry of Silly Walks blob. Python had filter() and then got list comprehensions from Haskell list comprehensions. PowerShell has Where-Object taking from C# LINQ .Where() which takes from SQL's WHERE. Prolog has include/3 which goes back to sublist(Test, Longer, Shorter) and LISP-Machine LISP had sublist in the 1970s[1]. APL has single character / compressing an array from a bitmask result of a Boolean test in the original APL/360 in 1968 and it was described in the book in 1962[2]. Brian Kernighan gave a talk on the readability of code and not getting too clever[3] "Elements of Programming Style" where he talks about languages having one way to write one thing so that you can spot mistakes easily. I am aware he's one of the Go designers and I will mention that again in a moment. In Python the non-list-comprehension version might be: result = [] for x in foo: if "banned" in x: result.append(x) Which is still clearer than the Go, simply by having less going on. I usually argue that "readable" merely means "familiar" and Python is familiar to me and Go isn't. Your Go code makes me wonder: - "var" in C# does type inference. You declare []string but don't declare types for _ x or the tuple _,x what's up with the partial type inference? What is "var" adding to the code over clas

Read the original HN comment ↗
undecidabot · 2020-05 · Reference

Brian Kernighan (the K in K&R and AWK) also wrote a similar book with P. J. Plauger called "The Elements of Programming Style" [1]. There's even a talk by him about it online (2009) [2]. Kernighan also co-authored a (imo) really great book with Rob Pike (once an assistant of Penn & Teller [3]) called "The Practice of Programming" [4]. Unfortunately, this one is a bit over the 200 page limit. [1] [LINK] [2] [VIDEO] [3] [LINK] [4] [LINK]

Read the original HN comment ↗
ZephyrP · 2018-06 · Reference

I always wondered about the C tutorials Brian Kernigan mentions in his talk ( [VIDEO] ) , many of the examples seem intentionally designed to be incorrect by some trickster spirit. Now I know the even darker truth.

Read the original HN comment ↗

Sources

Video by Institute for Advanced Study, played through YouTube.

Data and selection notes

HN summaries and labels may contain AI errors. HN dates refer to discussions, not video publication.

HN Library: HackerTube export (2026-10-31) and open-index/hacker-news. Upstream summaries and classifications may contain AI errors.

Views, duration and playback status refresh separately from the published catalog. When an update fails, existing data remains visible.

Selection checks
  • SaaS & AI candidates: Topic keywords do not match
  • Editor-approved picks: Editorial review is required

Rule matches identify candidates. They do not guarantee video quality or financial results.

About the library and its sources