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
5
u/FloydATC Nov 05 '20
There's nothing wrong with "dumpster fires" of code, we all write them sometimes; huge functions with 18 indentation levels and logic that came to you in a 3AM insomnia-induced hallucination, as long as 1) it does what you want, and 2) you understand you only just got started.
Now that the code finally WORKS (sort of), it's time to change it into code you can work WITH.
Watching a few YouTube videos of Uncle Bob talking about "clean code" will get you started down the right path, and it's much more fun than it sounds. He can be a little extreme, but you don't necessarily have to take things 100% literally to reap the benefits.