1 of 43

A Developer Toolchain

& General Tips that each developer should know

Samuel Berton

2 of 43

Only examples of tools are given!

Logo contains the link to the website

3 of 43

IDE

4 of 43

In general

An integrated development environment (IDE) is software for building applications that combines common developer tools into a single graphical user interface (GUI).

- Redhat

As a developer you spend most of your time in an IDE-> optimise your usage of it

Sublime text

Visual Studio Code

PyCharm

Some examples:

Spyder

NeoVim

5 of 43

Visual Studio Code

My personal choice

  • Lots of extension that make it your own
  • Built in terminal
  • Project wide search
  • Some hot-keys
    • Ctrl+P :switch to file
    • Ctrl+ Shift+ F :find across the project
    • Ctrl + . :Quick fix
    • Ctrl + Click :Go to definition
    • Ctrl + Shift + P: Run command

Visual Studio Code

6 of 43

Some of the extensions I use

  • Python - Contains some python features
  • Rainbow brackets - Clear brackets view
  • Vim - vim emulator in VS
  • Gitlens - Some nice git features
  • Tabnine - AI Code completion ( could also use GitHub copilot)
  • Mypy - Type checking in Python

Lots of extensions exist -> check them out in VS

7 of 43

(Neo)VIM

Text editor extraordinaire

Different modes allow for wide functionality

