Setting the Scene


Figure 1

Course overview diagram. Arrows connect the following boxed text in order: 1) Setting up software environment 2) Verifying software correctness 3) Software development as a process 4) Collaborative development for reuse 5) Managing software over its lifetime.
Course overview diagram

Section 1: Setting Up Environment For Collaborative Code Development


Figure 1

Tools needed to collaborate on code development effectively
Section 1 Overview

1.1 Introduction to Our Software Project


Figure 1

Snapshot of the inflammation dataset

Figure 2

Software project fork repository in GitHub

Figure 3

Making a fork of the software project repository in GitHub

Figure 4

View of your own fork of the software repository in GitHub

Figure 5

URL to clone the repository in GitHub

1.2 Virtual Environments For Software Development


Figure 1

Python environment hell XKCD comic
Python Environment Hell from XKCD (Creative Commons Attribution-NonCommercial 2.5 License)

1.3 Integrated Software Development Environments


Figure 1

View of an opened project in PyCharm

Figure 2

Missing Python Interpreter Warning in PyCharm

Figure 3

  • Select Virtualenv Environment from the list on the left and ensure that Existing environment checkbox is selected within the popup window. In the Interpreter field point to the Python 3 executable inside your virtual environment’s bin directory (make sure you navigate to it and select it from the file browser rather than just accept the default offered by PyCharm). Note that there is also an option to create a new virtual environment, but we are not using that option as we want to reuse the one we created from the command line in the previous episode. Configuring Python Interpreter in PyCharm

  • Figure 4

    Packages Currently Installed in a Virtual Environment in PyCharm

    Figure 5

  • Select the + icon at the top of the window. In the window that appears, search for the name of the library (pytest), select it from the list, then select Install Package. Once it finishes installing, you can close that window. Installing a package in PyCharm

  • Figure 6

  • Select Add new run configuration... then Python. Adding a Run Configuration in PyCharm

  • Figure 7

  • In the new popup window, in the Script path field select the folder button and find and select inflammation-analysis.py. This tells PyCharm which script to run (i.e. what the main entry point to our application is). Run Configuration Popup in PyCharm

  • Figure 8

    Syntax Highlighting Functionality in PyCharm

    Figure 9

    Code Completion Functionality in PyCharm

    Figure 10

    Code References Functionality in PyCharm

    Figure 11

    Code Search Functionality in PyCharm

    Figure 12

    Code Search Functionality in PyCharm

    Figure 13

    Version Control Functionality in PyCharm

    Figure 14

    Running a script from PyCharm

    1.4 Software Development Using Git and GitHub


    Figure 1

    Development lifecycle with Git, containing Git commands add, commit, push, fetch, restore, merge and pull
    Software development lifecycle with Git

    Figure 2

    git-distributed

    Figure 3

    Git feature branch workflow diagram

    Figure 4

    Software project's main branch

    Figure 5

    Software project's develop branch

    1.5 Python Code Style Conventions


    Figure 1

    Python code indentation settings in PyCharm

    Figure 2

    Python code whitespace settings in PyCharm

    1.6 Verifying Code Style Using Linters


    1.7 Optional Exercises for Section 1


    Section 2: Ensuring Correctness of Software at Scale


    Figure 1

    Tools for scaled software testing
    Section 2 Overview

    2.1 Automatically Testing Software


    2.2 Scaling Up Unit Testing


    2.3 Continuous Integration for Automated Testing


    Figure 1

    Continuous Integration with GitHub Actions - Initial Build

    Figure 2

    Continuous Integration with GitHub Actions - Build Log

    Figure 3

    Continuous Integration with GitHub Actions - Build Details

    Figure 4

    Continuous Integration with GitHub Actions - Build Matrix

    2.4 Diagnosing Issues and Improving Robustness


    Figure 1

    NumPy arrays of incompatible shapes

    Figure 2

    NumPy arrays' shapes after adding a new_axis

    Figure 3

    NumPy arrays' shapes after broadcasting

    Figure 4

    Setting up test framework in PyCharm

    Figure 5

    Running pytest in PyCharm

    Figure 6

    Ensuring testing configurations in PyCharm are correct

    Figure 7

    Running a single test in PyCharm

    Figure 8

    Setting a breakpoint in PyCharm

    Figure 9

    Debugging in PyCharm

    Figure 10

    Debugging in PyCharm

    Figure 11

    All tests in PyCharm are successful

    2.5 Optional Exercises for Section 2


    Section 3: Software Development as a Process


    Figure 1

    Software design and architecture overview flowchart

    3.1 Software Requirements


    3.2 Software Architecture and Design


    Figure 1

    Writing good code comic

    Figure 2

    Diagram showing proposed architecture of the problem

    3.3 Code Decoupling & Abstractions


    3.4 Code Refactoring


    3.5 Software Architecture Revisited


    Section 4: Collaborative Software Development for Reuse


    Figure 1

    Software design and architecture

    4.1 Developing Software In a Team: Code Review


    Figure 1

    Code review process sequence

    Figure 2

  • Create a new pull request by clicking the green New pull request button. GitHub pull requests tab

  • Figure 3

  • Click Create pull request button to open the request. Creating a new pull request.

  • Figure 4

  • Add a comment describing the nature of the changes, and then submit the pull request by clicking the Create pull request button (in the new window). Submitting a pull request.

  • Figure 5

    Adding a collaborator in GitHub

    Figure 6

    Locate up the pull request from the GitHub’s Pull Requests tab on the home page of your fellow learner’s software repository, then head to the Files changed tab on the pull request. The files changed tab of a pull request


    Figure 7

    When you find a line that you want to add a comment to, click on the blue plus (+) button next to the line. This will bring up a “Write” box to add your comment. Adding a review comment to a pull request You can also add comments referring to multiple lines by clicking the plus and dragging down over the relevant lines. If you want to make a concrete suggestion or a change to the code directly, such as renaming a variable, you can click the Add a suggestion button (which looks like a document with a plus and a minus in it). This will populate the comment with the existing code, and you can edit it to be what you think the code should be.


    Figure 8

    Note: you can only make direct code suggestions if you are a collaborator on a repository. Otherwise, you can add comments only. Adding a suggestion to a pull request GitHub will then provide a button for the code author to apply your changes directly.


    Figure 9

  • To do this, click the Finish your review button at the top of the Files changed tab. Using the finishing your review dialog In the comment box, you can add any other comments that are not associated with a specific line. For example, you can put the list of tests that you want to see added here.

  • Figure 10

  • Next you will need select to one of Comment, Approve or Request changes. Using the finishing your review dialog

  • Figure 11

  • You understand and agree with the reviewer’s comments. In this scenario, you should make the requested change to your branch (or accept the suggested change by the reviewer) and commit it. It might be helpful to add a thumbs up reaction to the comment, so the reviewer knows you have addressed it. Even better, leave a comment such as “Fixed via #commit_number” with a link to your commit that implemented the change. Responding to a review comment with an emojiResponding to a review comment with a link to commit

  • Figure 12

  • Once the reviewer approves the changes, the person whose repository it is can merge the changes onto the base branch. Typically, it is the code author’s responsibility to merge but this may differ from team to team. In our case, you will merge the changes on the PR on your repository. Merging a pull request in GitHub

  • 4.2 Preparing Software for Reuse and Release


    4.3 Packaging Code for Release and Distribution


    Section 5: Managing and Improving Software Over Its Lifetime


    Figure 1

    Managing software

    5.1 Managing a Collaborative Software Project


    Figure 1

    List of project issues in GitHub

    Figure 2

    Creating a new issue in GitHub

    Figure 3

    Referencing comments and commits in GitHub

    Figure 4

    Adding a new project board in GitHub

    Figure 5

  • Roadmap - suitable for a high-level visualisation of your project over time. Selecting a project board template in GitHub Regardless of which project type/view you select, you can easily switch to a different project layout later on.

  • Figure 6

    After it is created, you should also populate the description of the project from the project’s Settings, which can be found by clicking the ... button in the top right corner of the project. Project board setting in GitHubAdding project description and metadata in GitHub After adding a description, select Save.


    Figure 7

    Default card board in GitHub

    Figure 8

    Adding issues and notes to a project board in GitHub

    Figure 9

    Converting a task to issue

    Figure 10

    Finally, you can change the way you view your project by adding another view. For example, we can add a Table view to our Board view by clicking the New button and selecting it from the drop down menu. Add another project view


    5.2 Assessing Software for Suitability and Improvement


    5.3 Software Improvement Through Feedback


    Figure 1

    Milestones in GitHub

    Figure 2

    Create a milestone in GitHub

    Figure 3

    Create a milestone in GitHub

    Figure 4

    Milestones in GitHub

    Wrap-up


    Figure 1

    Usefulness versus time to master grid

    Figure 2

    Overview of tools and techniques covered in the course

    Figure 3

    Overview of topics covered in the course based on level of difficulty