Why and when is it beneficial to just throw away all your code and start from scratch.

The motivation

Some time ago, I read this article.

TLDR - when you are building something new, that you don’t know that much about, it is a very good idea to spend a few days building and exploring the domain and technologies around it and then throw it away and start from scratch with a clear view of what you are actually building.

I just finished building a minimal prototype of my blog:

  1. I entered an article to DynamoDB table

  2. DynamoDB threw the record into a stream

  3. A python lambda function listening on the stream catched the records, transformed markdown content to html and compiled the record into json and published to a publicly accesible S3 bucket. It then regenerated the table of content in another file.

  4. A Vue based web app fetched the table of content, constructed a menu from it and each menu item linked to an article, which downloaded the proper article in json format and displayed it.

What am I throwing away

The only part that I am 100% satisfied with is the DynamoDB table. Everything else has its flaws and is worth a lot of refactoring. Even better, it is worth throwing away and doing again cleanly, now with a much better image in my head what do I want to really build.

P.S.

As the main purpose of this blog is learning and the building process itself, I am probably building just another prototype and I already know what new technologies I want to try to learn during the second prototype building. As a matter of fact, I may never stop building prototypes again and again, until another interesting project enters my mind and this blog will be left neglected in the depths of the internet.