

Ask HN: How clean is your startup code? - d0m

So we all know it's important to go public as fast as possible. I was wondering.. how clean is your code?<p>Do you have 10 php files with 5000 lines each? Or some ruby codes with lots of tests? Do you comments a lot? How is your inter documentation? What if someone joins your startup.. how easy will it be for him/her to catch up and understand the code?
======
byoung2
_So we all know it's important to go public as fast as possible_

That makes it all the more important to write clean, well-documented code. I'm
an OO PHP developer, I use an MVC framework I developed myself (similar to
Symfony, based on the Doctrine ORM, using Smarty for templates). I tend to
write self-documenting code, e.g. Website::listAllByUser($id), but I comment
extensively anyway. It would be very easy to get a decent programmer up to
speed on any of my projects in under an hour.

------
AmberShah
It's important to go fast, which is why you need clean code. To be fair, my
startup code isn't the best code that I've ever worked in, but it is solid and
tested.

By the way, comments are crap in any kind of software. They are out of date
and useless like a minute after they are written. 9 times out of 10 when I
come across one in other code I delete it.

------
cperciva
I like to think that my code is pretty clean, but that might be observer
bias... but download the Tarsnap code from <https://www.tarsnap.com/> and let
me know. :-)

~~~
d0m
I gave it a look and yeah, it's pretty clean for such low level C.

~~~
cperciva
_clean for such low level C_

Do you think it would be cleaner if it was in perl?

~~~
d0m
Just to be sure, I wasn't talking about C being low level but more about the
stuff you were doing _with C_ that was low level. I could have said: Clean for
such low level Scheme or Clean for such low level Perl.

------
damoncali
My code falls into three categories:

Pretty clean: this is stuff that has actual people using it _and_ is critical
to the business.

Not so clean: stuff that is new, tangential, or experimental. I don't bother
refactoring this type of code for one reason - it may end up in the third
category...

Deleted: This is stuff that didn't work and isn't worth keeping or is obsolete
for one reason or another.

So in a nutshell: launch before you refactor, refactor before it breaks. Lots
of great coders hate this.

------
tablet
My code was not bad, but not superb. There was good architecture behind and a
hundred of unit tests, but still time to market was top priority. So it was
good enough and I think it is a waste to write perfect code for startup, since
future is unknown.

When product proofs itself, it is time to refactor and maintain perfect code
base.

------
x0ner
My code could be a lot better, but it works for what I needed at the time. I
do wish I spent more time making it clean and organized, but the reality is
that I am going to do a rewrite anyway. Pumping out the initial version gave
us first dibs in the space, so having unclean code really didn't hurt us.

------
fleitz
It's pretty clean, I want to move to continuous deployment as soon as
possible, right now I have automated deployment, but it's not continuous.

I think a great code base is essential to being able to pivot and iterate. I
don't think a startup can afford much technical debt unless you are using the
VC rocketship model and taking on tonnes of real debt / loss of equity anyway.

