3
My friend saw my messy code and called it 'spaghetti in a text file'
They said if I can't read it in a month, I've failed. Now I write comments after every 10 lines, no matter what. How do you keep your beginner projects from becoming a total mess?
2 comments
Log in to join the discussion
Log In2 Comments
hart.parker18d ago
Back in my first Python script I had a variable just called "data". Three months later I opened it and had no clue what that data actually was. Now I force myself to write the function name and variable names first, before any code. If I can't name it clearly, I don't understand the problem well enough to write it. Names like "clean_user_input" or "calculate_tax" make the code explain itself. Comments are a last resort for the weird stuff.
4
mitchell.daniel17d ago
Man, that sounds like a lot of work for a hobby. My old scripts are a mess but they still get the job done.
5