Live data from Hacker News

Let's Rewrite Everything

martinpeck.com

21–30 of 61 posts

Re: Let's Rewrite Everything

#21
I'm generally against rewrites as they're often shortcuts for new developers that instantly reject a code base as 'too complicated' without understanding it.

However, I have had success in rewriting my own code base a number of times. This is a unique situation of a one-man-band that understands the business case, handles support, and every bit that went into every decision of the code base.

With this kind of clarity, when you've spent years with the problem domain, you can uniquely rewrite a project to get at the real business case that, now with years of experience, you see what your customers actually wanted you to solve in the first place, or maybe what they evolved to want in the end.

Jim Keller advocates rewrites in a similar way as the only way to progress in chip design.

I think we could rewrite very basic things in exciting ways with this sort of attitude. For instance, we know a lot more about what we need in a desktop OS, an email client, a search engine, etc. Basic things that have gotten a lot of cruft over the years as they evolved. Taking a fresh look could be rewarding.

I guess one could reframe this as 'first principals thinking" but with the caveat that the problem needs to be truly understood.

Here's Jim Keller talking about it: https://www.youtube.com/watch?v=Nb2tebYAaOA&t=1361s

Re: Let's Rewrite Everything

#22
I feel there are certain dynamics to the game. Back in the 90s rewrites are everywhere and they fail a lot because people were doing it so recklessly.

Nowadays, people are usually too afraid to even talk about it. As a result, many things that could be straightforwardly solved by rewrites were delayed to the point virtually impossible, causing eternal suffering and valuable features blocked forever.

Re: Let's Rewrite Everything

#23
post #6

This is madness. There's no real advice about rewrites in this article. The reality of rewrites is that they often fail, cost a ridiculous amount of time and effort, don't actually fix the original problem and/or bankrupt the company. You can't just wave away those realities with "think about the downsides". I have participated in a few (small) rewrites that were successful, and this would be my advice: Don't rewrite…

I have participated in a handful of rewrites. Most of them were indeed unnecessary or harmful.

However, "X2" was definitely an example of an appropriate rewrite. It had the following conditions:

* The existing code "X" was the product of an early-phase startup which hadn't yet figured out what it was going to do. "X" already existed at the point we were still asking questions like, "Who is the customer?" with possible answers like "The NSA and similar entities" even though it eventually became a consumer product - and so obviously it was very flexible but had also been greatly distorted from its original conception to produce a product we were actively selling.

* The existing code was developed and maintained by a third party team. So the knowledge of how that system worked was something we'd need to absorb anyway to bring it in-house. Existing code reflected house style of that team, and X2 would be in our style.

* It was modestly sized. I think our plan said our small team (less than half-a-dozen people, not all of them available for this full-time) would rewrite it in one calendar year, with an MVP in maybe six months and from there simultaneously copying less important features from "X" and also new want-to-have features to get the finished "X2", that's roughly the timeline we followed.

* I was pretty confident we could execute from the initial description of the work to be attempted. I went into a meeting assuming (as I always do in all-hands meetings) that I'd get fired, and came out thinking I should brush up my Java (the chosen language for "X2") but it seemed very possible.

