Introduction

Throughout this chapter, we will go through a number of fundemental concepts such as data structures, error handling, mocking and dependency injection.

Don't worry if you don't know what these things mean, we will cover that too.

For each concept, we will write tests to verify expected/claimed behaviours. You might think this is an unusual way of learning about some of these fundementals. But the purpose of this is 2 fold:

  1. To learn about the concepts & topics themselves.

  2. To get us used to writing tests to verify the behaviours we expect from our system. And to use our tests as a sort of crux, to lead the way when we are writing code.

By the end of this chapter, we will be familiar with the main core concepts of the language as well being pretty comfortable with idea of relying on tests to take the wheel for us.

We will also get used to the idea of writing tests to confirm our beliefs, and even to disprove theories.

As software engineers, we have the ultimate gift of lightning fast and incredibly cheap feedback loops during our day-to-day work in the form of automated tests. Compared to other professions this can feel like magic dust. So we should take full advantage of that!


With that in mind, we should get our project structure set up. Run the following command to get started:

mkdir src tests

This command will create 2 folders for us, 1 called src/ and another called tests/ . As you might have guessed in the src/ folder we will place all of our source code. And ourtests/ folder will be the home for our accompanying tests.

Last updated