Live data from Hacker News

Throw away your first draft of your code

ntietz.com

11–20 of 230 posts

Re: Throw away your first draft of your code

#11

Justify wasteful things you've done and suggest them to others. Less cheekily -- it's true that sometimes the best way to research a topic is by writing code that you might appropriately throw away later. And it is extremely important to be able to recognize when something is not worth keeping. But also, often, the most efficient strategy is to think about the problem off-screen enough that you don't subsequently was…

Often happens that you can't see the next hill until you get to the top of the current hill

Re: Throw away your first draft of your code

#12
I've felt this, and I agree. It really pays of to do some work on technical discovery, make all the mistakes, see where all the design issues will be, validate as much as possible, and then start again. And the best way to really scope out requirements and get to know the "unknowns" is really to get your hands dirty.

Especially when in comes to business logic and domain modelling, some bad decisions at the begining can cost a LOT, to undo in an iterative matter.

(To clarify I'm talking about the timeline the author proposes of "a couple of days" build the throw away prototype)

Re: Throw away your first draft of your code

#15
post #10

The temptation to throw away all of your code - be it a prototype or a "grown" code base - arises often. Often it is a bad idea. I get it, though, there is an inherent attractiveness in the idea of starting fresh from a clean slate. Except, more likely than not, you'll soon find yourself in a similar situation to the one you started from. The fundamental problem is that it is easy to underestimate the edge cases. Sur…

[deleted]

Re: Throw away your first draft of your code

#17
Throw away 1st, second, third, etc... Write your code in small replaceable/disposable POCs until at some point the architecture and coherence starts to take shape.

That's the advantage of software over other work. You have 0 material sunk costs. Unlike building a bridge, which you can't just tear down and iterate, with software you can develop a workflow where you break things and iterate quickly.

Re: Throw away your first draft of your code

#18
post #3

The idea of prototyping to uncover 'unknown unknowns' resonates with me, it's like a reconnaissance mission before the actual project. This could indeed save a lot of time and effort in the long run...

Just never let management see the prototype or they'll consider it done and tell you to move on to something else.

In my experience, this is what actually happens. A developer makes a low-quality, low-effort prototype under the assumption it won’t ship. Someone sees it. It gets shipped. Everyone loses.

Re: Throw away your first draft of your code

#19
Exactly what I thought after GPT3.5 was released. "Delete it all. Start from scratch. You'll learn so much. You'll do so much better. You'll actually live up to the scale of your creations' potential."

But a decision like that would be superhuman by itself, a transcendent experience, giving the creators a perspective that seems impossible. Unlike what is happening instead, both publicly and behind closed doors... A great pity!

Re: Throw away your first draft of your code

#20
I've never had luck with this approach. For me, iteratively building and changing the codebase as new requirements come up lends itself to having to think of good ways to modularize and future proof. The idea of throwing out the code and starting over is definitely appealing, but often the iterative approach gives me something I'm super happy with.

I think I do use the throwaway approach with simple prototyping of smaller portions of code that I will then port into an existing system, but the overall system remains stable.

Post reply on HN