Settings

Theme

Ask HN: What is the best programming book you've read?

63 points by cylde_frog 4 years ago · 55 comments · 1 min read

Reader

Whole language is an approach to, or attitude toward learning that sees language as a whole entity, and writing, speaking, reading, and listening should be integrated when learned.

crossroadsguy 4 years ago

K&R. It was the best programming book I read. I have not read many other programming books to be honest. I couldn't finish most rather.

It's been years since I even touched C and at this point I am not going back, I know; but as an Android dev I wish I could find a non-lengthy book like K&R that would expose me to Kotlin like I was exposed to C, while helping unlearn a lot of Java.

  • znpy 4 years ago

    I read that book, more than once.

    I didn't enjoy that much as a teaching device, but I had the chance to greatly appreciate its timeless writing style.

    It's as good today as a book about the C language as it was when it was first published.

  • bluepoint 4 years ago

    I was also my first book and I read it carefully and multiple times when I was young. The thing is that this is quite possible with this book and it gives you a feeling of achievement. Most programming books nowadays are 2000 page monstrosities which are never meant to be read as whole.

  • dcchambers 4 years ago

    It's kind of a shame that C has fallen out of favor as a language for new programmers these days. I still haven't found another programming book as good as K&R and its hard to convince people to read a book for a laungage they probably won't use.

    • Someone1234 4 years ago

      > It's kind of a shame that C has fallen out of favor as a language for new programmers these days.

      I really like C, but I also disagree with that sentiment. C/C++ should be used as minimally as possible. New projects should use something secure by default in 2021 unless they have a specific articulable need (i.e. not "I like C more" or "I don't know [alternative]").

      C/C++ usage should fall into three categories:

      - New OS and System Utilities (in particular for hardware with no other language support).

      - Existing projects written in C/C++.

      - Areas where all the resources and support are only currently in C/C++ (e.g. game development).

      I'm glad fewer new developers are getting into C/C++. That will increase the costs and make companies less likely to pick it unless they absolutely must.

  • yumraj 4 years ago

    I agree.

    About 20 years ago C# was the second language that I'd learnt after C/C++ and remember just picking the C# language spec and learning from it rather than any of the books at that time since all the books were so wordy/verbose that it just didn't make sense. Especially having learnt C from K&R.

    I haven't looked lately at other language specs, and don't remember others, but at that time the C# language spec was very well written.

furstenheim 4 years ago

Effective Java by Joshua Bloch is really good. Some of the learnings only apply to Java, but most apply to any language.

All the tips are very focused on how the code, APIs and even the languages evolve, trying to understand how your changes could confuse other developers. Compared to clean code, it's clear that it's written by someone who has done a lot of coding and seen the evolution, with a very pragmatic approach. Not just theoretical like Clean Code

khaledh 4 years ago

There's no single book that I would recommend. What worked for me is to read the history of programming languages (and operating systems, to better understand the relationship between them).

My recommendation is to read the original papers/manuals (bitsavers and ACM/Sci-Hub are my main resources). Starting with how computers were programmed befor high level languages were developed (i.e. machine code and assembly), then going through the early languages: Fortran, Lisp, COBOL, Algol; and understand why they were developed and the main ideas in those languages. Lisp had a huge influence on later generations of functional programming languages; Algol (first developed in 1958) is the granddaddy of all what we call today C-like languages, including CPL, BCPL, B, C, Pascal, C++, Java, C#, etc. Simula (developed in the early 60s) is the granddaddy of most object-oriented languages, including Smalltalk, C++ and their descendants.

Many ideas that are core to modern programming languages were developed in those early formative years (late 50s, 60s, and 70s); e.g. lexical scoping, dynamic dispatch, coroutines, garbage collection, encapsulation, virtual machine bytecode, metaprogramming, and many others.

I find it fascinating to read this early literature and understand why and how those ideas (that still live to this day) were formed.

allenleee 4 years ago

1. SICP

2. How to Design Programs

3. Software Design for Flexibility: How to Avoid Programming Yourself Into a Corner

  • cauliflower99 4 years ago

    SICP is a fantastic and difficult book. I got through about 50% and have a much bigger appreciation for programming now.

    FYI - The original was written in Scheme. There is a newer version based in python which I haven't tried.

    Edit: The python version is highly contested. Scheme is the more difficult and therefore the best way to understand these principles.

qorrect 4 years ago

Not sure this one counts but it's one of the best books ever:

Code by Charles Petzold - https://www.goodreads.com/en/book/show/44882.Code .

Others would be:

Neural Smithing ( its now obsolete but was great at the time ) https://www.goodreads.com/book/show/1153223.Neural_Smithing

The Pragmatic Programmer https://www.goodreads.com/en/book/show/4099.The_Pragmatic_Pr...

The Effective series by Scott Myers https://www.goodreads.com/series/160060-effective-c

peakaboo 4 years ago

If anyone has a good book about writing as simple programs as possible instead of as flexible as possible, I would appriciate it.

