The Rewrite Trap

Rate this content
Bookmark

Let's throw away everything and start fresh. Sounds great, right? While this can feel very good it rarely speeds up anything. I'll show you why a complete rewrite is usually not what you want.

Philipp Giese
Philipp Giese
22 min
09 Mar, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

The Talk discusses the 'rewrite trap' in software development, where the urge to start from scratch often leads to poor outcomes. It emphasizes the importance of understanding the existing project before making big technical decisions and the benefits of gradual improvement. The Talk also highlights the challenges and pitfalls of a complete rewrite, such as false sense of productivity, problems with edge cases, and the accumulation of tech debt. It stresses the need to understand the system and its influences, cater to the needs of stakeholders outside of engineering, and focus on creating value.

Available in Español: La Trampa de la Reescritura

1. The Rewrite Trap

Short description:

Hello, everyone. My name's Phil. I'm a software engineer at Brighter. Today I'd like to talk to you about a thing I call the rewrite trap. The urge to start from scratch often comes from not wanting to learn new concepts, not aligning with the existing architecture, and the desire to work in a way that aligns with personal preferences. However, these reasons rarely pay off in the long run. It's important to take the time to understand the existing project before making any big technical decisions. The trap lies in the belief that a complete rewrite will lead to better outcomes, when in reality, gradual improvement is often a more effective approach.

Hello, everyone. My name's Phil. I'm a software engineer at Brighter. I've been a tech lead before and also a CTO, even though I got fired from that job, more on that later.

And today I'd like to talk to you about a thing I call the rewrite trap. And first, before we start, let me set the stage. So what kind of rewrite are we talking about? It's definitely not the one where you know the project for months or years. You're super familiar with all the ins and outs, the tech, the architectural decisions, all of that, and you're absolutely sure what you need to do in order to get this, you know, off the ground, right? Maybe even there is a new project, right? And you actively make the decision to not stick with the current stack or the legacy platform or whatever, but start from scratch, right? This is not what this talk is going to be about, right? Because I think the read-write or the starting from scratch might be the best option. I'm talking about the situations where you, you know, might be the new tech lead in town, right? Or the new CTO in town. You join a company that has an existing product. There is a stack, there is software there. And you kind of have that feeling that after, you know, looking at it for, I don't know, one or two days, you just think that it's better off, you know, throwing away everything and starting over, right? This is what this talk is going to be about, right?

So, let's start with where does that urge come from? And I think there are three main reasons. The first one is you don't need to learn new concepts, right? So, let's for instance say it's a client application, it's written in React, but you, you know, you like Vue or you like Svelte or whatever better, right? And getting into React, you immediately have that repulsive feeling that you really don't want to get into this, right? So, if you throw it away and rewrite it in your stack of choice, then, you know, that would make that problem go away. It's the same for, you know, programming languages, methodologies, whatever, right? So, everything that you're not used to you kind of immediately say maybe let's not do that. The second thing also is someone else built that, right? So, if you really like a certain architecture, let's say for instance you really dig functional programming, but the current product is built in a very object oriented fashion, then, ha, you know, those two worlds might not align so well, right? And, it always, you know, would feel like, you know, a hurdle to get acquainted with everything, right? And, you might already notice there's a pattern here. And, the pattern is not that necessarily, you know, tech choices, programming languages choices, architecture choices are better or worse. It's just that they're different and that, you know, intrinsically, if something is different to what we prefer, we, you know, have to fight that urge to just, you know, throw it away and, you know, turn it into something that we like. And a colleague of mine once gave me the advice to wait 100 days until you make any bigger technical decisions once you join a new job, right? Because, in 100 days, you can learn a lot and also, you can figure out whether something, you know, you know, a choice from the past is actually worse than what you wanted to, you know, wanted to use. Like, is it, you know, a problem that it's object oriented? Should it be functional? Or whether this was just, you know, your initial gut reaction to a certain thing and you just didn't like it, you know, before, but probably 100 days in, you also got used to it and then maybe it's not that bad anymore. Personally, I have to admit, I always, shortened that period to 50 days. Because especially when I was CTO, I couldn't convince my CEO to just wait, you know, almost a third of a year before I started making bigger choices. Let's just start up life and you gotta, you know, do what makes sense at the time.

Now let's get to the third part. And that's the biggest egomaniac part of it, right? If you just throw away everything, you can essentially work the way you want, right? You make up all the rules. So this definitely feel comfortable, right? The big question to ask here is just, you know, will that, you know, is that, is that something that makes sense in the long run, right? Is your way of working, for instance, compatible with how the company works? Right. And yeah, you know, all of these things that I just outlined, kind of feel initially, maybe like good reasons to start from scratch, right. And we can definitely talk ourselves into, you know, assume benefits of either one of these. But the question is, do they really pay off? And I think they rarely do. And this is also where the trap comes in because initially, if we look at these projects, so I've drawn two made up lines, essentially, you know, the green line representing a, you know, existing software project and you don't rewrite it, but you try to gradually improve it, you know, work your way through the project and you know, make it better. And the purple line represents the complete rewrite and the X's are just time on the X axis and the Y axis is outcome.

