The Road Less Chose
Many similar questions come from Quora like this:
“How I can learn X in Y months”.
Typically, X is some specific new technology.
Everyone wants to learn quickly. But the truth is, everything worthwhile needs hard work 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.
There are already plenty of learning resources, textbooks, video lectures about CS on the Internet. 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.
For the general programming category, the most important thing is sharing the ultimate basic concepts of CS or engineering, the beauty, and the joy of programming.
Good general programming books don’t only tell you how but explain the why behind it.
General right programming style and practice are not related to specific programming language or technology.
These will help you how to think, and it will help you become a better programmer.
The Pragmatic Programmer: From Journeyman to Master
This book is talking about the best practices and major pitfalls of many different aspects of software development. It gives advice about meta-programming, little languages, testing, user interfaces, and many other aspects of development.
There are many similar pieces of advice for most problems and scenarios, investing in the long term and don’t repeat yourself. If you find some task 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 15 years, there is no new learning curve when starting to learn new programming.
It’s like a new programmer’s bible. The first version came out 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, and 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 essential 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 will show you the beauty of code, how to build a small language, how to make 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.
It 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.
Only 10% of programmers can write a binary search, is it surprised you?
Indeed, 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 books are my favorites:
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, and ancient programmers need to write code smart without so many modern tools. Solving problems means thinking correctly, find the right algorithm and data structures. Programming as a craft. This book will show you the process and fun of designing algorithms.
Beginner: The series of Robert Sedgewick is the right choice, which with the sample code of C or 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
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 for daily work, but very few programmers will hands-on compiler development.
As an aspiring programmer, you should at least understand the overall procedures of compilers. Generally, you need to know how parser, AST analysis, code generation, and linker work together. Compiler technology contains many classic aspects of computer science. It’s worth your time 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. These are the 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 is a textbook used in many universities, with all the code is here.
This book 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.
These are not so many exercises for practicing, and the book still gives you a whole picture of language studying.
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 describes the semantics and the implementation of the whole Lisp family of languages, full of detailed code.
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.
I recommend some great projects for self-learning, these projects are small enough, if you 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 can 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.
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 proper preparation for studying OS internals.
The Design and Implementation of the FreeBSD Operating System
It’s well-organized and also tells you the concepts of OS, explains the detail data structures and algorithms for implementation, especially explain the why of design. The key code is listed with comments too.
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 useful 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.
For networking studying, there are many historical and theory parts, with all kinds of protocols, it may be scorched 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
First, we need to have a big picture with the OSI model, understanding why it’s organized into seven layers, what is the 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 represents the history of networking.
Finish the exercises with Wireshark or tcpdump will help much in studying.
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, with the critical 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.
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 great projects like Nginx, a good understanding of this kind of code requires to combine knowledge of operating system and networking.
Of course, you do not need to read all these books, but I believe finishing some will make you a better programmer.