r/learnpython • u/TheGrapez • Nov 05 '20
How does one learn to make well-structured programs? Mine are dumpster-fires.
So I just (kind-of) finished reading Automate The Boring Stuff With Python, and for the past month I've felt like a big-brained super-hero automating myself out of a job (Data Analyst).
The problem is, I feel I missing something along the way. I don't understand the proper way to use functions, what a class is, why people have multiple files in a program, how/why people use GitHub...probably some other things I haven't discovered yet.
They all seem to be related to organization? Is there a "How To Structure Your Python Stuff With Python" book?
478
Upvotes
6
u/funkless_eck Nov 05 '20
"Why and how do people use github"
This baffled me for a long time too - then I started using it myself to teach myself. Its really opaque because of the jargon but the basic concept is this:
(I will get some things wrong - im a beginner too - looking forward to feedback on what I mucked up)
You have a folder on your computer like c:/users/joe/documents/code/
You want everyone working with you to see it and be able to comment and make suggestions on it
but you don't want them changing it permanently and be able to undo their changes
Enter github. You make a repo / repository. This is a copy of /joe/documents/code. When you make changes to it (you make the background blue) github asks you to name this ("the great blue background change") and commit to this being the latest addition.
then you want to push this commit -ed changes to the online copy of your code folder (your repo)
but Katie thinks the background should be green - so she makes a branch of the code folder, commits the green changes and pushes them online
you all look at the green and blue versions and decide to go with green so you merge that back into the main branch of your repo. (Main used to be called "master" but they're working to drop the slave/master connotations)
to carry on using the green background you pull the merged branch of the repo to your local machine. But it stays on the remote online version