2. The Rewrite Trap: False Sense of Productivity

Short description:

If you start a rewrite, nothing's there, nothing's holding you back. You can push out a lot of stuff in the beginning really fast. The people who stick with the existing code and try to gradually make it better first have to go through the weeds, learn the architectural choices, and gradually improve the running system. That false sense of productivity in the beginning leads people to making those rewrite choices.

Like how much can you actually achieve? And obviously if you start a rewrite, nothing's there, nothing's holding you back. You can push out a lot of stuff in the beginning really fast. So you could even then fool yourself into thinking, wow, this must have been the better choice. We're so fast. Everything's moving fast. That's great, right? Well, you know, the people who would stick with the existing code and try to gradually make it better first, you have to go through the weeds, learn the architectural choices, you know, see what's there and gradually improve the running system, essentially. And this is where the trap comes in, really, you know, that false sense of productivity in the beginning, is what I think leads people to making those rewrite choices. And I give you a hint, maybe it's also good for your career to do this, right? Because like, I don't know how long, you know, the phases of one, two, and three are. But if you leave in phase one, or at the end of phase one, all you've done so far seems very productive. You've done a great job. So you might be the, you know, the really good tech lead that just gets things done and that just does the things no one else wanted to do. And it helps you progress, you know, maybe do that if it's good for you, but I am not that person.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

A Framework for Managing Technical Debt
TechLead Conference 2023TechLead Conference 2023
35 min
A Framework for Managing Technical Debt
Top Content
Let’s face it: technical debt is inevitable and rewriting your code every 6 months is not an option. Refactoring is a complex topic that doesn't have a one-size-fits-all solution. Frontend applications are particularly sensitive because of frequent requirements and user flows changes. New abstractions, updated patterns and cleaning up those old functions - it all sounds great on paper, but it often fails in practice: todos accumulate, tickets end up rotting in the backlog and legacy code crops up in every corner of your codebase. So a process of continuous refactoring is the only weapon you have against tech debt.In the past three years, I’ve been exploring different strategies and processes for refactoring code. In this talk I will describe the key components of a framework for tackling refactoring and I will share some of the learnings accumulated along the way. Hopefully, this will help you in your quest of improving the code quality of your codebases.

Debugging JS
React Summit 2023React Summit 2023
24 min
Debugging JS
Top Content
As developers, we spend much of our time debugging apps - often code we didn't even write. Sadly, few developers have ever been taught how to approach debugging - it's something most of us learn through painful experience.  The good news is you _can_ learn how to debug effectively, and there's several key techniques and tools you can use for debugging JS and React apps.
Fighting Technical Debt With Continuous Refactoring
React Day Berlin 2022React Day Berlin 2022
29 min
Fighting Technical Debt With Continuous Refactoring
Top Content
Let’s face it: technical debt is inevitable and rewriting your code every 6 months is not an option. Refactoring is a complex topic that doesn't have a one-size-fits-all solution. Frontend applications are particularly sensitive because of frequent requirements and user flows changes. New abstractions, updated patterns and cleaning up those old functions - it all sounds great on paper, but it often fails in practice: todos accumulate, tickets end up rotting in the backlog and legacy code crops up in every corner of your codebase. So a process of continuous refactoring is the only weapon you have against tech debt. In the past three years, I’ve been exploring different strategies and processes for refactoring code. In this talk I will describe the key components of a framework for tackling refactoring and I will share some of the learnings accumulated along the way. Hopefully, this will help you in your quest of improving the code quality of your codebases.
Building a Voice-Enabled AI Assistant With Javascript
JSNation 2023JSNation 2023
21 min
Building a Voice-Enabled AI Assistant With Javascript
Top Content
In this talk, we'll build our own Jarvis using Web APIs and langchain. There will be live coding.
Power Fixing React Performance Woes
React Advanced Conference 2023React Advanced Conference 2023
22 min
Power Fixing React Performance Woes
Top Content
Next.js and other wrapping React frameworks provide great power in building larger applications. But with great power comes great performance responsibility - and if you don’t pay attention, it’s easy to add multiple seconds of loading penalty on all of your pages. Eek! Let’s walk through a case study of how a few hours of performance debugging improved both load and parse times for the Centered app by several hundred percent each. We’ll learn not just why those performance problems happen, but how to diagnose and fix them. Hooray, performance! ⚡️
Monolith to Micro-Frontends
React Advanced Conference 2022React Advanced Conference 2022
22 min
Monolith to Micro-Frontends
Top Content
Many companies worldwide are considering adopting Micro-Frontends to improve business agility and scale, however, there are many unknowns when it comes to what the migration path looks like in practice. In this talk, I will discuss the steps required to successfully migrate a monolithic React Application into a more modular decoupled frontend architecture.

