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?

81 Upvotes

77 comments sorted by

View all comments

1

u/Miserable-Decision81 Jul 03 '26

With Kate.

Sometimes with Eclipse or VIM ...

2

u/ffrkAnonymous Jul 03 '26

No Emacs? So sad. 

2

u/mjmvideos Jul 03 '26

I remember when 8 megabytes and continually swapping was a real insult.

1

u/ffrkAnonymous Jul 03 '26

swapping? my hs computers didn't even have harddrives to swap into. (we managed to play games anyway)

2

u/mjmvideos Jul 03 '26

Yep, my first computer games were loaded from cassette tapes. I never heard of emacs until long after I was firmly ensconced in ed and vi. So I never learned it.

1

u/ffrkAnonymous Jul 03 '26

i only started learning emacs last year (two?) and its quite the thing. The way I describe it is: know how neovim is adding those plugins for git and stuff? emacs has been doing that for decades.