Because the problem today is complexity and abstractions. It prevents us from changing code easily, deleting code easily, and understanding the full program flow easily.

  • atsaloli 4 years ago

    Sounds like "Understanding Software" by Max Kanat-Alexander.

    https://www.amazon.com/Understanding-Software-Kanat-Alexande...

  • sethammons 4 years ago

    Totally agree. Premature abstraction is just another way to say premature optimization and it is the root of so many problems. YAGNI (you aint gonna need it).

    • gompertz 4 years ago

      If that's what your looking for, I find books that are adopted as university textbooks are best. i.e. C Programming Modern Approach by KN King, Object Pascal Handbook by Marco Cantu. Generally I'm staying away from O'Reilly, No Starch Press etc.. They all feel like books created by pasting a bunch of blog posts together. University texts are usually twice the price, but IMHO worth it - they are made for teaching knowledge, not just sharing it.

      • the_only_law 4 years ago

        > University texts are usually twice the price

        Yeah I find these are normally the books I want now, but it doesn’t take that many to suddenly turn my cart into $1k.

cratermoon 4 years ago

Refactoring: Improving the Design of Existing Code

For helping realize that in all the books telling me how to write good code, explaining language constructs, and working as a software developer, none of them ever made it clear to me that programmers spend less than half their time writing new code from scratch. For showing me that programming involves revising and improving far more than opening up an editor to a new file in an empty repo.

twodayrice 4 years ago

Unix network programming. Stevens brought sockets to the masses and helped launch the internet as we know it.

xupybd 4 years ago

Domain driven design made functional. It takes the weird world of functional programming and shows how it can be applied to building run of the mill business apps. Instead of being an app that only functional programmers can understand these apps, at least some of the domain modeling can be understood by stakeholders.

  • tacotacotaco 4 years ago

    This sounds like "Domain Modelling Made Functional" by Scott Wlaschin, maybe? It walks through the software development process of automating a small business starting with requirements gathering, a valuable step that is often overlooked in programming books. It uses F# but I think anyone familiar with a typed language should be fine, and the info can be applied to any functional language. It uses the type system to great effect to enforce business requirements. I've recommended this book to at least five colleagues in the past year. Very good!

rajandatta 4 years ago

'Object Oriented Software Construction' - Bertrand Meyer.

Did not agree with everything but it was excellent.

dunefox 4 years ago

For me it's boring old SICP. It's just that good.

chris_j 4 years ago

Growing Object Oriented Software, Guided by Tests by Steve Freeman and Natt Pryce. It taught me an awful lot of lessons about object oriented design and London-school TDD. It was published back in 2009 and things have moved on a bit since then but it's still worth reading if you want to understand that style of development. Reading this book changed the way that I write software, very much for the better.

mkchoi212 4 years ago

The Little Schemer is my favorite by far! So easy to understand and follow. Definitely a must read if you want to get into functional programming

  • laerus 4 years ago

    All books in this series is of high quality and very enjoyable. I am going through Little Typer at this time.

adrianvincent 4 years ago

'You Don't Know JS' by Kyle Simpson. A series of books that are a must read for any JavaScript developer. They are available for free on GitHub or you can purchase a retail version. He's working on a second edition right now.

https://github.com/getify/You-Dont-Know-JS

yesenadam 4 years ago

The AWK Programming Language (1988)

https://archive.org/details/pdfy-MgN0H1joIoDVoIC7

Best as in best written, along with K&R—Brian Kernighan co-authoring both can't be an accident!—it's just a pleasure to read. I use it as a model when writing documentation myself. They get you started using AWK literally on page 1. Later they get into the details of particular use cases—profiling, making DSL interpreters/compilers, random text generation, making indexes, a graph-drawing language, databases, data validation etc etc. All in under 200 pages!

And best as in most useful—I use AWK every day for all kinds of things–web scraping, rearranging and creating data for programs, meta-programming etc. So easy to make whatever tool's needed for a job.

  • gpa 4 years ago

    You say you are using AWK on a daily basis, including web scraping. Most programmers use Python libraries Scrapy and BeautifulSoup, and R libraries like rvest and RCurl. How do you parse HTML with AWK - as part of a pipeline including wget, hxselect, and lynx, or just by using the AWK regular expressions? I couldn't find many examples, except for some basic Rosetta code script and random blog posts. Can you share some example script?

dilippkumar 4 years ago

I’m currently enjoying “From Mathematics to Generic Programming” by Alexander Stepanov and Daniel E. Rose.

One thing about the book is that it’s a lot more interesting than what a cursory scan of the table of contents would suggest. An O(log n) algorithm for multiplication doesn’t seem interesting at first. But the authors do an amazing job of starting from familiar ideas and building up to surprisingly beautiful and elegant ideas.

I think I’m finally able to grok c++ templates half way through this book.