To exit: press ZZ or :wq (write and quit) or :q! (Quit without saving

NeoVim

8 of 43

Communication

9 of 43

Search engines

If you don’t know something, search it!

Features to make your search better

DuckDuckGo features

  • Bangs: search on specific webpage
    • !g: google
    • !bang: search for bang
    • !py: python
    • !we: wikipedia

Google features

Excluding term: use - before e.g. bass -music

Search specific website: site: website link

10 of 43

Slack/ Other Communication

Project specific questions

  • Be clear!
    • Use snipping tools
      • Select portion of screen

to take a screenshot of

      • Use arrows and color
    • Use code blocks
    • Use threads

Flameshot

ShareX

11 of 43

Reference Management Tool

Save interesting articles

Instead of bookmarking, you can add them to a research tool

Export to bibliography, share with other people…

Two main ones are Zotero and Mendeley

Zotero

12 of 43

Planning

13 of 43

Planning

  • What needs to be done
  • Who does what
  • What is currently being done
  • Prioritize -> Deadlines

Meetings are meant to have input of the team

14 of 43

Scrum

Work in sprints of typically two weeks

    • Define the feature set at the beginning
    • Daily standup ( very short ):
      • What did you do
      • What do you plan to do
      • Where are you stuck
    • At the end: evaluate what’s done

15 of 43

Git & Github

16 of 43

Git

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

- GIT

Git allows for easy development of code:

  • Sharing code
  • Returning to previous versions
  • Parallel development through branches

It’s essential to each software development project:

-> If you are working alone or with millions of people

17 of 43

Git commands

GUI Options

Some important commands ( without branching )

  • Clone: Get a copy of an existing Git Repo ( Repository)
  • Status: see your current status
  • Log: Get the commit history
  • Add: stage and track files
  • Commit: Add the changes to the history
  • Pull: Get changes from remote repo
  • Push: Put your local commits on the remote

Github desktop

Visual Studio Code

Gitkraken

18 of 43

Git flow

Possible states of a file:

  • Untracked: you created a new file, not known to git. The changes are not saved to git.
  • Modify: you made a change in file, this modification is not tracked by git
  • Stage: to structure your commit, you can stage certain files
  • Unmodified: the file is saved and changes are tracked to git.

19 of 43

Git branching

Develop code on branch and merge

  • Master/Main branch is ‘stable’
  • Commands
    • Branch - Create a branch
    • Checkout - Change branch
    • Merge - Merge two branch
      • See later

20 of 43

Github

Platform to host repo’s

  • Allows to easily share your repo’s
  • Forking repo’s - Create a new repo from another repo
  • Can be combined with DevOps tools
  • Alternatives are Gitlab (open-source) and Bitbucket

21 of 43

Pull request

  • Branches allow for parallel development
  • At some point, you want your changes merged with main branch -> Have to be approved
  • Pull request:
    • Propose changes
    • Other people can check, comment, request changes and approve
    • No bugs on main branch

22 of 43

More resources

Become a master main of git(hub)

  • Progit: Extensive resource
  • Oh my git: Game to help you learn git
  • Code camp: Video by free code camp
  • Github docs

23 of 43

Coding tools

24 of 43

Linters

Checks your code for problems, and ‘bad’ code

Examples of linters for Python:

  • flake8
  • pylint
  • bandit
  • mypy

How to setup linter in VSCode:

Install python extension

Press ctrl+ shift + p and search for linter -> Select Python: select linter

Select flake8, it will install automatically

25 of 43

Formatters

Make the code look nicer

In visual studio:

Press Ctrl + Shift + P and search format -> Format document

If asked, select autopep8 and install

Auto format on save:

Press Ctrl + Shift + P and search preferences

set editor.formatOnSave on true

26 of 43

Typing

Python is dynamically typed -> It doesn’t know about the type until the code is run.

Can cause problems

  • Only crash when something wrong is done
  • Some methods work different for different types: ‘0’ + ‘0’ is not the same as 0 + 0

Use mypy to enforce the types -> visual studio code extension

Might not be supported enough in some cases

27 of 43

Debugger

Run the code and monitor all the variables, add breakpoints to stop running

To run the debugger in VSCode:

This replaces, putting print statements everywhere

28 of 43

Package Management

29 of 43

Package manager

Installing packages

Pip and Conda are the main ones

e.g. pip install numpy

Automatically manages the dependencies

Pip

30 of 43

Virtual environments

When doing multiple projects on the same computer it’s recommended to use virtual environments

Manage different versions of packages in this environment, sometimes new version will break your code

Export the installed packages to other people in a requirements file

Venv

Poetry

31 of 43

Pip + Venv

Create a virtual environment: python -m venv .venv

Activate the venv: source .venv/bin/activate or .venv/bin/activate.bat

Installing: pip install

Creating a requirements file: pip freeze > requirements.txt

Use an extension to make it easier to manage

Extension

32 of 43

Testing

33 of 43

A philosophical detour

Popper’s falsification theory

Every genuine test of a theory is an attempt to falsify it, or to refute it.

- Karl Popper

Short video explaining the idea

Test your software on all levels

Try to test outside the known limits of your software -> falsify it

Don’t assume it works, test it!

34 of 43

Unit tests

Test the individual units of the software

Use a testing framework like pytest

Basis of Test driven development:

Write tests before developing

35 of 43

Code coverage

  • How much of the code is actually tested
  • Can give you an idea of where to write new test
  • 100% does not mean all logical cases are covered
  • Use coverage.py

Coverage on wikipedia

Coverage.py

36 of 43

Documentation

37 of 43

Docstrings

Document a specific part of the code

  • Documents a function, class or module
  • In the source code
  • Creates help page: help(function)
  • Makes the life of other people using your code easier
  • Can be extracted to sphinx

Python example

38 of 43

Sphinx

  • Create intelligent and beautiful documentation
    • Export to latex
    • Or html
  • Hierarchical structure
  • If you have ever searched for python documentation, you most likely have seen Sphinx docs
    • Pytest, numpy…

Docker image

39 of 43

Command line

40 of 43

The what & why

What

A text interface to use your computer

Why

  • Sometimes nothing else is available (headless)
  • Frequent commands can be bundled in scripts
  • Faster than a GUI
  • Cool & fun

41 of 43

Some commands

Linux/ Macos/ Powershell

  • mkdir -> creates a new directory
  • mv -> move a file or rename it
  • cd -> Change directory
  • .. -> parent Directory
  • . -> Current directory
  • pwd -> print working directory
  • ls -> show files in current directory
  • | -> pipe pass output to next command
  • grep -> search ( for example git log | grep
  • cat -> show content files
  • vim -> open in Vim
  • cp -> copy
  • man -> manual page of command

Powershell

Linux (mostly MacOs)

42 of 43

Exercise

43 of 43

Feedback