chapter two

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 the popular belief, programmers are human. They carry the same cognitive biases humans have over 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 StackOverflow, use plain text files for data storage, or make a deal with a demon if your soul isn’t already under NDA[1]. Nobody other than your peers really care about how you do things, everybody else wants a good, working product.

2.1   Crash course on algorithms

2.1.1   Tackling the Big-O bigotry

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?

2.3.1   Being strong on the type

2.3.2   Proof of validity

2.3.3   Don’t framework hard, framework smart

2.3.4   Types over typos

2.3.5   To be nullable or non-nullable

2.3.6   Better performance for free

2.3.7   Reference types vs value types

2.4   Summary