4 ms·
This book is foundational; all Programmers (especially beginners) should read it. Like all Kernighan's books, the language is simple, concise and precise focusi
by rramadass 2y ago
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! :-)
- mehdix 2y agoCan 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 2y ago> 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 2y agoIn 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.
- munificent 2y ago> This is the smallest and simplest exposition that i know of on how to write a compiler. I haven't read Kernighan and Pike's book but another really small compiler exposition I like is Wirth's PL/0 in "Algorithms + Data Structures = Programs". A little outdated at this point, but still a very pleasant read.
- rramadass 2y agoThanks for the pointer, will take a look at it. I don't believe these things become "outdated" unless you are a bleeding edge practitioner. For most of us "ordinary" Programmers what is needed is breadth over depth and a general idea of what the subject is about so that we are not entirely clueless. Depth will always come when we actually get to work on a project which needs that specific expertise.
- coolbreezetft24 2y agoAs someone who has been programming professionally for 10 years - what would I gain from reading this book? Not to sound snarky but genuinely wondering what makes it a 'must read' for people who are comfortably coasting in their careers
- blandblender 2y agoIf you're at Goog or Meta, you probably have seen best practices around you. If you're working at elsewhere, some things in the book would might be new to you.
- rramadass 2y agoNot being rude but 10 years of experience is dependent on what that experience actually entailed. IIRC Steve McConnell in his book "Code Complete" says "You can have 20 years of experience or 1 year's experience repeated 20 times". The inference should be clear. I have been programming since the early 90's and can assure you there is more knowledge in these sort of books from certain authors than most of the books being published today. The book brings together a lot of aspects to Programming some of which may seem obvious but still have nuances to think about. It also teaches you advanced ways to think about your design (eg. the "Notations" chapter i mention in another comment) where you make your code simpler and elegant by inventing simple DSLs/VMs for parts of your problem. It is this "holistic" view of programming that i think is so essential to understand.
- carterdmorgan 2y agoThanks 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!
- kaycebasques 2y agoJust 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).
- mvdtnz 2y agoIn fact if you disregard the contents and preface, the very first words in The Elements of Programming Style are a quote from The Elements of Style, "It is an old observation that the best writers sometimes disregard the rules of rhetoric. When they do so, however, the reader will usually find in the sentence some compensating merit, attained at the cost of the violation. Unless he is certain of doing as well, he will probably do best to follow the rules." William Strunk and E. B. White, The Elements of Style
- fuzztester 2y agoin poetry, it is called poetic licence. in startups, _ _ _. fill in the blanks. suggestions: disrupting changing the world more efficient productivity cost savings people savings hardware unsavings ...
- amy-petrik-214 2y agoIf we're going all in on the unix lore here, I'd suggest kernnighghan's book "Unix: A Memoir" as an optional add-on. Lots of good lore and history as to "how and why" things work in such a such way. Some commands in there you may not use or maybe heard of but not fully understand, such as grep, why the word grep, why the other types of grep such as egrep. And on the topic of grep, clearly a very popular command early on, so you also get a sense of "what were seen as the core commands commonly used initially" (and whether those may be useful to you today)