{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Coding in Teams\n", "\n", "Collaborative coding is so essential to the process of solving interesting finance problems, that it underlies the [objectives](../about/objectives) at the front of this website. \n", "\n", "This page is focused on helping your teams attack the project in the most effective way. And it includes a few things that will push your existing GitHub comfort level up and make your team more productive. \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```{dropdown} **Q: How should you \"meet\"?**\n", "\n", "A: It's up to you! Be entrepreneurial and run your group as you all see fit. (WhatsApp, groupme, google doc, zoom, skype...)\n", "```\n", "\n", "```{dropdown} **Q: How should you approach working concurrently on the project?**\n", "\n", "A: You basically have three approaches:\n", "\n", "1. Sequentially divide tasks and conquer, e.g. Person A does part 1, Person B does part 2 after A is done. \n", " - _I.e. in asgn-05 we had three files: download_wiki, measure_risk, and analysis. You can split up your project in a similar fashion._\n", " - Main advantages: Specialization + this \"gives ownership\" to one person for each part\n", "2. Co-work on a task simultaneously: Persons A and B do a zoom share meeting and co code on person A's computer via screen share + remote control. Advantage: More brainpower, and good when the whole group is stuck. \n", "3. Separately attack the same task, then combine your answers: Persons A and B separately do part 1, and compare answers/approach, and put together a finalized solution to part 1. This creates duplicate and discarded work product, but will generate more ideas on getting to the solution. \n", "```\n", "\n", "```{dropdown} **Q: How do we work in the project repo \"at the same time\"?**\n", "\n", "The main issue is that two people might make conflicting changes. E.g., Johnny added a line to `data.py` but Cindy deleted a line from `data.py`.\n", "\n", "A: You have, basically, two approaches, and you might use both at different points of the project:\n", "1. **Free-for-all approach.** _Everyone works in the \"master\" branch of the repo all the time. This is what your default instinct might be. It can work, but you will probably have to fix merge conflicts to proceed at some point._\n", "1. **The \"branching\" approach.** _Basically, you create a clone of the \"master\" branch to work on, and when you've finished your changes, you create a \"pull request\" where you ask the main project's owner (you and your own team, in this case) to pull your branch's changes into the master branch. See the demo video below._\n", "```\n", "\n", "```{warning} Warning! Warning! Warning! \n", "\n", "**FOLLOW THESE RULES EVERY SINGLE TIME YOU WORK ON CODE OR DO ANYTHING IN THE REPO**\n", "1. BEFORE YOU START ANY WORK FOR THE DAY: Go to GH Desktop and \"Fetch/Pull\" origin\n", "2. WHEN YOU ARE DONE WITH A WORKING SESSION: Clear your code, rerun all, save file, then push to cloud\n", " \n", "If you forget to fetch/pull before you start (and someone made a change on the github repo since you last synced), or if someone is working at the same time (and pushes a change to the github repo that conflicts with a change you made), you are likely to receive a \"Merge Conflict\" notification from GH Desktop.\n", "``` \n", " \n", "```{admonotion} Other Recommendations and Advice \n", ":class: tip\n", "\n", "1. Your most experienced coder might be given \"CEO\" status over the repo and \"leads the way\" on pull requests and gives guidance on merge conflicts.\n", "2. Instead of putting the entire project in one ipynb file, structure the project like the latest assignment: \n", " - One code file to download each input needed, \n", " - One code file to parse/transform each input, \n", " - One \"get_all_data\" code file that, if executed, would run all files above\n", " - One code to build the analysis sample, explore it, and analyze it \n", "3. It's better to over communicate than under communicate, especially in our virtual world\n", "```\n", "\n", "
Collaboration as a group
\n", "\n", "**I would love your feedback on how you deal with the asynchronous work problem!** \n", "- Please let me know what issues/problems your group runs into\n", "- What solutions did you use (were they good or awful?)\n", "- If your group has an easy time, or finds something that works well, please let me and your classmates know! \n", "- Submit your experience on this via the discussion board " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Branching Demo\n", "\n", "```{margin}\n", "![](https://media.giphy.com/media/d7neiLOpRXaz5bueyd/giphy.gif)\n", "```\n", "\n", "\n", "\n", "Here's the side text from the video:\n", "\n", "- Open GH Desktop and create a toy repo\n", "- start new branch \"my work\"\n", "- add data/data.txt into folder (to simulate some work you've done)\n", "- see how GH Desktop sees a change?\n", "- click to try to switch branch (don't though)\n", " - it says \"leave changes on this branch or bring to master\" --> only the branch you're \"in\" can see/push changes you make\n", " - cancel\n", "- commit to branch\n", "- publish up to GH website\n", "- view on GH\n", " - switch branches to see the new files \n", " - compare: you're able to merge\n", " - can explain your argument for changes (to convince others to adopt in distributed projects), submit\n", " - merge, confirm\n", " - look at master branch - it should have data/data.txt\n", " - create \"cynthia_did_some_work.txt\" which says inside: \"while i was sleeping\"\n", "- go back to desktop like you're going to work on the project\n", "\t- go to master... pulling origin would sync it but dont\n", "\t- go to \"my work\" branch\n", "\t- fetch / update from master: this gets the cynthia file, and I can continue\n", " - push this new file back up to my own branch on GH's servers\n", " - make a new fake work file\n", " - publish/push \n", "\t\t- pull request\n", "\t\t- merge into main one more time" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" } }, "nbformat": 4, "nbformat_minor": 4 }