TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Let's Rewrite Everything

49 pointsby benn_88over 3 years ago

20 comments

tincoover 3 years ago
This is madness. There&#x27;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&#x27;t actually fix the original problem and&#x2F;or bankrupt the company. You can&#x27;t just wave away those realities with &quot;think about the downsides&quot;.<p>I have participated in a few (small) rewrites that were successful, and this would be my advice: Don&#x27;t rewrite an entire project at once. Pick off smaller features first, get a feel for what your new approach will be like before you commit to the big stuff. This will often mean you have to migrate from a monolithic architecture to a services architecture first. This means your project will grow in complexity first. If you&#x27;re confused about why a project first grows in complexity before shrinking, watch &quot;All the little things&quot; by Sandi Metz, it&#x27;s the greatest programming talk ever recorded. If your rewrite gets stuck after adding all of that complexity, then you&#x27;ve played yourself. Worst thing that can happen is you rewrite your entire project, some users or customers start using the new project, but you&#x27;ve failed to rewrite everything and some chunk of your users are still using the old codebase. Now you&#x27;ve got twice as much code to maintain.<p>Before you start a rewrite, consider refactoring and rearchitecting the old codebase, there might be a gem in there that just needs some love and attention.<p>That said there definitely are famous successful rewrites, and I think web application backends are especially suitable for rewrites. Most famous are Twitter and LinkedIn, Twitter going from a relational database backend to a more appropriate fan out message queue based backend allowing them to scale beyond imagination. LinkedIn going from a big rails monolith to super fast node.js microservices reducing their hardware costs a hundred fold if stories are to be believed.
评论 #30219586 未加载
评论 #30218690 未加载
评论 #30218947 未加载
评论 #30219728 未加载
评论 #30223276 未加载
评论 #30218813 未加载
评论 #30219726 未加载
评论 #30245803 未加载
评论 #30219755 未加载
throwaway13337over 3 years ago
I&#x27;m generally against rewrites as they&#x27;re often shortcuts for new developers that instantly reject a code base as &#x27;too complicated&#x27; without understanding it.<p>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.<p>With this kind of clarity, when you&#x27;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.<p>Jim Keller advocates rewrites in a similar way as the only way to progress in chip design.<p>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.<p>I guess one could reframe this as &#x27;first principals thinking&quot; but with the caveat that the problem needs to be truly understood.<p>Here&#x27;s Jim Keller talking about it: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Nb2tebYAaOA&amp;t=1361s" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Nb2tebYAaOA&amp;t=1361s</a>
wokwokwokover 3 years ago
&gt; “If I replace all of this Python code with Go it’ll be SO much faster!”<p>I write a lot of python, and the irony of this comment is that it’s probably true.<p>Worth the cost and time and effort? &#x2F;shrug<p>Easier and faster to keep <i>implementing features</i> in? &#x2F;shrug<p>…but out and out faster to build, deploy and run?<p>Yep, probably.<p>Im my experience python applications are slow it’s usually because your user logic is heavily implemented in python, and despite alllll the hand waving, that is, in general still slow. The package manger is slow and broken. It’s painful to deploy.<p>You can probably solve the problem in other ways, by picking <i>parts</i> to move to another language that provides an easy way to expose python bindings… but you know.<p>Make it faster by rewriting in go will probably work, if you only goal is “runs faster”.
RedShift1over 3 years ago
I think a lot of rewrites happen because new people come along and they are not interested in reading and learning existing code. They just want to write new code and in their mind &quot;the way I do it is better&quot;. A prime example is the Javascript ecosystem with such a high churn rate it caused a new kind of burnout: Javascript fatigue. Programmers seem to forget when you throw away code, you&#x27;re not just throwing away text, you are throwing away years of accrued knowledge.
hwover 3 years ago
Had met my share of engineers who wanted to rewrite everything from scratch into microservices and the reason they gave was ‘well microservices scales and monoliths dont’ - without taking into account the maturity of the existing application, the scale it already operates at and the scale we expect to operate at, the team resources and skills to required to support the rewrite, and the business requirements and goals.
评论 #30219607 未加载
评论 #30218617 未加载
theonethingover 3 years ago
&gt; Good luck with your rewrite! I’m sure it’ll be everything you hope it’ll be. It’ll probably be finished way quicker than you expect, and life will be perfect afterwards.<p>The author seems to be generally pro rewrite in his article so I can&#x27;t tell if this is sarcasm here.
评论 #30218782 未加载
brian_cunnieover 3 years ago
A co-worker was adamant we needed to spend six months to re-write the application we were responsible for. As near as I could tell, his reasons were the following:<p>- The application was complicated, - The application was written in Ruby, and he didn&#x27;t like Ruby. - Golang was way cooler.<p>Fortunately our director pointed out that there was no customer value to a rewrite, so the idea was shelved.
QuadrupleAover 3 years ago
A classic Joel Spolsky post along these lines:<p><a href="https:&#x2F;&#x2F;www.joelonsoftware.com&#x2F;2000&#x2F;04&#x2F;06&#x2F;things-you-should-never-do-part-i&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.joelonsoftware.com&#x2F;2000&#x2F;04&#x2F;06&#x2F;things-you-should-...</a>
评论 #30218184 未加载
评论 #30218389 未加载
jordanbeiberover 3 years ago
Joel Spolsky from 20 years ago:<p><a href="https:&#x2F;&#x2F;www.joelonsoftware.com&#x2F;2000&#x2F;04&#x2F;06&#x2F;things-you-should-never-do-part-i&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.joelonsoftware.com&#x2F;2000&#x2F;04&#x2F;06&#x2F;things-you-should-...</a><p>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.<p>&gt; 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?<p>Well, yes. They did. They did it by making the single worst strategic mistake that any software company can make:<p>They decided to rewrite the code from scratch.
PeterWhittakerover 3 years ago
A few of us inherited two code bases from a previous team, both for what are now products but were essentially prototypes.<p>Every release includes new things and rewritten things. If we add new on old, we grow technical debt; if we rewrite too much, fixes and features are delayed too long.<p>It’s a tough balance. Our code and issues are full of comments re how things <i>should</i> be done, with cross references we added as we figured out what things need to change together.<p>As Joel Spolsky notes in the twice-linked post, reading code is harder than writing.<p>Just today I eliminated hundreds of lines of code after writing maybe two dozen over the last few days.<p>The writing and deletion took no time at all. The reading and forensic mental compilation and execution took days and days.<p>That’s our golden rule: change nothing you do not completely understand - and you only really understand it if you can explain it in plain English to someone who doesn’t know the code.<p>The coolest thing is that as we go along doing cool things becomes easier and doing wicked cool things becomes possible.<p>Just this morning we had to force ourselves to remember that entire blocks of code with poor reporting of errors are as they are because until changes we made elsewhere just weeks ago, there was no point in doing better: the better reports had no place to go.<p>But after a major refactor initiated primarily to make maintenance and addition easier, we can now do things with dramatic - and wholly positive - UI&#x2F;UX impacts that were simply impossible before.<p>Read read read read digest digest cogitate muse read read correct read confirm, explain, write.
nameloswover 3 years ago
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.<p>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.
评论 #30219161 未加载
bazoom42over 3 years ago
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.<p>Perform a root cause analysis for why the current code is in a bad state and why it doesn’t improve over time.
评论 #30231387 未加载
lawrencegripperover 3 years ago
Really enjoy this take on rewrites:<p>&gt; Someone is likely to point out all the problems your rewrite will bring. You’ll find it much easier to convince people if you’ve already throught these through, and you bring them to the conversation yourself.<p>I wish more people did this!
评论 #30217840 未加载
ThinkBeatover 3 years ago
I think this is how it should be in a more perfect world. and the purest implementation of an iterative development process.<p>The first implementation you write is and will always be a (throw away) prototype.<p>You learn a lot. You understand much more of the spec. Maybe users got a go. Maybe its just internal.<p>Now your write the first version. It is better. You understand even more.<p>Writing a proper prototype first used to be a thing. As we all know once a prototype was getting close to finished the budget changed and bam your prototype is in production.<p>It is not all that practical with huge applications. Perhaps there is a lesson in that.
throwaway984393over 3 years ago
I knew about this being a bad idea, and I <i>still</i> fell for it. I bet on a big rewrite to avoid cleaning up technical debt. It did not work out well. I&#x27;m currently cleaning up the technical debt.
phendrenad2over 3 years ago
Here&#x27;s the only way you should ever rewrite something:<p>1) Document exactly what the existing thing does.<p>2) Write high-level tests for this functionality.<p>3) Make sure there are no features that will need to be added to it. Make sure everyone is onboard with not adding new features to it. Make sure people understand that adding features to an in-progress rewrite jeopardizes the entire thing.<p>4) Rewrite it in the original language, reusing those high-level tests you wrote in step 2.<p>5) Let people know that they can add features again.
ZeroGravitasover 3 years ago
The book Working Effectively with Legacy code has some real advice for when you find yourself in this situation.<p>It&#x27;s a lot less glamorous than just starting afresh which is where things often go wrong.<p>Here&#x27;s a recent podcast transcript with the author looking back on the book:<p><a href="https:&#x2F;&#x2F;www.infoq.com&#x2F;podcasts&#x2F;working-effectively-legacy-code&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.infoq.com&#x2F;podcasts&#x2F;working-effectively-legacy-co...</a>
alkonautover 3 years ago
Rewrites (and other forms of greenfield development) is an important part of my work environment and compensation. Any equation on rewrite vs. maintain that fails to account for what the company and its employers <i>want</i> to be doing will miss an important factor. The ROI of a rewrite isn’t only in new features or performance or subscribers, but in staff retention and overall happiness.
sys_64738over 3 years ago
Depends on the market for the software. Personal experience of those proposing rewrites usually is tainted with NIH syndrome. Different strokes for different folks but refactoring to modularize for targeted rewriting is more viable. New code means new maintenance headaches and probable maintenance on legacy codease.
gbrown_over 3 years ago
Camille Fournier has some excellent talks on rewrites I&#x27;d recommend anyone that came here looking for guidance check out <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=2TbwdxFxOtY" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=2TbwdxFxOtY</a>