good Monday morning I’m MP J and this is
fun fun function today I want to talk
about rewrites and the thing about
rewrites is that every single time I
encounter a new codebase take over
something at work I immediately want to
do a rewrite
that is what my brain tells me to do
pretty much 100% of the time a rewrite
is what my brain tells me must be done
and this is one of those situations
where I feel like my my intuition very
consistently fails me because it is
almost never appropriate
wha-ho to do a rewrite I don’t mean to
imply that there are never situations to
do rewrites but almost never it is
really very rare that you find yourself
in a situation where you genuinely need
to do a rewrite and this creates a
problem because my brain thinks it’s
appropriate to do rewrites in 100% of
the cases and in reality it is more like
it’s 1% of the cases so whenever my
brain tells me that this is time this is
now it’s the time for a rewrite it will
be wrong in 99% of the cases so today I
want to talk a little bit about why I
think this happens first I think it’s
because of some kind of tabula rasa
effect I really like the idea of a clean
slate when I have a clean slate I can I
can create this imaginary concept of the
app that is my idea of the app and I can
make that concept really simple I can
construct that concept to be exactly
what I like I can build exactly the
perfect app in my mind and because my
concept my imaginary construct of what
the app should be is very simple
it also makes my estimate of how hard it
would be to build this very simple let’s
think about Spotify for instance and it
at its core Spotify seems like a very
simple product it’s it’s a music player
you can stuff things in playlists and
yeah that’s pretty much it
thinking about it in that conceptual
sense makes me think yeah it will
probably take me like three months to
implement and I would probably be right
implementing my idea of Spotify would
probably just take three months but the
devil is in the details the problem is
that things are not as simple in reality
as they seem on a conceptual level the
code base that you have taken over has a
ton of nuances to it there’s a lot of
edge cases that the code takes into
account those weird performance
optimizations at that thingy that might
actually be necessary code is probably
very far from perfect but it’s it’s
there and it works it has been tested
the code quality probably doesn’t
compare very well to your your rewrite
but you know you have to remember that
the existing code base well like it
exists and your rewrite does not the
programmers of the existing code base
probably wrote it with just like you
with the best of intentions at this
point I tend to wanna fool myself a
little and say that well we have a lot
more experience about this app now we
know more about these edge cases but
it’s very rare that in that is true in
reality usually it’s not even the same
team that is doing the rewrite that
wrote the original code base so it’s the
experience it’s just not gonna be there
and I think it’s because of all this
that in my experience time estimates
around software rewrites are always way
more off than any other software
estimations it is just bizarre how much
you delude yourself I have been part of
software teams
where we’ve done time estimations are on
rewrites and I’ve agreed about the time
estimation where we said that yeah this
is probably gonna take around three
months one month the or take and the
thing ends up taking two years two years
the fact that you do this miss
estimation that also makes the rewrite a
lot more alluring because if you think
that yeah if we let’s say we don’t do a
rewrite let’s say that we instead just
spent these three months that we
estimated it to take on refactoring how
much better can we make it well when I
think about you actually can make a
software quite a lot bit better by
spending just three months refactoring
it but the point is that the rewrite
seems very alluring compared to the the
gradual refactoring because you are
under estimating the the time it will
take to do the rewrite by a bizarre
margin also if I’m being completely
honest with myself when I put myself in
the shoes of a consumer and I think back
on the most important software that I
depend on that I use a lot and I think
back on the situations where the company
that makes that software made a complete
rewrite and I think back on the
situation where I got my hands on that
first version of the rewrite I don’t
think that I even a single time have
said that hey I as a customer I really
appreciate that you did a complete
rewrite of the software that really made
things a lot better for me in summary
remember that your brain will always
want to do rewrites even though it is
rarely appropriate to do so a rewrite
always feels a lot more appealing than a
gradual refactoring but remember that
you are comparing reality to a
fictitious concept and that is really
not a fair comparison hi mmm PJ this is
fun fun function till next Monday morning stay curious