Ask HN: What language-agnostic programming books should I read?

927 points by robschia ↗ HN
Until now I've read:

- The Healthy Programmer

- Clean Code

- Test-Driven Development by Example

What should I add to my library?

343 comments

[ 3.9 ms ] story [ 167 ms ] thread
Effective Java (lots of good generic OOP advice)

Implementing Domain Driven Design

Although I liked Effective Java a lot, and it does contain a lot of advice relevant to many OO languages - it is the opposite of language agnostic: It's very Java-specific. Much of the content is irrelevant except in Java itself; and some of it is the opposite of "Effective language X". For example, it has a section named "Prefer lists to Arrays"; any C++ programmer will tell you the opposite (and that goes down to some of the arguments, such as Java not supporting generic arrays while C++ supports them).

So - good book, but not for this purpose.

Yeah some chapters were useless for me, but I still took away a lot from that book as a PHP developer.
I haven't read the book, but I guess part of the argument is because ArrayList in Java is backed by an array, and is what is usually called a "vector" in other languages, while the generic List interface is what you would call a "sequence" elsewhere.
But it also tells you why to prefer x over y, every time it gives any recommendations. And it's always explained well. So I think reading this book will help you make conscious decisions while using other languages. It's just a very well written book.. Which is pretty rare..
Of course a lot of it is Java-specific, but there's enough advice that seems relevant to $BOG_STD_OO_LANG that it's probably worthwhile for this purpose.
I really like:

- Code Complete by Steve McConnell

- The Effective Engineer by Edmond Lau

- The Pragmatic Programmer by Andrew Hunt and David Thomas

Second the Pragmatic Programmer, however: I read it when I just started programming (like not much more experienced than basic hello world and some fiddling) and, looking back, didn't really get it. I mean, I got the principles, but couldn't apply it as there was just not enough experience for the higher level abstract stuff. I recently read it again and it makes complete sense now, but I ddn't learn much new from it. So I'd suggest that if you read it, do so after a couple of years of programming.
Indeed, the Pragmatic Programmer book's subtitle is "from Journeyman to Master", and that's exactly what journeyman is supposed to mean - someone who's a few years into it, not bad, but not great (yet?).
Yes to Code Complete. I read the first edition at a time I wasn't sure if I'd pursue a career in computer programming. I hadn't used a computer for nearly a month making that decision. After reading and re-reading that book during that time, I pursued programming with a passion. That book struck all the right chords with me.
I read the second edition of Code Complete when I started my first job. Very good book to transition from fresh grad to professional. It has some very dry sections (eg. a chapter on how to name variables) but these are the little things that make a big difference and allows you to 'level up' as an engineer.
> - Code Complete by Steve McConnell

It has good parts. But it has some very bad parts too, when it reinforces myths that, IMO, are very wrong (e.g.: cone of uncertainty, X times better programmer, etc).

I'd recommend to read it with care.

> - The Pragmatic Programmer by Andrew Hunt and David Thomas

After many years I still read parts of it, again and again. And I still like it.

I really liked The Effective Engineer because it had more systems thinking behind rather just how to manage a code project.

It covers some really foundational concepts like idempotency which programmers don't often think about when architecting systems.

Structure and Interpretation of Computer Programs.

I have attempted some of the problems in Lua, Python, Erlang and Ada. It is very doable. So not just for Scheme.

Agreed. Scheme itself is "not much of s language." It's like a language-agnostic language.
Code: The Hidden Language of Computer Hardware and Software by Charles Petzold. I love this book.
Very good. A good book to go with it is: Learning Computer Architecture with the Raspberry Pi.
This looks amazing(and affordable). I had not heard of this. Thanks for sharing!
No problem. It is surprisingly advanced too and was co-authored by Eben Upton who started the Raspberry Pi. Nice whirlwind tour of computing architecture and history.
Thanks for this one. A must read for me.
I loved this book, a must read for any dev
Seconded. I'm one of those savages who didn't really find much value in classical tomes like MMM or Code Complete (probably because all their core points have already been distilled into contemporary best practices) - but I love this book, and even recommend it to non-technical friends & family.
This is an amazing book. Hard to describe, and maybe not even all that interesting sounding if you managed to describe it accurately, it’s actually fascinating.

If you don’t know much about hardware (and maybe even if you do) it’ll change the way you think about computing devices.

