C Programming Language | Brian Kernighan and Lex Fridman
G1-wse8nsxY • 2020-07-19
Transcript preview
Open
Kind: captions Language: en so what's to use you wrote a book c programming language what and c is probably one of the most important languages in the history of programming languages if if you kind of look at impact what do you think is the most elegant or powerful part of c why did it survive why did it have such a long lasting impact i think it found a sweet spot that in of expressiveness so you could really write things in a pretty natural way and efficiency which was particularly important when computers were not nearly as powerful as they are today you can put yourself back 50 years almost in terms of what computers could do and that's you know roughly four or five generations decades of moore's law right um so expressiveness and efficiency and i don't know perhaps the environment that it came with as well which was unix so it meant if you wrote a program it could be used on all those computers that ran unix and that was all of those computers because they were all written in c and that was unix the operating system itself was portable as were all the tools so it all worked together again in one of these things where things fed on each other in a positive cycle what did it take to write sort of a definitive book probably definitive a book on all of program like it's more definitive to a particular language than any other book on any other language and did two really powerful things which is popularized the language at least from my perspective maybe you can correct me and second is created a standard of how you know the the how this language is supposed to be used and applied so what did it take did you have those kinds of ambitions in mind when we're working on that this is some kind of joke no of course not um so it's an accident it's an accident of uh of timing skill and just luck a lot of it is it clearly uh timing was good now dennis and i wrote the book in 1977 yeah right um and at that point unix was starting to spread i don't know how many there were but it would be dozens to hundreds of unix systems um and c was also available on other kinds of computers that had nothing to do with unix and so the language had some potential um and there were no other books on c and bell labs was really the only source for it and dennis of course was authoritative because it was his language and he had written the uh reference manual which is a marvelous example of how to write a reference manual really really very very well done so i twisted his arm until he agreed to write a book and then we wrote a book and the virtue or advantage at least i guess of going first is that then other people have to follow you if they're going to do anything and i think it worked well because dennis was a superb writer i mean he really really did and that the reference manual in that book is his period i had nothing to do with that at all um so just crystal clear prose and very very well expressed um and then he and i i wrote most of the expository material and then he and i sort of did the usual ping-ponging back and forth you know refining it but i spent a lot of time trying to find examples that would sort of hang together and that would tell people what they might need to know at about the right time that they should be thinking about needing it and i'm not sure it completely succeeded but it mostly worked out fairly well what do you think is the power of example i mean you're you're the creator at least one of the first people to do the hello world program which is like the example if if aliens discover our civilization hundreds of years from now it'll probably be hello world programs just to have broken robot communicating with them with the hello world so what and that's a representative example so what what do you find powerful about examples i think a good example will tell you how to do something and it will be representative of you might not want to do exactly that but you will want to do something that's at least in that same general vein and so a lot of the examples in the c book were picked for these very very simple straightforward text processing problems that were typical of unix i want to read input and write it out again there's a copy command i want to read input and do something to it and write it out again there's a grab and so that kind of find things that are representative of what people want to do and spell those out so that they can then take those and see the the core parts and modify them to their taste and i think that a lot of programming books that i i don't look at programming books a tremendous amount these days but when i do a lot of don't do that they don't give you examples that are both realistic and something you might want to do some of them are pure syntax here's how you add three numbers well come on i could figure that out tell me how i would get those three numbers into the computer and how we would do something useful with them and then how i put them back out again neatly formatted and especially if you follow that example there is something magical of doing something that feels useful yeah right and i think it's the attempt and it's absolutely not perfect uh but the attempt in all cases was to get something that was going to be either directly useful or would be very representative of useful things that a programmer might want to do but within that vein of fundamentally text processing reading text doing something writing text you
Resume
Categories