Fork me on GitHub

Introduction to software engineering

In this lesson we will introduce important aspects of software engineering, specifically version control with Git and testing.

This material is based on two CodeRefinery lessons:

Version control

In this part of the lesson we will see why everyone should be using version control, and become comfortable using Git to stage and commit changes, create and merge branches and resolve conflicts.

Automated testing

In this part of the lesson we will discuss why testing needs to be part of the software development cycle and how such a cycle can be implemented. We will exercise a collaborative testing/code review workflow.

Prerequisites

If you are using the virtual machine provided to you at the summer school, you will only need to consider point 2 below.

  1. You need to have Git installed (see here for installation instructions).
  2. You need to configure Git (see here).
  3. You need a GitHub account.
  4. You will also need a Travis CI account but you can sign into it with your GitHub account.
  5. You need to have Python installed (we recommend Anaconda or Miniconda, see here for installation instructions).
  6. You need the Python package pytest.

Schedule

15 min Motivation for version control Why do I need version control?
What does an online repository look like?
30 min Basics What is Git?
What is a repository?
How does Git operate?
How do I make commits?
How do I select what to commit?
30 min Branching and merging How can I or my team work on multiple features in parallel?
How to combine the changes of parallel tracks of work?
How can I permanently reference a point in history, like a software version?
25 min Conflict resolution How can we resolve conflicts?
How can we avoid conflicts?
5 min Where to go from here Where to go from here?
10 min Break Break
10 min Motivation for testing Why should we write tests?
5 min Concepts What are unit tests, regression tests, and integration tests?
What is test coverage?
How should we approach testing?
5 min Tools What tools are out there?
15 min Exercise: Testing with pytest How can we implement a test suite using pytest?
I am a Fortran developer, do I need to care about pytest?
15 min Exercise/discussion: Testing using hooks How can we use Git hooks to make sure we do not commit broken code?
20 min Exercise: Automatic testing with Travis CI How can we implement automatic testing each time we push changes to the repository?