You hear people say "Computers are all just 0's and 1's", which when you sit down at a modern computer interface is virtually meaningless. In an accurate, but still comprehensible way, 'Code' takes you from the AND's and XOR's and 0's and 1's to the experience you know from a modern computer interface. It is a brilliant book.
I'll also +1 this, it is a great read. Has to be top 5 interesting books I have read over the years.
Also check out The Pattern on the Stone, a similar book by the inventor of the Connection Machine.
I am currently reading it and would definitely suggest it.
An old standard: The Mythical Man Month by Fred Brooks.
Eh. I read it but a lot of the particulars of how code is made doesn't really apply anymore.

The concepts and terminology are absolutely invaluable to understand, but you can pick those up other ways.

The Psychology of Computer Programming by Gerald M. Weinberg

It's an old book but the most eye-opening one to me.

From its preface: "This book has only one major purpose - to trigger the beginning of a new field of study: computer programming as a human activity, or, in short, the psychology of computer programming."

Still a worthy topic, still worth your time. As was mentioned about 'The Pragmatic Programmer', I think reading this works best once you have a few years of experience.

Sure, it was written in the '70s. It talks about punched cards and 24-hour turn around for program listings. On paper.

But programmers haven't changed much since then. You'll recognize all the weirdness in software work.

Thinking Forth

http://thinking-forth.sourceforge.net/

Teaches you to think simple and elegant.

Thinking Forth is a great suggestion since the approach goes way beyond Forth. I also would read the Brad Cox (objc creator) books if you can get them.
Reading this one after Starting Forth. I wonder how many have read this that have never written a line of Forth?
In addition to those already mentioned here, I enjoyed the book 'Algorithms' by Robert Sedgewick & Kevin Wayne.

The algorithms are explained, and demonstrated (in java). But with the knowledge of how the algorithm works you should be able to use them in another language.

(And even though henrik_w already mentioned it, Code Complete2 is a really good book to read!)

Any good book on statistics would be a huge asset, as well as a book about debugging strategies.
Statistics books I liked:

Motulsky's Intuitive Biostatistics - this one goes over all the usual methods used in science from distributions to t-test to ANOVA to regressions etc., the basics, but doesn't introduce the maths (you use R for that) but the assumptions and pitfalls of all of those methods.

Statistics Done Wrong: The Woefully Complete Guide - this is all the stuff that's going wrong in applied statistics, a bit short but enlightening

Discovering Statistics Using R - a whopper of a book (~1000 pages?), it goes through everything while also being funny (the constant humor may not be for everyone). Graphs, correlations, regressions, all the MLMs and GLMs, linear models etc. pp., their assumptions, how to run them in R, how to interpret R's sometimes annoying output, etc. pp. Like Motulsky's, but wayyyyy more in-depth on the language's specifics.

Naked Statistics - an intro to stats for laypeople with a focus on politics/economics, good for interpreting and assessing daily news

Though it uses a subset of C++ for the code examples, Elements of Programming by Stepanov and McJones. It shows how algebra can serve as an effective foundation for engineering generic, reusable programs.
"The Elements of Style" by Strunk & White. Not exactly a standard programming book. Not really language-agnostic either -- quite English-centric.

I here assume your source code will be read by others; or by yourself after more than three months has passed.