One unfortunate downside to this book is that the authors wrote this before concepts were introduced in c++20. I would love to see an updated edition of this book that use the real c++20 concepts. However, this doesn’t diminish my recommendation for this book.

  • dunefox 4 years ago

    Sounds interesting. I know no C++, can I still enjoy the book? I have no interest in learning it.

    • dilippkumar 4 years ago

      I don't know the answer - This is primarily a book about generic programming using C++ templates.

      I suppose you can learn about the power of generic programming and apply it to another language. There is probably some non-zero amount of things that you can pick up from this book that you can apply elsewhere. However, I don't know if that is enough to justify going through this book. Your milage might vary.

  • amusedcyclist 4 years ago

    What do you mean by an O(log(n)) algorithm for multiplication ? The naive approach takes O(n^2) and O(nlog(n)) is extremely state of the art and is unlikely to be in a programming book

    • Jtsummers 4 years ago

      See page 17 of [0]. Here the big-O is about the value of one of the parameters to multiply(n,m) (say the first), not the number of bits in the values. In the naive multiplication algorithm you have repeated addition which gives you a O(n) algorithm, but you can also do the half & double approach (similar to fast exponentiation) which gives you a O(log n) algorithm.

      [0] https://www.fm2gp.com/slides/FM2GP_Course_Slides_Pt1.pdf

zzo38computer 4 years ago

I like "The Art of Computer Programming". It uses assembly language, which is one thing I like compared with other books, but there are other things I also like about this book compared with other ones too, I think it is better written.

markus_zhang 4 years ago

Game programming patterns, Game scripting mastery

icey 4 years ago

Programming Scala is one of the best programming books I’ve ever read. Scala never stuck with me, but I’ve gone through the book a couple of times because it’s so well written and enjoyable to read.

neoncontrails 4 years ago

Bitwise: A Life in Code, by David Auerbach.

Among its memorable conceits: debugging as a life-improvement strategy, the weirdly mesmerizing properties of randomness, adversarial cat-and-mouse games that have transpired as a result of dueling software programs. He's a gifted writer and one of the few to consider programming as somewhat spiritually connected to the question of what it means to be a human. (In addition to his literary credentials, the writer is a former technical lead at Microsoft and Google.)

wly_cdgr 4 years ago

Bjarne Stroustrup's Programming - Principles and Practice Using C++. Unparalleled combination of real-world pragmatism and rigor. Plus, since you learn C++, this book prepares you better than most for more advanced books/courses on compilers, operating systems, computer architecture

Hon. mentions: HtDP and accompanying Simple Data and Complex Data courses on edX; Part I of Sedgewick & Wayne's Computer Science book and accompanying booksite and free Coursera course

ToFab123 4 years ago

"Code Complete" by Steve McConnell https://en.wikipedia.org/wiki/Code_Complete

For many years we gave this book to all new employees on day #1. Even the most experienced developers will find something in this book they will find very useful and it will help you to take a step back and evaluate your programming. This book is true gold mine.

mkchoi212 4 years ago

The Little Schemer is my favorite by far! so easy to understand and follow. Definitely a must read if you want to get into functional programming

dperalta 4 years ago

I just started with: The Humble Programmer by Edsger W. Dijkstra and I'm lovin' it (not a book but a 15 pages essay).

edrx 4 years ago

"The Icon Programming Language". https://www2.cs.arizona.edu/icon/ftp/doc/lb1up.pdf

macando 4 years ago

Most influential - Clean Code and The Joy of C (the first programming book I've read)

Most informative - Effective Java

Funniest - Learn You a Haskell for Great Good!

Best written - Eloquent Ruby

Most useful - Data Modeling Essentials

coder4life 4 years ago

"Enough rope to shoot yourself in the foot - rules for C and C++ programmers" by Alan C Holub.

And "Compiler design in C", also by him

heluser 4 years ago

- Low level: Code Complete 2 (yes it’s old but still very relevant) - Hight level: Designing data intensive applications

m3talsmith 4 years ago

1. Why’s Poignant Guide to Ruby

2. Practical Common Lisp

3. A Programmer’s Introduction to Mathematics

4. Data Structures and Programming Design in C

5. The Art of Agent Oriented Modeling

baash05 4 years ago

"Clean code" is a top contender.

karmakaze 4 years ago

There are many great ones listed here, but I wouldn't give any single book more credit than how they combine in practice, as the question sort of implies.

The best lessons I've learned is how to balance all these good ideas for each problem, idea, implementation. How do do OO without lots of racy mutable state, using immutability efficiently, composing pure functions, identifying what to abstract explicitly vs allowing something to permeate, intention and priority when separating factors/aspects, good naming patterns and when to use which. I don't know of a book that tells you how to find balance.

  • r-w 4 years ago

    Hm. Maybe that's because the concerns must be balanced differently for different applications?

    • karmakaze 4 years ago

      That actually makes sense to me now. It's about knowing what matters when. Code smells is sort of there, but people tend to get dogmatic when invoking them. It's about having a sense of when something is 'too much', or there ought to be a way do to it with less of something, etc. Or conversely recognizing that 'this', however rough-seeming, is about as good as it's going to get, without a genius showing up with a brand new idea.

nandkunal 4 years ago

The Pragmatic Programmer

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection