

Ask HN: Do you try to code "proper" even on the first pass? - keeptrying

Ask HN: On the first pass of coding something, do you hack it till you get something working or structure it well?
======
byoung2
I 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
Good point. But I meant working as in "your eyes only"

~~~
byoung2
Gotcha...on my own projects I write very clean code, because there is never a
shortage of time.

~~~
keeptrying
Is that optimal when feedback is more IMp like early stage startup?

------
noonespecial
I 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.

------
damoncali
My 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
'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
I 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
You 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