Get the new edition (the old 1930 edition is still sold, but is not the one I'd recommend)
It is an English language and writing style classic. Recommend for sure but not sure abt the relevance here.
As someone married to an journalist and now EIC and one who prides himself on concise and solid writing, I really detest this book. It's full of terrible recommendations that the authors themselves don't even follow in their own book. I strongly recommend any English authors stay miles away from it.

If you want this sort of thing, read a well-respected publication's style guide (e.g., from the AP, NYT or Economist).

meta advice: read many, some book, even great and famous, don't click at first, read something else that clicks, reread the others later. iterate.
The Aosa series of books are brilliant imho:

http://aosabook.org/en/index.html

Titles :

  * The Architecture of Open Source Applications (volumes I and II)
  * The Performance of Open Source Applications
  * 500 lines or less
Joy of Clojure & SICP. To a lesser extent, Learn You a Haskell. 7 Languages in 7 Weeks is an excellent good baby step book if these are too daunting. 7in7 was my first intro to many new ideas.

Any language worth learning has this property of influencing the way you think forever. TDD, Code Complete &co are all very integrated into mainstream industry and are no longer novel. If you find yourself needing to recommend your colleagues to read Code Complete you might consider working on the skills to get a better job.

Programming Pearls by Joe Bentley. And its followup. It's old but it does get you thinking about things.

I'd also recommend The Linux Programming Interface by Michael Kerrisk as it teaches so much about what makes modern Unix what it is but.. it's arguably quite oriented around C by necessity. It's not a "C book" by any means though.

Can't say enough good things about Programming Pearl. Don't forget to do the exercises (or at least think about them).
Working Effectively with Legacy Code by Michael Feathers. It's a bit hard to wrap your brain around the Java and C++ examples unless you have experience with them, but the techniques are timeless. You may need to practice them extensively before you understand how important they are, though. In a recent book club we did at work, a common complaint was, "This just looks like common sense". Indeed it does... though the common sense is uncommonly hard to find when you are staring at the actual situations this book helps you with.
I just finished reading this book yesterday. I am not an expert in refactoring but the book seems too old, although most advises could be still useful. Anyway, today I found a new book by the author: Brutal Refactoring: More Working Effectively with Legacy Code. Unfortunately, I couldn't find a good review of the book on the Internet. But I think it could be more useful.
"the book seems too old"

2004 is old now? Really?

Honestly, good books don't age as long as their core domain stays valid. Structurally C++ is pretty much the same as when the book came out.

Modern IDEs can deliver many of the recommendations of the book. Our productivity has increased a great deal. Back then there was no intellisense, code navigation through clicking on method names/classes etc. highlighted syntax errors, built-in unit test frameworks etc.

It was written for a different type of developer and a different type of development environment and a specific language, C++.

You haven't looked at C++ lately if you think it's the same as it was in 2004. The ISO has released new versions of the language in 2011, 2014 and ratified a new standard here in 2017. If you're writing C++ code that is consistent with 2004 C++ then you're writing a really bad version of "C with classes", not C++.

Edit:

Modern C++ contains native support for the filesystem, threads, lambda expressions, variants, upcoming networking library, coroutines (at least in Visual Studio), no more new/delete memory management, parallel algorithms and a ton more. This is a completely different language now and the code you write looks nothing like 2004 C++ code.

Our productivity has increased a great deal. Back then there was no intellisense, code navigation through clicking on method names/classes etc. highlighted syntax errors, built-in unit test frameworks etc.

Just about all of these things were around in 2004.

Intellisense (the MS one) was introduced in 1996. VB6 had good intellisense. I seem to remember having intellisense while working in classic asp vb (as in pre .Net), but could be wrong, it's so long ago now.
A lot of people have to maintain legacy C++98 codebases and don't get to play with new compilers.
"You haven't looked at C++ lately if you think it's the same as it was in 2004."

"If you're writing C++ code that is consistent with 2004 C++ then you're writing a really bad version of "C with classes", not C++."

I applaud your attempt at an authoritative voice. But you focus on mostly technical trivia that are thin scaffolding on top of the language. I agree modern C++ is nice but it's the same language still.

"This is a completely different language now and the code you write looks nothing like 2004 C++ code."

Are you trolling? This reads like a transcript from a TV commercial.

They sound like they're echoing the kinds of things that are normally said about C++11.

> I agree modern C++ is nice but it's the same language still.

Well...in the same sense that any language is the same language after you add a bunch of things to it that weren't there before and shift to using those new features as idiomatic parts of the language. I would expect C++ written in 2004 to use different patterns than C++ written in 2017. Not "completely different"...but different.

Idiomatic sounds like preference to dogmatism rather than pragmatism which is generally the worse tradeoff.

I would say generally C++ style has evolved through last decades with people understanding class based architecture as an antipattern and data pipelines based on preferably immutable data as the more robust and understandable approach. This has nothing to do with language standards or 'idiomatic' constructs - both can be expressed as perfectly elegant C++, using the '98 or '11 or '17 variant.

But anyway, within this context - refactoring old code - I would not expect a legacy codebase to resemble 2017 C++ as much as 1997 C++. This is the main reason I find the claim of methods to understand circa 2004 C++ to be outdated to be silly.

> Idiomatic sounds like preference to dogmatism rather than pragmatism which is generally the worse tradeoff.

That's never been the way that I've read it, and it's not how I meant it. New language constructs allow for more-natural ways for the code to express the intent of the programmer, replacing the use of older constructs in the places that they were clumsy.

The entire point is to make the language more practical. Patterns of use in a language aren't idiomatic because of dogma (or at least, they shouldn't be). They're idiomatic because they're a clear and elegant way (or at least the most elegant way available) to implement something.

> I would not expect a legacy codebase to resemble 2017 C++ as much as 1997 C++.

Agreed, but then we come back to the fact that we might refactor a 1997 codebase differently in 2004 than in 2017.

"Agreed, but then we come back to the fact that we might refactor a 1997 codebase differently in 2004 than in 2017."

Well, if the original code is of the worst kind of a mess, Feather's circa 2004 collection of methods to make it more understandable but functionally the same work just fine for the first part of the refactoring. In my experience this is the most difficult part as well. To what dialect of the language the code is ported after it is understandable, is a relatively trivial syntax transform after this.

