**Introduction**

My post Replicating a BSc in Computer Science through MOOCs is one of the more popular on this blog. A few people were asking me whether I could recommend some books that are particularly suited for autodidacts. In the following, I’m listing resources I found suitable for self-study, including some particularly suitable online courses (MOOCs) to complement your studies.

I do not want anybody to take my word as gospel, though. I’m going to list resources I found helpful. I have not conducted a systematic literature review but merely went through a number of books until I found one I could work with. I recommend the resources below based on my own experience. There may be better resources out there. So, if you’ve found some other books or online courses helpful, then feel free to comment below. Further, there are a lot of rather poor books and courses, which I’m not going to mention, as I found it more constructive to focus on positive examples.

I’m only focussing on key topics in the undergraduate curriculum, i.e. programming, data structures, discrete mathematics, and algorithms. I may post a follow-up on more advanced resources some time in the future, possibly on functional programming and programming language theory. The time spans I mention are based on the assumption that you have a few hours per day available for self-study. Overall, this study program will take you well over a year to finish, and will require serious dedication.

**Imperative and Object-Oriented Programmming**

I’d recommend learning Python since it’s easy to get started with it. It’s pretty painful to use for anything moderately complex, though. Downey’s book *Think Python: How to Think Like a Computer Scientist* is concise and contains plenty of exercises. If possible, go through Rice University’s Coursera course *An Introduction to Interactive Programming in Python* as well. These two resources alone will have you write several thousand lines of Python code. Four months seem like an adequate time span for these two resources.

Java is more of a means to an end if you want to put a skill on your CV recruiters care about. Once more, I’d recommend Downey. *Think Java* is likewise concise. Since you’ve learnt Python already, Java should be relatively straightforward to pick up. Therefore, schedule one month for this book.

**Data Structures**

You should have had exposure to data structures in the previously mentioned resources. To gain further practice, go through both the Java and Python sections on CodingBat. You should complete all exercises on your own. If you struggle, then brush up on the basics of Java and Python.

Two months should be plenty of time for all exercises. There are several hundred on there, but if you do a handful to a dozen every day, you’ll progress quickly. You should get to a point where you can solve those exercises straight away, maybe with the exception of a few of the more elaborate ones.

**Discrete Mathematics**

*Schaum’s Outline of Discrete Mathematics* is very good. It’s great to have just for the exercises. If the explanations are too sparse for your taste, then Eric Lehman and Tom Leighton’s lecture notes *Mathematics for Computer Science*, which are freely available online, will serve you well. For instance, I haven’t come across an explanation of generative functions that was clearer and more accessible than theirs.

For my university course in discrete mathematics I bought Rosen’s *Discrete Mathematics and Its Applications*, as it was the prescribed course literature. I thought it was lacking in some regards. In particular, I wasn’t too fond of the approach of using several, sometimes convoluted, examples without explaining the underlying principles in the abstract. Schaum’s makes a great companion for it, though.

A book some people recommend is *Concrete Mathematics* by Graham, Knuth, and Patashnik. In the very first line of the preface of said book you can read that it was written for a course at Stanford that was primarily taken by graduate students. I’m tempted to say that just like it is the case with Knuth’s *The Art of Computer Programming*, people recommend it because they’ve heard the title somewhere and had the impression that it was an authoritative book.

There is no MOOC on discrete mathematics, as far as I know. The Saylor Academy offers course materials, though. Their exam is a bit on the easy side and therefore a good lower bound to aim for. If you don’t have access to a university course, then using the Saylor Academy materials as a guide, and supplementing them with exercises taken from Schaum’s Outline would be a good strategy. You’ll probably need two to three months of part-time study.

**Algorithms**

Probably the most accessible algorithms textbook is *Algorithm Design* by Kleinberg and Tardos. I’ve only studied part of this book in the context of taking Stanford’s Coursera course *Algorithms: Design and Analysis*. Alternatively, Introduction to Algorithms on MIT OCW seems like a good resource, based on the lectures I watched.

If you can, clear your schedule and take the Algorithms course on Coursera, which is a two-part course sequence. It will take you three to four months of study. I haven’t found the time to take part II yet, though. However, I did have a very good impression of part I, and benefited quite a bit from it.

Cowboy BebopHi Gregor,

Thank you for this post! I had a look into “Schaum’s Outline On Discrete Mathematics” and found it surprisingly useful and a joy to read. I did the first few excercises and I think they are pretty well designed to give the reader an understanding of the material at hand. Did you read any other books in that series?

BTW: You should reread your projects section. It has a few minor typos. 😉

Gregor UlmPost authorI’ve used several other books of that series over the years: Linear Algebra, Calculus, Data Structures with Java, and one on probability. There are several on probability, and I’d have to have a look at the actual book to remember which one it was. The Discrete Mathematics one is a standout and might even be able to replace a proper textbook. The other books in this series I’ve worked with, though, are more useful as supplements.

Cowboy BebopThank you for answer, Gregor!

If you can find the time, I would be interested in which copy you got, because there are more than a handful books on probability in that series. Also, maybe you can summarize the pros and cons of that book in 2 to 3 sentences?

Gregor UlmPost authorI don’t have the time for that, unfortunately. However, I only did a few extra exercises, which you could arguably find in any other textbook as well. There’s a Probability MOOC on Coursera going on right now, so maybe check that one out instead if you want some extra practice.

Cowboy BebopThank you for your answer and the information, Gregor! 🙂

Cowboy BebopJust wanted to add something real quick. A nice primer before learning Java is to learn Processing first.

A great book to learn Processing is Andrew Glassner’s

Processing for Visual Artists. It’s a real gem, no pun intended!Cowboy BebopHi Gregor, I was wondering if you could recommend a good book about code refactoring with regard to functional programming. The book can be general in its approach and doens’t have to be language specific.

Thank you!

Best regards

Gregor UlmPost authorRefactoring isn’t that much of an issue in functional programming to begin with, and for two reasons. First, functional programs are drastically shorter than OOP programs. Consider that 500 lines of logic expressed in Haskell may very well require 5,000 lines of Java. Second, functional programs are constructed as compositions of many small functions. Thus, it would take quite some effort to create a convoluted FP program, which is the exact opposite of the situation with OOP. Thus, it is not very surprising that there are no books on refactoring FP programs available. Considering how ugly Scala code can get, due to the “object-functional” paradigm, I would wager that it is likely that sooner or later a book on refactoring Scala code will appear, but a general book may take a while. Also note that FP textbooks normally stress good programming style, which arguably also positively affects budding functional programmers.