Workshops on related topic

Building a Shopify App with React & Node
React Summit Remote Edition 2021React Summit Remote Edition 2021
87 min
Building a Shopify App with React & Node
Top Content
WorkshopFree
Jennifer Gray
Hanna Chen
2 authors
Shopify merchants have a diverse set of needs, and developers have a unique opportunity to meet those needs building apps. Building an app can be tough work but Shopify has created a set of tools and resources to help you build out a seamless app experience as quickly as possible. Get hands on experience building an embedded Shopify app using the Shopify App CLI, Polaris and Shopify App Bridge.We’ll show you how to create an app that accesses information from a development store and can run in your local environment.
Build a chat room with Appwrite and React
JSNation 2022JSNation 2022
41 min
Build a chat room with Appwrite and React
WorkshopFree
Wess Cope
Wess Cope
API's/Backends are difficult and we need websockets. You will be using VS Code as your editor, Parcel.js, Chakra-ui, React, React Icons, and Appwrite. By the end of this workshop, you will have the knowledge to build a real-time app using Appwrite and zero API development. Follow along and you'll have an awesome chat app to show off!
Hard GraphQL Problems at Shopify
GraphQL Galaxy 2021GraphQL Galaxy 2021
164 min
Hard GraphQL Problems at Shopify
WorkshopFree
Rebecca Friedman
Jonathan Baker
Alex Ackerman
Théo Ben Hassen
 Greg MacWilliam
5 authors
At Shopify scale, we solve some pretty hard problems. In this workshop, five different speakers will outline some of the challenges we’ve faced, and how we’ve overcome them.

Table of contents:
1 - The infamous "N+1" problem: Jonathan Baker - Let's talk about what it is, why it is a problem, and how Shopify handles it at scale across several GraphQL APIs.
2 - Contextualizing GraphQL APIs: Alex Ackerman - How and why we decided to use directives. I’ll share what directives are, which directives are available out of the box, and how to create custom directives.
3 - Faster GraphQL queries for mobile clients: Theo Ben Hassen - As your mobile app grows, so will your GraphQL queries. In this talk, I will go over diverse strategies to make your queries faster and more effective.
4 - Building tomorrow’s product today: Greg MacWilliam - How Shopify adopts future features in today’s code.
5 - Managing large APIs effectively: Rebecca Friedman - We have thousands of developers at Shopify. Let’s take a look at how we’re ensuring the quality and consistency of our GraphQL APIs with so many contributors.
0 To Auth In An Hour For Your JavaScript App
JSNation 2023JSNation 2023
57 min
0 To Auth In An Hour For Your JavaScript App
WorkshopFree
Asaf Shen
Asaf Shen
Passwordless authentication may seem complex, but it is simple to add it to any app using the right tool.
We will enhance a full-stack JS application (Node.js backend + Vanilla JS frontend) to authenticate users with One Time Passwords (email) and OAuth, including:
- User authentication – Managing user interactions, returning session / refresh JWTs- Session management and validation – Storing the session securely for subsequent client requests, validating / refreshing sessions
At the end of the workshop, we will also touch on another approach to code authentication using frontend Descope Flows (drag-and-drop workflows), while keeping only session validation in the backend. With this, we will also show how easy it is to enable biometrics and other passwordless authentication methods.
Build a Collaborative Notion-Like Product in 2H
JSNation 2023JSNation 2023
87 min
Build a Collaborative Notion-Like Product in 2H
WorkshopFree
Witek Socha
Witek Socha
You have been tasked with creating a collaborative text editing feature within your company’s product. Something along the lines of Notion or Google Docs.
CK 5 is a feature-rich framework and ecosystem of ready-to-use features targeting a wide range of use cases. It offers a cloud infrastructure to support the real-time collaboration system needs. During this workshop, you will learn how to set up and integrate CK 5. We will go over the very basics of embedding the editor on a page, through configuration, to enabling real-time collaboration features. Key learnings: How to embed, set up, and configure CK 5 to best fit a document editing system supporting real-time collaboration.
Table of contents:- Introduction to the CK 5 ecosystem.- Introduction to a “Notion-like” project template.- Embedding CK 5 on a page.- Basic CK 5 configuration.- Tuning up CK 5 for a specific use case.- Enabling real-time editing features.