4 ms·
Ask HN: Do you try to code "proper" even on the first pass?
Ask HN: On the first pass of coding something, do you hack it till you get something working or structure it well?
- byoung2 15y agoI write code as cleanly on the first pass as I do on the last (if there ever is a last). The reason being that if I hacked it and then showed the client/my boss that it's working, it would be hard to justify the additional time to clean it up when they want it pushed to production now.
- keeptrying 15y agoGood point. But I meant working as in "your eyes only"
- byoung2 15y agoGotcha...on my own projects I write very clean code, because there is never a shortage of time.
- keeptrying 15y agoIs that optimal when feedback is more IMp like early stage startup?
- noonespecial 15y agoI blast put the most bogus half-witted garbage that could possibly half work, train of thought style. It just embarrassingly bad. I go back and clean it up almost immediately while it's still fresh in the mind. The upside is that I usually find I need only 1/3 of what I thought I needed. It doesn't feel quite so bad to throw out huge chunks of stuff I know is so bad I wouldn't want anyone to see it anyway. The worst thing in a project is something I think is really clever but just not needed. I become irrationally attached.
- deleted 15y ago[deleted]
- damoncali 15y agoMy code starts and stays embarrassingly bad until I need to refactor it. Eventually, the code improves. Very often, though, it gets thrown out entirely. Only profitable code deserves to be good. Caveat: The above applies to my own business projets where I am the sole coder. I write better code for clients - it still starts out rough, but I refactor more frequently.
- mikemaccana 15y ago'Properly'. But yes, otherwise I find I don't have time to fix it later. Occasionally, when I know there's a better way of doing it but am having trouble thinking of it immediately I throw a # TODO in there.
- SoftwareMaven 15y agoI always try to code cleanly. If there is learning going on, I may not feel it is clean at the end, but it wasn't from lack of trying.
- ristretto 15y agoYou should not have a second pass it's a huge time waster. I like taking the extra time to optimize everything from the start. Maybe I won't finish my project within an hour, bu extra time helps as more ideas come to mind while coding