The Best CS Books

The Best CS Books 1

Last Updated on

The Road Less Chose

Many similar questions come from Quora like this: “How I can learn X in Y months”.

Usually ‘X’ is some specific fresh technology.

Everyone wants to learn quickly, but the truth is, everything worthwhile need hard working and enough time, no shortcut.

As for programming, getting the fun of programming is most important at the beginning, then confidence should be built for further learning. Ultimately, the core knowledge of computer science will be indispensable for your career in a long time.

Technologies come and faded, but the principle tends to remain more constant. For those who want to be a good programmer, the narrow way is a better and longer one. So read the best and classic computer science books.

from Quora

Plenty of learning resources about CS around the Internet, textbooks, video lectures, etc. The website teachyourselfcs.com had covered most of them. I have some different choices here, prefer the style of “learn by doing”  and “learning with fun” textbooks(with some great open-source projects), it’s more enjoyable for me.

I will update this booklist regularly. If you have better choices, please tell me in the comments.

General programming

For the general programming category, the most important is showing the readers the ultimate basic concepts of CS or engineering, the beauty, and the joy of programming.

Good general programming books don’t just tell you how, but explain the why behind it.

General good programming style and practice are not related to specific programming language or technology.

These will help you how to think, it will help you become a better programmer.

The Pragmatic Programmer: From Journeyman to Master

master

This book talking about the best practices and major pitfalls of many different aspects of software development. It gives advice about meta-programming, little languages, testing, plain text interfaces, and many other aspects of development.

There are many similar advises for most problems and scenarios, investing in the long term and don’t repeat yourself. If you find something will be repeated, automatize it. If you find some tools you need to master, learn the most multi-faceted one so that you don’t need to repeat learning.

For example, one piece of advice is to choose an editor and use it adeptly, it’s true. For me, I have used Emacs for almost 10 years, there is no new learning curve when starting to learn new programming.

Code complete

cc

It’s like a new programmer’s bible. The first version is printed almost 25 years ago, but it still worth reading for developers. This book covers a wide range of issues in software construction that are relevant today, it’s well written and organized.

It even uses one chapter to teach you how to choose names for variables, methods, classes. Coding isn’t just about solving the problems. We’re writing something that others will read. That’s the essence of why naming is important when you write code.

If you consider programming to be a subset of writing, and I certainly do …

— David Heinemeier Hansson

Code Complete covers other parts like debugging, testing, error handling, design. These are the common parts for most programming languages and systems, they won’t dry at times.

Structure and Interpretation of Computer Programs

SICP

SICP will show you the beauty of code, how to build a small language, how to build a good abstraction model, what is recursion, concurrency, stream, and abstraction. This book will teach you the techniques used to control the intellectual complexity of large software systems.

Fools ignore complexity. Pragmatists suffer it. Some can avoid it. Geniuses remove it.

– Alan Perlis

It will change your perspective on programming, change your think about computing, it helps you to get a solid understanding of the fundamentals of computer science.

This is a challenging book, some well-skilled programmer also spends almost one year to finish it, including the exercises. Believe me, it worth your time.

There is also an online version.

Algorithms

Only 10% of programmers can write a binary search, is it surprised you?

It’s true many programmers don’t have enough knowledge and understanding of algorithms, most programmers will have some practice for the interview and then drop most after getting a job. But algorithms are indispensable for solving problems.

There are many textbooks for data structures and algorithms, but these are my favorites:

Programming Pearls

This book is easy to read, it contains many little stories. It will bring programming back in the ’80s when the computer’s memory and the disk are limited in small size, ancient programmers need to write code clever without so many modern tools. Solving problem mean think correctly, find the right algorithm and data structures. Programming as a craft. This book will show you the process and fun of designing algorithms.

Other books

Beginner: The series of Robert Sedgewick is a good choice, which with the sample code of C/Java.

Medium: The Algorithm Design Manual or Introduction to Algorithms, the second one contains more mathematical parts, with many more pages.

Advanced: The Art of Computer Programming, they are hard to read, it’s better to use it as reference books:)

If somebody is so brash that they think they know everything, Knuth will help them understand that the world is deep and complicated.

– Bill Gates

Online judges

Mastering algorithms need self-determined learning for a long time. Even you are not preparing for an interview, keep practice is very helpful, I recommend you with these two sites, the many easy and medium problems, LeetCode and HackerRank.

