HackerTube
HomeLongsLikedHistoryWatch laterCategoriesPlaylistsSettings

Elements of Programming Style - Brian Kernighan

Institute for Advanced StudyCited 3× on HN, 2018-2024
YouTube
138K views · 9 years ago · talk · evergreen

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

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

Software practice, open source & careersC, C++, Rust, Go & systems languages#briankernighan#readablecode#codeclarity#cprogramming#softwarecraft

3 comments from Hacker News

@jodrellblank2024 · in “Go is my hammer, and everything is a nail”

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

CitesView on HN
@undecidabot2020 · in “Ask HN: Best books under 200 pages for developers?”

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] ▶ this video [3] link [4] link

CitesView on HN
@ZephyrP2018 · in “Massacring C Pointers”

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

CitesView on HN
Computer Science - Brian Kernighan on successful language design1:00:06

Computer Science - Brian Kernighan on successful language design

University of Nottingham
332K views • 10 years ago
How I program C2:11:32

How I program C

Eskil Steenberg
1M views • 9 years ago
Modern C and What We Can Learn From It - Luca Sas [ ACCU 2021 ]1:05:59

Modern C and What We Can Learn From It - Luca Sas [ ACCU 2021 ]

ACCU Conference
130K views • 5 years ago
The Forgotten Art of Structured Programming - Kevlin Henney [C++ on Sea 2019]1:29:27

The Forgotten Art of Structured Programming - Kevlin Henney [C++ on Sea 2019]

cpponsea
245K views • 7 years ago
Going Native 2012 Keynote Stroustrup1:29:49

Going Native 2012 Keynote Stroustrup

savage309
33K views • 14 years ago
Ideas about a new programming language for games.1:55:24

Ideas about a new programming language for games.

Jonathan Blow
530K views • 12 years ago
Google I/O 2012 - Meet the Go Team1:00:29

Google I/O 2012 - Meet the Go Team

Google for Developers
108K views • 14 years ago
Brian Kernighan: UNIX, C, AWK, AMPL, and Go Programming | Lex Fridman Podcast #1091:43:10

Brian Kernighan: UNIX, C, AWK, AMPL, and Go Programming | Lex Fridman Podcast #109

Lex Fridman
766K views • 6 years ago
Zig: A programming language designed for robustness, optimality, and clarity –  Andrew Kelley54:14

Zig: A programming language designed for robustness, optimality, and clarity –  Andrew Kelley

Recurse Center
75K views • 8 years ago
Hacking with Andrew and Brad: tip.golang.org1:02:49

Hacking with Andrew and Brad: tip.golang.org

The Go Programming Language
99K views • 11 years ago
The Road to Zig 1.0 - Andrew Kelley59:48

The Road to Zig 1.0 - Andrew Kelley

ChariotSolutions
168K views • 7 years ago
Rust: A Language for the Next 40 Years - Carol Nichols55:08

Rust: A Language for the Next 40 Years - Carol Nichols

ChariotSolutions
367K views • 7 years ago
Stanford Seminar - Concatenative Programming: From Ivory to Metal1:04:45

Stanford Seminar - Concatenative Programming: From Ivory to Metal

Stanford Online
14K views • 8 years ago
GopherCon 2014 Inside the Gophers Studio with Blake Mizerany48:19

GopherCon 2014 Inside the Gophers Studio with Blake Mizerany

Confreaks
8K views • 12 years ago
Lang NEXT 2014 Panel  Systems Programming in 2014 and Beyond1:05:56

Lang NEXT 2014 Panel Systems Programming in 2014 and Beyond

25msr
3K views • 8 years ago
Brian Goetz - Stewardship: the Sobering Parts1:03:31

Brian Goetz - Stewardship: the Sobering Parts

ClojureTV
39K views • 11 years ago
Crockford on JavaScript - Section 8: Programming Style & Your Brain1:06:46

Crockford on JavaScript - Section 8: Programming Style & Your Brain

YUI Library
111K views • 14 years ago
"Liberating the Smalltalk lurking in C and Unix" by Stephen Kell40:56

"Liberating the Smalltalk lurking in C and Unix" by Stephen Kell

Strange Loop Conference
25K views • 12 years ago
C++ Seasoning1:17:12

C++ Seasoning

aghuttun
58K views • 13 years ago
Invited Talk - Guy Steele1:07:22

Invited Talk - Guy Steele

ClojureTV
39K views • 9 years ago