Skip to content

Instantly share code, notes, and snippets.

@roryokane
Last active October 21, 2015 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roryokane/de104dbf12198e18ee74 to your computer and use it in GitHub Desktop.
Save roryokane/de104dbf12198e18ee74 to your computer and use it in GitHub Desktop.
A summarized transcript of Brian Kernighan’s 2015-10-20 Q&A at Paperless Post

A summarized transcript of Brian Kernighan’s 2015-10-20 Q&A

The Q&A was at Paperless Post on 2015-10-20 from 6 to 8 PM.

Transcribed by Rory O’Kane. Typed on a phone and cleaned up later.

Questions from the moderator

First, some questions from an employee of Paperless Post, starting around 6:35 PM.


Where did “hello, world!” come from?

A cartoon of a chick exiting an egg and saying “hello, world” that he saw in some magazine and that stuck in his head. The first “hello world” was for the B language. Later he did it again for C.


Why is the book K&R C (“The C Programming Language”) so popular?

Not sure; he wishes he knew so he could replicate it. Dennis Ritchie helped a lot: Ritchie wrote a good reference manual section. Another factor is that the book is not very big.


His upcoming Go book is mostly his coauthor’s work, he says. His coauthor does great work.


Why didn’t Plan 9 succeed?

It took a Procrustean view. Forced a particular way to do things. And existing Unix tools didn’t transfer over, so had to be written. Like the standard IO library was totally different.

But it did do well in extending Unix by making everything a file. And it supported Unicode, which may be its biggest contribution to computing.


Are we messing up anything fundamental nowadays? Like using base 2 (binary) when we should be using base 3?

As far as bases specifically go, base 2 is easier and cheaper to build. In fact, the Babbage Engine that Charles Babbage tried to create would have been more likely to work if Babbage had used binary.

Apart from that, of course programming languages have their little mistakes. Grand scale big problems? He doesn’t know of any. Maybe Unicode should have been invented earlier so we wouldn’t deal with encoding problems now.


What is the key to writing software that lasts 100 or 1000 years?

I don’t care if it does. I won’t be around then. :-)

Well, C’s 40-year persistence was a surprise. I guess languages generally last because of the existing programs in them.

The real question might be how do we kill off old programs when something better has come along.


Are programs ever done?

No, not really. Though maybe they should stop earlier than they currently do. C++ went on a long while. Python has two versions in use, and as a non-expert, he doesn’t know how to choose between them.

He has declared his version of awk finished. Gnu awk adds more features, but at least they put them behind flags so it’s compatible by default.


Bell Labs was created to improve the national telephone system. AT&T had a “regulated public monopoly” at the time – about 90% of the market. People just called it “the telephone company”. They were allowed to keep the monopoly as long as they kept prices cheap.

They never told the employees at Bell Labs what to do. They just let them work on whatever, had them write down their accomplishments at the end of each year, and reviewed their list after three or so years. Companies certainly don’t do that nowadays.

Later (1974), the government stopped accepting AT&T’s monopoly and broke it up.


What about promotion to management in a programmer’s career?

He himself was promoted to management. Because of the way Bell Labs worked, he didn’t have to give orders at his company, just help other managers in assessing subordinate’s work from their yearly list.

Stroustrop worked for Kernighan while he created C++.

Kernighan is personally glad he’s not a manager anymore. It’s not for him.


Is C perfect?

Definitely not. Some syntax decisions were wrong, like switch falling through. Specifications for type conversions might be nice, like signed to unsigned. But he doesn’t think adding more features to C is the solution. For example, ISO added complex number support to C, but he doesn’t think that little-used feature is worth the extra complexity in the language.


Do you see a problem with losing touch with the low-level details when using high-level languages?

For many programmers it’s not a problem. But those who call themselves “computer scientists” should know how things work at the low-level too.


Trade schools vs universities.

He doesn’t know much about trade schools or boot camps. He thinks universities should teach knowledge that will still be relevant in a long time. At least 5 or 10 years.


What do you think of a possible mandatory requirement to teach programming in public schools?

Roughly, he thinks it’s a bad idea. It depends on the content. But it’s hard to find good teachers of programming for all the schools. And what useful classes would you give up to make time for this class?


If you didn’t need to follow Princeton protocols, what would you put on your midterms? A coding problem?

Handwriting whole programs on exams, without being able to run it on a computer, is bad. I wouldn’t ask students to do that.

I could give them a problem and ask them to submit a program within 24 hours. That might be all right. But then it wouldn’t be much different from homework.

And also, who would grade it? You can try to automate grading of student programs, but you can’t completely automate it.


Tell us about the history of the term WYSIAYG, which you invented. (What You See Is All You Get)

It means that in WYSIWYG (What You See Is What You Get), you don’t see or store invisible metadata that can sometimes be useful. Like structure given by LaTeX and HTML. “This is a header” and so on.


