easwee.net // tiny digital playground

rage driven development

Rage Driven Development (RDD) can be a valuable technique when tackling larger legacy code refactors or making new trending tech work as promised by their documentation.

Let's face it - sooner or later you introduce some legacy in your codebase and there comes a day when you finally get that management allowance that will enable you to start refactoring and tackling this tech debt. Or maybe you will use it to switch to that new praised library that supposedly solves all the problems you've been having in the last 5 years. Both legit actions. There are many methodologies on how to tackle legacy refactors and changes, but I'm here to talk about RDD.

So you did your analysis, sketched it out, know the bad parts of it and you are now down to the last step - start refactoring the codebase.

In order for RDD to really work, git blame is a must to use - you really have to see those people's names written on each line you're gonna be touching, so you can blame it on their family tree. A playlist of random songs that you would normally be playing at 3am under certain weird substances is another tool in your box. If you are not a smoker, you should become one - helps with the boring part while waiting for tests to pass. Let's dive into it.

So it's monday and you have the next 14 days free of meetings - you should focus. To start we first need to move a few util functions to a proper lib - no problem it's just I/O - this should be easy. Ah, there is one that also has dependency on that service method, hmm, not good - who did this? Yeah, fuck that guy, freelancers suck anyway, glad he doesn't work for us anymore. Ok split it out, move to utils lib, refactor calls, refactor imports, fix any missing params, yeah just make it work. Done! 30 files changed, no biggie, commit. Fuck yeah, this is smooth! Uh, forgot tests - let's run affected - nah just run everything to be sure nothing broke. 3027 test suites running in jsdom gonna take some time - let's go for a cig.

Fuuuu, 16 test suites failed, 46 tests failing. Piece of crap of tests, why do we write this crap anyway, it's not that it affects the amount of bugs those juniors generate. Also dafuq is up with Jest mocks. Ok let's fix this tests one by one, it's probably just mocks playing dirty anyway. 6 hours and many more curse words and outdated mock patterns and a lunch with a beer later: rerun failed tests - ok finally works. We moved and decoupled a few util functions. I still have it. Ah let's call it a day. Also fuck Jest again, what a piece of crap, should have just deleted those tests anyway.

Week quickly zooms by and once you get in the rage routine nothing can stop you. You are a senior dev after all. In the morning you now salute people with cynicism and insults because your codebase is getting better and stronger - they should praise and tolerate you for that. You think I've been binge-watching series for the last 15 years like you lazy peasants do after work? I get my coding patterns down, I polish them, I read all the best stuff, I prove people wrong in the comment sections of the most obscure internet blogs that San Francisco graduates just started to get a CV boost for their first job applications. I engange in the community and... ah shit.. dafuq is this... fucking typescript generics. Not that shit again. We are doing frontend React, it's not rocket science, why the fuck did we even install Typescript, it just slows the delivery of features. Javascript was designed without types in mind, just abuse it. Type-safety my ass. Those third world country freelancers and their generic types extending generic shit. No wonder nukes have been invented, they should have thrown more of that crap around - we would have Japan level work efficiency as a standard. Also I like anime, which reminds me I could throw up some random shitty songs like Shittyflute to boost the morale, gotta put that on loudspeakers, it's funny after all. What? You in a call? Fuck you, we have meeting rooms, I'm doing refactor work here, we have no time for meetings - delivery of good code is my life now. Deal with it - it's friday afternoon after all, you should be going home anyway. Oh shit - it's Friday already! 678 files changed, 3 new libs created, stuff decoupled, antipatterns screamed at and removed - gotta explain some of this shit to others. Also someone should really start reviewing my MR. C'mon I need 2 dev sacrifices that are gonna swipe through those 666 files until Monday, so QA can do a quick smoke test and we smack it into RC.

Monday morning - no reviews - I have to be nice - rage driven development is only in my mind, when talking to people you have to be sweet to get stuff done. Can anyone pretty pleaseee check my MR - it solves and brings you all the best warez. Yes! Got 2 approvals, QA did a smoke test, nothing is broken - my refactor skills are still godlike - smack that into RC.

"Your branch is 174 commits behind release-candidate."

Pft.

git checkout release-candidate
git pull
git checkout -
git merge release-candidate
...

54 conflicts can’t be automerged.

Fuck you lazy fucks ,I said on friday check and approve, why... now I hate you. Ok no worries I'm pro.

Solve conflicts.

git add .
git commit
ctrl-x
git push

Need re-approvals pretty please. The fuck everybody is in meetings. Am I the only one working here? Screw this I'm off to lunch and a beer.

"Your branch is 22 commits behind release-candidate."

Who the fuck did this? Who dared to get his MR in before my refactor during lunch - I have 678 touched files - this is no joke. You want this code in FIRST! Anyway - re-approve, I merged again.

"Your branch is 31 commits behind release-candidate."

...raging in apathy now. Solved again. Merged. Pushed. Reapprove please.

Bling!

Email: "Pipeline for branch best-refactor failed."

How the fuck - some random test that I didn't even touch is now failing. Life is bad. Jest is bad. Why do we even use Javascript at all? This would have never happened if we'd picked a proper language. Someone was talking about ELM. A delightful language for reliable web applications. My ass, those underpaid hipsters probably have it even worse. JS is freedom! And job security in a way. Ha I'm glad after all. Ah yes all is good, some insanity never killed anybody I guess. He probably killed himself for other reasons. But let's debug the problem - ah easy - just Jest version update screwing some stuff up. Nothing I can't fix with sword and flames - rewrite that crappy test, it's legacy anyway, we know better now, hate that guy that wrote this if we had no HR, god what I would... mothe...

Pipeline passing! Reapprove! Yes! Merged to RC!

Oh god yes, tears, let's have a shot of schnapps, it's after 3PM anyway!

This was the best sprint, code is now good, we learned so much, kudos to everyone for reviews and approvals, I'm best, I'm sane again. This team delivers! That guy FUCKS! Wait, who's that guy anyway? Is that the new guy? Oh, we have 3 new guys now? Didn't notice... Anyway, thank god we have Typescript or else this refactor would have never happened in 1 sprint worth of man-days, if it hadn't been for those types and interfaces... An Jest, you lovely Jest - so much functionality would have been broken if it wasn't tested. Was anybody doubting JS? Not me! Ah yes, we are good. I bet I could pass some nice knowledge to those freelancers if they were still around. Miss those guys.

Life is good and when you leave for the weekend after the sprint ends, you have peace of mind and get home in a pure zen mood. After all, you already threw all the rage out at work.

Rage Driven Development delivers.

Note: Above article is satire and you should tackle big refactors with caution and care and always care for a good mood in your team. Also don't swear at work. Any resemblance to real world situations is purely casual.