Programming languages and compiler

Almost every programmer will learn several languages at work, even design a DSL in some cases, but very few programmers will actually hands-on compiler.

Some compilers will cost much time when eating code, you should at least understand what’s is going on.  Anyway, compiler technology contains many classic aspects of computer science, it’s worth to have a study even you do not need to write a compiler.

For the programming language category, we should learn the core concepts of languages, including semantics, computation models, and program elements. This is a basis for understanding future developments in programming languages.

If we have a solid understanding of language elements, working with a new programming language will be very easy.

Essentials of Programming Languages

eopl

EOPL is a textbook used in many universities, with all the code is here.

This book actually is very fun, we build an interpreter for a small language with several lines of code! Then we extend it with abstraction technology: data types, functions, continuation, type and type checker, type inference, module, OOP, etc.

This book brings you face-to-face with the most fundamental idea in computer programming: The interpreter for a computer language is just another program. – Hal Abelson

Playing with interpreters skipped the most parts of parsing, and also didn’t deal much with code generation part. But it’s enough for learning the core concepts of programming languages.

EOPL is not an easy book, if you can not follow it then  Programming Language Pragmatics is an alternative, not so many exercises for practicing, it still gives you a whole picture for language studying.

Other books

There are some other classic textbooks such as “the Dragon Book”: Compilers: Principles, Techniques & Tools.

If you prefer to learn functional compilers, these books are the best ones:

Lisp in Small Pieces: This book will describe semantics and the implementation of the whole Lisp family of languages, with full code supplied.

Compiling with Continuations: This book use continuation for compilation in a real compiler, the language is Standard ML. It covers all the details, including runtime and GC.

Projects

I recommend some great projects for self-learning, these projects are small enough, if you totally understand the code of them, you will get more interests on the subject of compiling techniques:

8cc: 8cc is a compiler for the C programming language. The compiler is able to compile itself. The code is clean and easy-to-read.

Build Your Own Lisp: Tell you how to build a Lisp interpreter in about 1000 lines C code.

tcc: Another C compiler that generates x86 code, larger than 8cc.

System

apue

Advanced Programming in the UNIX Environment

The classic book of Stevens, it teaches you the programming interfaces on Unix and covers almost everything you need to know to access the Unix/Linux OS. It’s good preparation for studying OS internals.

The Design and Implementation of the FreeBSD Operating System

It’s well-organized, and also tell you the concepts of OS, explain the detail data structures and algorithms for implementation, especially explain the why of design. The key code is listed with comments too.

others

There are many small kernels for playing. Making a small kernel will cost much of time if you have enough interest and time, why not have a try, these links will help you:

OS dev.org including many good resources for references.

xv6: MIT xv6 is written according to the classic Lions code, the related course videos are very helpful.

How to Make a Computer Operating System: This tutorial gives you step-by-step instructions for building a toy OS.

Computer Networking

For networking studying, there are many historical and theory parts, with all kinds of protocols, it may be very dry to some people. But remember, you don’t need to remember all knowledge of every corner, the key point is to understand what the problem is solved by networking, why protocols are designed like that, how to you the related APIs of networking.

Computer Networking: A Top-Down Approach

The Best CS Books 2

First, we need to have a big picture with the OSI model, understanding why it’s organized into seven layers, what’s data format in each layer. This book describing how the Internet works, how applications interact with each other through networking, explains the algorithms and protocols in detail, it also describes the history of networking.

Remember do the exercises with Wireshark or tcpdump.

TCP/IP Illustrated, Volume 1~3

Use the new version of these books, because TCP/IP is evolving all these years. These books help you understand more deeply on TCP/IP, Volume 2 contains a thorough explanation of how TCP/IP protocols are implemented, the key networking part of code (BSD 4.3 kernel). All these are very technical and not easy for everyone, but it is worth you to read.

Others

Please practice with kinds of networking tools, try the labs in books will be very beneficial.

Do some projects with networking, for example, an HTTP server, make it handle multiple connections at the same time, make it perform better. Read a lot of code from some famous projects like Nginx, a good understanding of this kind of code requires to combine knowledge of operating system and networking.

Summary

Of course, you do not need to read all these books, but I believe finishing some will make you a better programmer.

Happy Coding!