I speak from experience from having recently had to implement features to a production codebase with millions of lines of code, some of which date back to Fortran, and that took the final step of evolving into C++ sometimes in the late 90's.

I prefer the definition of legacy code that it's any code that does not have unit tests. In this case every transformation to a production codebase needs to retain the original behavior - without exact understanding what that behavior is.

I think this comment should have been my original response to this thread instead of the relatively cheeky responses I wrote earlier.

Modern IDEs can do many of the refactorings required when modifying code, yes. But you still need to know where to find seams or how to create them. Refactorings are just tools for getting there. It doesn't seem like you have read the book.
Me and a friend continually send IM's to each other, "LEAN ON THE COMPILER!".

That statement alone, one of the sections of the book, recommending you to allow the compiler to find your errors for you, is an example of the "age" of the book.

At the time I read it, when it first came out, I loved it. I still love Michael's work and advice to this day, but this book was written for another time.

I do not understand this. It seems like a perfectly good advice, and in fact it's what I'm doing every day - leaning on my compiler, and in Java world, on my IDE.

And also it seems to be something lots of programmers don't realize for some reason - many times I had to instruct people to crank up their compiler warning settings and actually read them. Especially in C-land, I can't count the number of times I solved someone's problem by appending -Wall to the gcc invocation and telling them to come back after they fixed all the warnings...

My point was that with a modern IDE we can do that without resorting to a full compile, which can be burdensome with large codebases.

The IDE space has improved a lot since 2004, eg. Jetbrains' tools around refactoring and code cleanup suggestions, make things super simple.

Don't get me wrong, I've read this book, multiple times, it's on my bookshelf and think it's a great book, but it was written when the state of development was a much different landscape, IMO.

(comment deleted)
Leaning on incremental compile via a modern IDE is leaning on the compiler. The principle is the same, even if the implementation slightly differs.
Every day I wished I'd listened to the XP guys the first time I encountered it, and most of that material is from the late 90's.

And Fred Brookes' book is over 30 and sadly just as relevant.

Just looking at the responses to this comment, I have to say that I agree with both sides. The book is really dated, but the advice is timeless. The biggest problem I've had trying to get people to take the book seriously is that they can not identify with it. I had not realised that Michael Feathers had written a followup. I will definitely take a look. Thanks!!!
Domain Driven Design by Eric Evans

Implementing Domain Driven Design by Vaughn Vernon

Clean Code by Robert Martin

I think you will find some code in all of the books but the ideas are applicable almost everywhere.

"Types and Programming Languages" (aka "tapl")
Although the OP seems to be asking for "engineering" not "programming" books, I'm going to second this. Benjamin Pierce's "Types and Programming Languages" will help you get down to what programming is really about. If you are not familiar with lambda calculus and its notation, it may be rough going at first. But lambda calculus is VERY simple, and Pierce takes you through it. The book progresses methodically to the concepts found in most common programming languages.

This is one of the few truly language agnostic books on programming. SICP is close, but it is limited in relevance at times due to the limitations of a particular language (Scheme).

A Pattern Language by by Christopher Alexander, Sara Ishikawa and Murray Silverstein. https://en.wikipedia.org/wiki/A_Pattern_Language

