Want to see the full-length video right now for free?

Sign In with GitHub for Free Access


Why care about computer science?

A lot of people at thoughtbot don't have computer science degrees (or degrees at all). It's not necessary at all for a successful career in web development! So why learn it at all?

There are a few reasons. One is that you'll probably be a more effective web developer if you learn some computer science. Another is that web development is the tip of the software engineering iceberg. Think of all your tooling (like your database): the people that wrote that sure know their Big-O. Plus, computer science is really interesting! There are huge vistas of programming beyond web development, and they're super pretty.

Learning what lies beneath

Computer science can be closer to web development than you think. For example, the React framework relies on a deep understanding of computer science for its foundational "re-render the world" concept. Immutable.js, Facebook's JavaScript library for immutable data structures, also relies on computer science for both its idea and its implementation.

Rails is also directly impacted by computer science. Aaron Patterson wrote AdequateRecord, a set of patches to ActiveRecord that makes it about twice as fast across the baord. Relying on other people to do that is a little annoying -- what if you could write those kinds of patches yourself? Computer science can help!

If you can learn web development (and you can), then you can learn computer science.

What does "computer science" mean, specifically?

Let's go through the undergraduate computer science curriculum, because that provides a good framework.

The first semester is usually a basic introduction to programming. The second semester usually covers data structures (linked lists, arrays, trees, graphs, and the performance characteristics of each). Usually that's followed by an algorithms class, which covers the performance characteristics of algorithms (e.g. why looking up something in a linked list is slower than looking it up in an array).


After algorithms, the curriculum branches out widely. For example, you could learn a programming language. Harry read the Structure and Interpretation of Computer Programs (usually referred to as SICP) then built an interpreter. Interpreters and compilers aren't magic: they're just programs. Building an interpreter also teaches you about parsing, which can provide a solution to problems that can't be efficiently solved any other way.


As web developers, we usually communicate over HTTP, which is at the application layer of the network stack. There are a lot of other lower-level layers. For example: what ensures that bytes get sent across the network? What happens if a router dies in the middle? How do all the pieces get broken up and put back together?

If you're interested in that, you can look in to TCP (Transmission Control Protocol), or go even deeper and look at IP, which is the protocal that TCP runs on. IP defines router-to-router and router-to-server communications.

Learning C

Learn C! It's the building block of pretty much everything we use, from Vim to Postgresql to the terminal. If you learn C, the things that were black boxes become semi-permeable, because you can fix them. Learning C makes day-to-day tools less scary and more open to change.

It sounds weird, like recommending a literature major learn Latin, but the difference is that people are still writing C, every day.

Distributed systems

A distributed system has two definitions:

1) The modern definition is service-oriented architecture: a lot of different servers that each do different things. 2) The more academic definition is a series of nodes that run equivalent code, have reasonably equivalent performance characteristics, and are connected in some way.

MapReduce is one example of this. Distributed databases are another.

Say you run a nuclear reactor, and you don't want it to melt down. If the computer that controls whether or not to melt down has a bug, ideally the reactor would still not melt down. To avoid this, the reactor might have a whole bunch of computers that voted and must agree on whether or not to melt down. The voting means that one compromised computer can't win the vote, because there are still some "good" computers.

Distributed databases

Amazon's DynamoDB sparked a lot of interest in distributed key-value stores, and there are a lot of them now. Two of many are Cassandra and Riak.

There are a lot of interesting algorithms that arise with distributed systems, like determining who wins a vote, or finding the state of a system at a given time, or finding out the order of events within the system.

Practical applications

These ideas may seem very abstract and removed from day-to-day practicalities, but even knowing about them can help with your next problem. It gives you a richer vocabulary and toolset for other problems.

Discrete math

Discrete mathematics is a great thing to study a little bit of. It's not a prerequisite, but discrete math and combinatorics make algorithms more fun.

Further reading

Harry wrote a blog post on Reading the CS Canon a couple years ago that has some suggestions for books and papers.

  • SICP is available online to read for free, and the lectures are also excellent (despite being from 1986). It moves fast, but it's very self-contained.




Artificial Intelligence