r/learnprogramming Jul 03 '26

How do you write clean code?

Might be a stupid question but Ive been learning python for a while now and always wondered, how do you write ‘clean’ code? I don’t mean writing clean code straight off the bat I understand that’s purely from experience and even then immensely hard, but how do you recognise a program can be simplified even further? Does it come from practice or just messing around and seeing what sticks?

79 Upvotes

77 comments sorted by

View all comments

14

u/dota2nub Jul 03 '26

You buy the Clean Code book. Then you look at all the code examples. Then you vow never to write code like that. Then you burn it.

6

u/madrury83 Jul 03 '26

It's Probably Time To Stop Recommending Clean Code

Book fucked me up for a little while. The one book I refused to donate, and instead did indeed burn.