He mostly uses the Sam editor. It’s part of Plan 9. And he also uses Vi because he grew up using it.


Who here uses Emacs? 5 hands in the audience raised.

Who here uses Vi? About 80% of audience raises hands.

A Vi story:

Bill Joy (the creator of Vi) was in Bell Labs one night, as a grad student. He tried to show off an editor that he wrote to Kernighan. Kernighan said to not waste his time on that and focus on his thesis and graduating from Berkeley. But Bill Joy, like many of Kernighan’s students that he gives advice to, ignored him. Bill eventually founded Sun Microsystems. So don’t take Kernighan’s advice. :-)


Some question about Go (which his book about will be released soon).

He likes Go because it is somewhat like C. He disagrees with some of the syntax. Programming in Go is fun. It’s good for concurrency; goroutines and channels are nice.

He wrote a program that would walk the whole Google source tree and count the number of lines of code in each language. It took long to run because Google ha so much code. When rewritten from Python to Go, which was an easy rewrite, it ran "about a third faster".


What about generics, which are missing from Go?

That’s above his pay grade to comment on.

The official story is that they are complex to add, and the team is waiting to add them until they have a good design. Kernighan hasn’t personally felt the need for generics in his programs. But he has heard that some people do feel the need for them.


Questions from the audience

(7:18pm, about 45 minutes into the talk)


What is similar and different in programming today vs. in the 70s?

It’s still hard to write programs that work properly. Now programs are bigger. Now you spend more time gluing large libraries together. Libraries are large enough that you need IDEs to understand them.


Are you going to add explanation of the “cloud” to your book D is for Digital?

He is actually just starting to work on a second edition of D is for Digital (which is his only book that he wrote without a co-author). He is indeed adding info about the cloud now, and "big data".


How do you feel about the resurgence of functional programming in languages like Scala and Swift?

He’s never been able to get FP in his head, in some sense.

He said something about how something SML-related was linked on Hacker News this morning.

Haskell is too far out for him. He can’t wrap his brain around it.

His simple test program that he writes to learn new languages, which trims long lines of text, took 30 minutes to write in Scala but two weeks to write in Haskell.


Where do you see the future of programming language design going?

There are more languages now than we really need. Lots of minor variations of existing ones. Might be nice to have more consolidation, or understanding of things that really matter. Not sure that such understanding requires creating new languages, or even modifying existing languages.

He can’t keep up with all the new languages. He wouldn’t recognize most of them if you showed him code. Rust, for example, he doesn’t know.


Doug, a coworker at Bell Labs, invented macros. He hired Thompson and Ritchie. He provided expertise and perception of how things could be. And he was a good criticized of Kernighan’s graduate paper. He is mostly unsung.


What do you think about lowering the barriers to programming such as by using the Alice teaching language (which was developed at MIT)?

Lowering the barriers is good. Scratch (another learning language from MIT; visual programming by dragging blocks together) is good for getting kids interested. But it doesn’t scale. Or at least it didn’t when he tried it. There are some features that just aren’t available, and can’t be included as libraries. Like trying to get to the moon by climbing a tree – very nice for the first 20 feet, but then you have no way to continue.


What have we improved at, compared to older times?

Our programming languages are better. They make it easier today what you want. There is always a tradeoff between ease-of-use and efficiency. The option of using features like garbage collection is good.

The Internet makes programming much easier to learn.


While I have been a software developer, I have talked with many CS professors. They often ask me why their students can’t get jobs. Do you see this problem even at Princeton? Any thoughts about it?

He doesn’t see it much with his Princeton students, because of Princeton’s reputation.

Internships can help both sides, the student and the company. But of course, interns compete against interns from more prestigious schools for jobs.

The moderator adds that Paperless Post has job openings.


Agile vs Waterfall?

Waterfall is the wrong way, except possibly of your doing it from a contract.

He doesn’t know much about Agile stuff. It seems mostly like a buzzword that doesn’t mean anything.

Maybe you’re saying that Waterfall is too slow, but Agile moves too fast?

Yeah, maybe like that.


Given the price of a PhD, and the absence of modern places like Bell Labs, if you did it again, would you still have gone to graduate school?

That’s a hard hypothetical to think about.

He went to grad school because it was better than his other options at the time.

Well, Google would be happy to hire you if you have a PhD. But a PhD takes a long time to get – many years.

Do a PhD if you are really interested in something even though it’s a narrow field. Or if you want to teach a a University, since that’s the only way to do it.


How big was the biggest program you ever wrote?

The biggest program he ever wrote was probably less than 10000 lines of C.

The biggest program he ever had to read and understand was troff, which was about 10000 lines of C. All in one file. No backups or source control. Ah, those were the days.


