Skip to content

Instantly share code, notes, and snippets.

@EwoutH
Last active November 20, 2023 16:58
Show Gist options
  • Save EwoutH/86000071767daead4ce50c49a961cb66 to your computer and use it in GitHub Desktop.
Save EwoutH/86000071767daead4ce50c49a961cb66 to your computer and use it in GitHub Desktop.
SEN121 Programming workshop outline
Short introduction:
- Who am I?
- What's the goal of this session? --> Introduce you to some of the most usefull programming tools
- Why? To understand complex systems, we create models. To create models, we need to program.
- Collaboration, version tracking, documentation and transparency --> Git
- Error free (and working in general): Debug
- Validated and robust: Tested
- Three tools: Git, pytest and a debugger with breakpoints
Tool #1: Git
# History
- There was a guy called Linus Torvalds. He was developing that thing called the Linux Kernel (Android phones, every server and supercomputer in the world)
- BitMover Inc had a popular thing called BitKeeper. In April 2005 they revoked the free source-control management (SCM).
- Within the month Linus finished developing git
Now over 95% of developers use it as their primary tool.
GitHub: A platform and cloud-based service build on git
GitHub Desktop: A graphical user interface to interact with git.
# Demo
- Create a new repository
- Open it in GitHub Desktop
- Open it in PyCharm
- Add hello world function
- Commit.
- That's not really inclusive hello multiverse!
Advantages:
- Each line of code is automatically documented in git history, transparent and accountable.
- Forces you to think in cycles: Build, review, test
# Jump to existing, bigger lab project:
- How to do it in a bigger project:
- Check what's needed. Communicate what you're doing
- Create a branch and start working on it
- Review and commit
- Open an PR
- Process review
- Merge it.
# PRACTICAL: Implement a feature yourself! Checkout the GitHub: https://github.com/EwoutH/SEN1211-lab
# Review: Show a review
# PRACTICAL: Write a review
# Omar has left a review on my feature! What, he wants tests?
- Short intro into unittesting
- Write an unittest
- Run pytest
- Add to branch
# PRACTICAL: Add some test to your feature
- Second review
# Then, oh no, my test fail! Let's debug them.
- Show the debugger
- Show breakpoints and stepping through them
- Fix the bug
# Sometimes you can turn it around: Write the tests first, then the feature.
- Design to spec
- Really nice feeling if you ace it
# End with merging some pull-requests and creating a release.
# Recap: You can now collaborate with anyone!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment