DEV Community

Discussion on: What is Perfect Code in your heart?

Collapse
 
peteryuan profile image
PeterYuan

I can't agree with you anymore, that's absolutely right about clean code's importance. though i know there is no perfect. But as a coder ,i always request myself, do my best to code less, that means i will try my best to remove any useless code from program, until i can't remove anything. That's my "perfect" standard, just like write essay, less words to express your meaning and make others understand.Of course, works rightly too.

Collapse
 
djnitehawk profile image
Dĵ ΝιΓΞΗΛψΚ • Edited

in addition to everything you guys mentioned, I always try to think of it from a performance perspective as well. how well this code will scale, am I doing unnecessary allocations, am I blocking threads, am I doing unnecessary context switching, needless locking, etc. also I try not to hypnotise myself with popular design/code patterns just because they're hip. if I ever pick something up, I always ask myself the question WHY? and if I can't come up with a good answer, straight to the trash bin it goes. the only principle i follow religiously is KISS. if you can understand your own code after 5 years then you've done a good enough job.