Don't rewrite, reimagine
If you are going to go down the path of a rewrite, don't just recreate what is there. Reimagine what is possible given what you know now.
I have written about my thoughts on rewrite versus refactor in the recent past. Recent events have kind of added a little nuance to that. I wanted to explore that in this post in the hope of generating some more conversation around this decision that many of us often face.
The Spark
What immediately made me reevaluate my thoughts on rewrite versus refactor was a series of posts by Allen Holub. Allen was reacting to Musk's post about rewriting Twitter. Allen wasn't defending Musk (he like me is not a Musk fanboy). He was making the point that starting from scratch again is not always a bad idea. In fact, it can be an opportunity to do something better.
Don't Drag The Past Into The Future
There is some really careful framing here. Once you decide to start from scratch, you have an opportunity. You can unshackle yourself from past ideas, decisions, and limitations and really create something new. You can not just rewrite but reimagine the system. The trick is that when you start from scratch, don't just throw away the code, but also all the old ideas and notions about what it should and shouldn't do. You can write the system the way you would do it with all the technology and knowledge available now.
I got approached recently about upgrading a system written in LabVIEW 4.0. That system is at least 20 years old. Technology has changed a lot in 20 years. A lot of the assumptions and limitations that went into designing and building that system are no longer valid. If we were to design that system today it would look totally different. Why would we want to simply recreate the past when there is an opportunity to create something better?
An Example
As a more concrete example, one of the first jobs I got when I set up my own company was making some upgrades to a soil sample tester. It took some soil samples and performed some chemistry analysis on them. There was lots of mud and water involved and the electronics didn't really like that. So the mechanical engineer redesigned some of the mechanical parts to keep the mud and water away from the electronics. Unfortunately, that required some changes to the software and the original designer of the software was unavailable, so this job fell into my lap.
The User Experience
So I went out to observe how the machine was used. The UI was not very intuitive. To start the machine the user had to switch between a bunch of tabs and toggle switches on various tabs and verify certain parameters on other tabs before continuing to switch more buttons on a different tab. The controls were laid out based on the hardware type. All the motors were on one tab, the pumps were on another, the limit switches were on yet another tab, etc. The machine however was laid out in stations. There were several stations that the sample passed through before it came out on the other side of the machine. Each station operated fairly independently. So there was a mismatch between the UI and the actual layout of the machine that made it difficult to use.
What to do?
I looked at the underlying software and it needed some attention. It wasn't the worse designed software I had seen. There was a method to the madness, but to make the changes I needed to make to the software, it needed some major architectural changes. I made the decision to rewrite it. I'm still not sure that was the best decision, even though the project worked out in the end. Never judge a decision based on the outcome, only on what you knew at the time. However I ended up at the decision to do a rewrite, that is what I decided.
A Reimagined User Experience
I could have just rewritten the underlying software and kept the UI the same. The changes to the software were pretty minimal, just changing the direction on some of the motors and swapping out some hardware drivers. There was also some sample tracking in a database that was added. I could have just left it at that and left the UI the same with maybe a few minor tweaks.
Instead, I saw an opportunity to improve the UI. I was able to break the GUI up into 1 tab for each station. I used some graphics to better indicate the position of the various motors and various limit switches, so the user could tell at a glance what was going on at that station. I made starting the machine much simpler - just a single button press instead of multiple. The machine now just automatically homed all the motors and verified all the correct parameters itself. I also got rid of the dull grey LabVIEW controls and added a little color. The results speak for themselves. Here's what the customer had to say:
Doing More Than The Bare Minimum
If I had just done a rewrite of the underlying software and kept the user experience the same, I would have fulfilled the contract. I would have done what they hired me for. Yet the end user would still have a poor user experience. Instead, I was able to bring a little bit of joy into their work. As a reward, I got a nice glowing review that I might not have gotten otherwise.
Don't Waste The Opportunity
Next time you are leaning towards a rewrite, don't just simply replicate the existing user experience, reimagine it. Don't waste the opportunity to create something better!