* The non-technical leadership actually wanted a new system. "We need a new pig" is how it was explained back to me by the CEO. (From "Lipstick on a pig" the idea that superficial changes to a product can't really disguise its flaws) so there was buy-in of this idea and nobody yelling at us about why the "X2" MVP doesn't deliver most of the things "X" didn't have yet.

[This software, and its predecessor, had code names but somebody let me name the successor software and I have no imagination so although it wasn't literally "X" and "X2" that's about how similar the code names were].

Re: Let's Rewrite Everything

#24
post #8

A classic Joel Spolsky post along these lines: https://www.joelonsoftware.com/2000/04/06/things-you-should-...

A classic Joel Spolsky post that completely failed to take into account the fact that Netscape rewrote itself into Mozilla, which then went on to eat IE5's lunch.

They only ate IE’s lunch because Microsoft stopped development on IE for the better part of a decade. They literally dismantled the IE team.

Usually you cannot count on competitors to stop all developmet for half a decade while you rewrite.

Re: Let's Rewrite Everything

#26

I feel there are certain dynamics to the game. Back in the 90s rewrites are everywhere and they fail a lot because people were doing it so recklessly. Nowadays, people are usually too afraid to even talk about it. As a result, many things that could be straightforwardly solved by rewrites were delayed to the point virtually impossible, causing eternal suffering and valuable features blocked forever.

sometimes repair and retrofit is actually a bigger job than a ground up rebuild. depending on the state of things, this may not be discovered until time and political capital has already been committed to the first approach. i think the key is to avoid dogma and remain agile, not in the buzzword sense, but in the literal sense. be willing and able to scrap approaches and reverse course if things start looking worse than anticipated.

Re: Let's Rewrite Everything

#27
If the current code is crap there is a reason it ended up like that, and the same forces will be in effect to cause the rewrite to end up in the same state.

Perform a root cause analysis for why the current code is in a bad state and why it doesn’t improve over time.

Re: Let's Rewrite Everything

#28
post #6

This is madness. There's no real advice about rewrites in this article. The reality of rewrites is that they often fail, cost a ridiculous amount of time and effort, don't actually fix the original problem and/or bankrupt the company. You can't just wave away those realities with "think about the downsides". I have participated in a few (small) rewrites that were successful, and this would be my advice: Don't rewrite…

I have participated in a handful of rewrites. Most of them were indeed unnecessary or harmful. However, "X2" was definitely an example of an appropriate rewrite. It had the following conditions: * The existing code "X" was the product of an early-phase startup which hadn't yet figured out what it was going to do. "X" already existed at the point we were still asking questions like, "Who is the customer?" with possibl…

May I ask you something? In your experience, how would you approach the rewriting of an application with a mix of front end and back end code, bloated code from years of patches without any planning for a maintainable design (full of unused/buggy classes/methods/features), lack of tests and barely any documentation explaining its processes?

Re: Let's Rewrite Everything

#29
Joel Spolsky from 20 years ago:

https://www.joelonsoftware.com/2000/04/06/things-you-should-...

Very good post, that holds a lot of experience. Unfortunately these things have to blow up in your own face, often more than once, for a lesson learned.

> It’s a bit smarmy of me to criticize them for waiting so long between releases. They didn’t do it on purpose, now, did they?

Well, yes. They did. They did it by making the single worst strategic mistake that any software company can make:

They decided to rewrite the code from scratch.

Re: Let's Rewrite Everything

#30
post #13

Earlier quoted context omitted.

It annoys me so much that after honing my skill as an engineer for 15 years now I still fall into the trap of not enough YAGNI thinking. There's a precarious middle ground there for sure. Even though I still fall into the trap of over designing, I believe it's way worse than under designing. I don't remember a single instance where a 'YAGNI' under designing cost us much except designing and implementing the feature t…

The only time I've regretted overdesigning is when there's been significant original design work involved. I don't think I've ever regretted overdesigning to meet a common standard or match how everyone else does something. A lot of the YAGNI I see is in the form of "We don't need a framework, just do vanilla JS" or "I only need one of the features of this library, I'll just write it myself". Almost all of my own big…

Ah, I think I wouldn't qualify those as YAGNI decisions, more in the premature optimisation direction. YAGNI is preparing for future integrations that might never happen, or preparing for supporting multiple databases, special users, special circumstances. It is always a decision of doing more work now, versus more work later.

The decision to not use a framework or a library is sort of the reverse in that you're making a decision that you can later reverse by reducing the complexity of your own code.

Definitely agree with you that a part of being a very effective development team is owning as little code as possible, by using as many existing solutions as possible.

Post reply on HN