2 Practical theory

 

This chapter covers

  • Why computer science theory is relevant to your survival
  • Making types work for you
  • Understanding the characteristics of algorithms
  • Data structures and their weird qualities that your parents didn’t tell you about

Contrary to widely held belief, programmers are human. They have the same cognitive biases other humans have about the practice of software development. They widely overestimate the benefits of not having to use types, not caring about correct data structures, or assuming that algorithms are only important for library authors.

You’re no exception. You’re expected to deliver a product on time, with good quality, and with a smile on your face. As the saying goes, a programmer is effectively an organism that receives coffee as input and creates software as output. You might as well write everything the worst way possible, use copy and paste, use the code you found on Stack Overflow, use plain text files for data storage, or make a deal with a demon if your soul isn’t already under NDA.1 Only your peers really care about how you do things—everybody else wants a good, working product.

2.1 A crash course on algorithms

2.1.1 Big-O better be good

2.2 Inside data structures

2.2.1 String

2.2.2 Array

2.2.3 List

2.2.4 Linked list

2.2.5 Queue

2.2.6 Dictionary

2.2.7 HashSet

2.2.8 Stack

2.2.9 Call stack

2.3 What’s the hype on types?

Summary