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
7
u/BruceJi 📦 Nov 05 '20
For a start, it gets easier with practice.
With that said...
Learning how to use functions will help you the most with that. Classes next (classes use functions so knowing functions will help you with classes!)
Here's a tip with functions:
The, er, function of functions is twofold:
First, if you know you'll need to have the same process being performed multiple times in your code, put it in a function.
Second, if you can see a process sort of sits really neatly on its own, and that if it were tucked away and in the code all you saw was the call to get the results from that part of the code, that's another thing that could become a function.