Hacker News new | ask | show | jobs
by beardedetim 1620 days ago
This is expressing something I've been trying to express for _years_. I've come to call it "throw away code" instead of "shitty code" because of what's happening in the comments: people always came back to me and said "Shitty code doesn't work!" and we get into an argument about what I mean by shitty code.

I find that throw-away code gets my point across much more cleanly without people's objections being raised immediately. Most engineers understand that when I say "throw-away code" it doesn't mean the code doesn't work. It just means that I can _throw it away_ when I need to later. It is "shitty code" because it's _supposed_ to be replaced.

2 comments

I believe it was Casey Muratori said "first: write the stupidest thing that will work". Meaning, it's code that is obvious and simple and does what you think you want to do. It doesn't have to be efficient, or flexible, it just has to do the job. Later you can change and/or improve it if need be.
> It doesn't have to be efficient, or flexible, it just has to do the job. Later you can change and/or improve it if need be.

I think the reality, though, is that that day never comes. Usually if something works, it will never be replaced. So the real trick is writing something that finds a perfect balance between "just works" and "elegant/aesthetic/maintainable/readable".

I do this too — and feel like “throw-away code” is a great moniker for it!