From a blog post ( http://the-whiteboard.github.io/book/review/2016/02/17/five-... ) I wrote a bit ago...

---

The first thing that will come to mind when seeing that title is “ug, another book on patterns.” Or maybe “I thought it was named Design Patterns - Elements of Reusable Object-Oriented Software”

This isn’t anything like that book. Or maybe it should be. The full title of the book is A Pattern Language: Towns, Buildings, Construction. Yes, this is a book about architecture - but not software architecture. It is about the houses and buildings that we walk live and work in.

The description of A Pattern Language is one that will sound very familiar to people familiar with Design Patterns:

> It is shown [in The Timeless Way of Building], that towns and buildings will not become alive, unless they are made by all the people in society, and unless these people share a common pattern language, within which to make these buildings, and unless this common pattern language is alive itself.

> In this book we present one possible pattern language, of the kind called for in The Timeless Way. This language is extremely practical. It is a language that we have distilled from our own building and planning efforts over the last eight years. You can use it to work with your neighbors, to improve your town and neighborhood. You can use it to design a house for yourself, with your family; or to work with other people to design an office or a workshop or a public building like a school. And you can use it to guide you in the actual process of construction.

> The elements of this language are entities called patterns. Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice. This is the book that inspired Gamma, Helm, Johnson and Vissides.

By reading A Pattern Language you will be able to understand what the authors of Design Patterns were trying to do and how design patterns were intended to work.

It’s a good book too, who knows what else you will find useful in it. Pattern #146 describes a flexible office space. Pattern #148 describes a workspace for small work groups, #151 is about small meeting rooms, #152 is a half private office. Everyone who works in today’s world of computers and cubes, can use these ideas to conceptualize and consider improvements to the office.

Since reading that book, I apply it every time I look at a new public space or building interior. It's utterly brilliant.
"Peopleware: Productive Projects and Teams" by DeMarco and Lister.
Books I'll treasure forever:

    - Advanced Programming in the Unix Environment by Stevens
    - Operating Systems: Design and Implementation by Tanenbaum
    - The Art of Unix Programming by ESR
    - Parsing Techniques by Grune and Jacobs
    - Applied Cryptography by Schneier
I'll second The Art of Unix Programming - despite the title, it has many broad programming and software architecture lessons, and "The Unix Philosophy" is applicable far beyond Unix.
I have a pretty negative opinion on ESR these days. I could find technical arguments about many aspects of his good pieces of writing, and much of his writing is not good. His abilities as a coder are not generally remarkable, either. But mostly I don't think he's a good person. I would probably not say "Don't read ESR", but I think it has to be "Read ESR* "

*but be aware that he's a polarizing figure and opinions of his merits differ

(and if you happen to have a differing opinion, please use the reply button instead of the downvote button)

I share your sceptical opinion about ESR, but I concur with the other commenters that The Art of Unix Programming is still worth reading. (In contrast eg to his thing about Bazaar vs Cathedral.)
The Cathedral and the Bazaar was not an excellent piece of writing, but it was sort of necessary at the time. It has served its evangelical purpose well, to the point where it's no longer necessary. Open Source won the day, in no small part due to ESR. (I think it vital to give my enemies their due praise).

TAoUP is a good book on the Unix Philosophy, but it's worth noting that the ultimate expression of these ideas (Plan 9) was a failure, and the 'everything is a file' metaphor is arguably incorrect. I hope I didn't give the impression that it was not worth reading, especially in the sense that there are few other good sources for that information (even using Unix is not likely to teach you much about its whys and wherefores). I just think that it should be read in the proper context, and that recommendations should try to include that context.

Yep.

And I'd bet that a lot of programmers wouldn't be working on and with Linux right now if they hadn't have read that book long ago.

Both of them changed my career path from Dos/Windows to Linux

Agreed on all points. Especially on TAoUP being a good expression of the philosophy---even if the philosophy is, of course, far from a silver bullet.
> - The Art of Unix Programming by ESR

Yes. TAOUP has a lot of good content about Unix programming styles and traditions, much of it useful generally. ESR's writing style is a bit heavy / verbose / uses verbal flourishes, but if you can let that not put you off, the book is worth reading. I've read most of it. One of the good sections is about Rules (of programming in Unix, which are not really rules, of course, but informal guidelines developed over many years of experience by many people - ESR has sort of codified them, a thing he tends to do a lot :)

The Rule about separating the interface from the implementation is a good one. I've seen developers at even enterprise companies sometimes not follow it in practice.

> - Parsing Techniques by Grune and Jacobs

Just saw that there is a new edition of this book:

https://dickgrune.com/Books/PTAPG_2nd_Edition/

"The Design of Design: Essays from a Computer Scientist" by Frederick P. Brooks [1] is language-agnostic and worth reading.

It's about software engineering but also about hardware and some different kinds of design outside of IT.

From an interview about the book [2]:

> Eoin: Your new book does talk about software design in places, but it’s really about design generally, and the case studies span buildings, organizations, hardware and software. Who is the book aimed at? Are you still writing primarily for people who design software or are you writing for a broader audience?

> Fred: Definitely for a broader audience. I have been surprised that The Mythical Man-Month, aimed at software engineers, seems to have resonated with a broader audience. Even doctors and lawyers find it speaks to some of their team problems. So I aimed this one more broadly.

Brooks is also the author of The Mythical Man-Month which is often mentioned on HN.

[1]: http://www.informit.com/store/design-of-design-essays-from-a...

[2]: http://www.informit.com/articles/article.aspx?p=1600886

Just purchase this book after finding a pdf, it's really quite great, until you get to View/360 and get jealous.
moby dick by herman mellvile

the bible / unknown author

the new testament / various

The New Testament is part of the Bible.
i see in my native language (hebrew) it's not.
Oh. We call that one the Old Testament or the Hebrew Bible.
How is this related to programming?
I saw many comments and had some good programming books to suggest but thought that a little fun would not hurt. but it looks like according to the -4 i got i should have not make that joke. jokes are not allowed here?
Code complete

Refactoring

Patterns of enterprise architecture