The industry has fashions. How do you perceive the fashions compared to when you worked, when the Internet wasn’t around so trends were slower to spread?

In one of his courses, students can use whatever technology they want to do the assignments. He notes what students use each year, like Angular, but he doesn’t know what will stick. It would be nice to wait and allow new things to gel. Yes, it’s a real issue.


So how do you decide something new is worth using, apart from waiting to see if it sticks?

Short-term acceptance is one factor. Also see what problem the new tool is trying to solve, and see if it’s an important problem. Also see who it came from – more experienced developers are more likely to make things with lasting value, because they know what is out there already and won’t just reimplement it.


What do you think of open source?

It’s a good thing. Most companies couldn’t do what they do without relying on open source.

And it provides a baseline of excellence. Proprietary programs must be at least as good as the free ones.

He does use a proprietary linear programming program, because there is no competitor (open source or not). Replicating that program could take years.


AT&T as a regulated public monopoly created something deeply valuable. Do you think its status as a regulated public monopoly was important?

It was important for Bell Labs at least. Employees could think long term. And you had a stable revenue stream. And it was big and could scale up, and had enough people that not everybody had to produce something all the time – you could work on something that would take a few years.

Nowadays, government labs could be similar, but don’t provide much pressure. They don’t work as hard.

Universities also do, that kind of. But they still have to produce a product now for the sake of the grant, to get funding, instead of just being able to think long-term.


Nowadays, there are patent arms wars. How did that work in Bell Labs?

Bell Labs patented lots of things. Most of them were used for cross-licensing (reciprocal licensing with other companies – you can use my patents if I can use yours). Other patents, Bell Labs was kind of required to license, like the transistor patent. They were required to license it for a minimal fee. And that was good, because it enabled a lot of development of computers.

Patenting of business processes was bad. And he thinks most software shouldn’t be patentable. Hardware and pharmaceutical drugs, yes, but not software.


What topic would you want to speak about for an hour, if you didn’t have to do a Q&A?

Well, the Q&A was my choice – I know I am answering what people are interested in. If not a Q&A, maybe I’d do a non-technical talk to teach people about technology. Like the subject of my general-audience textbook D is for Digital.


What advice would you give a student graduating boot camp soon?

Get as much as you can out of it while you’re still there. After all, it costs a lot of money. Learn stuff and meet people while you’re there.


What do you think of OOP? Is it overused or underused, and are we doing it right?

It depends on the situation. Sometimes, yes, we overuse OOP. Java does. He thinks Go is all right. It looks like OOP but isn’t as into it. Sometimes, when writing a program, you only need a function; you don’t need the function encapsulated in an object. But it depends on the circumstance.


Why did you leave the Daily Princetonian (a column for the Princeton newspaper that he used to write, linked on his website)?

He ran out of time and ideas, and they didn’t invite him back.


Modern equivalents to Bell Labs?

Microsoft Research was. But they fired a lot of their people.

Yahoo research? Not sure.

Intel has a research lab, but it’s really focused on what Intel does.


Did Bell Labs in the east ever have a rivalry with the West coast labs, like Xerox labs?

A little. But it wasn’t overt. They made something similar to awk, but worse. Not much rivalry – they were doing different stuff.

They did good stuff. Like Ethernet. And they were much smaller than Bell Labs.


What do you think about elitism and egos and hot air in the industry?

He doesn’t have enough first-hand experience to talk about it. He just thinks anything that makes workplaces worse is counterproductive.


What do you think of Objective-C and its obsession with compiler optimizations?

He doesn’t work with it much. You do have to worry about memory management, which is probably one of the reasons Apple produced Swift.


At Bell Labs, did you ever work with Claude Shannon?

No, he left before Kernighan got there.

Then how did Shannon’s legacy affect Bell Labs?

Kernighan heard stories, but had no contact with Shannon.

Kernighan did know Dick Hamming, the creator of Hamming error codes.

First day on the job, he invited Kernighan to lunch, saying “I’m Dick mumble”. Kernighan found out his last name later that day when he saw his office door.

Hamming helped Kernighan get into writing documentation, after he looked at Kernighan’s thesis. It probably affected Kernighan’s career a lot.

Bonus Q&A

Some questions I, Rory, asked Kernighan before the talk.


What programs do you write nowadays?

Almost none. Mostly he writes small example programs to show to his classes when teaching. He also wrote a Go source code transformer recently.


How do you approach writing books? Why do you usually coauthor with someone else?

It’s easier to coauthor. Apart from doing less work individually, you get more experts on the subject who can check each other’s work.

He and his coauthor usually split chapters, such as writing alternate chapters. Then they homogenize the writing so the book looks written by one author.


Why did you write your latest book on Go instead of another language?

Go hasn’t had lots of book written about it yet, unlike, say, Python. And he knew his coauthor (a member of the Go team at Google).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment