Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
Get a devDuck
Rubber duck debugging has never been so cute! Get your favorite coding language devDuckBuy Now
Search - "refactoring nightmare"
A lot of engineering fads go in circle.
Architecture in the 80s: Mainframe and clients.
Architecture in the 90s: Software systems connected by an ESB.
Architecture in the 2000s: Big central service and everyone connects to it for everything
Architecture in the 2010s: Decentralized microservices that communicate with queues.
Current: RabbitMQ and Kafka.
... Can't we just go back to the 90s?
I hate fads.
I hate when I have to get some data, and it's scattered on 20 different servers, and to load a fucking account page, a convoluted network of 40 apps have to be activated, some in PHP, others in JS, others on Java, that are developed by different teams, connected to different tiny ass DBs, all on huge clusters of tiny ass virtual machines that get 30% load at peak hours, 90% of which comes from serializing and parsing messages. 40 people maintaining this nightmare, that could've been just 7 people making a small monolithic system that easily handles this workload on a 4-core server with 32GB of RAM.
Tripple it, put it behind a load balancer, proper DB replication (use fucking CockroachDB if you really want survivability), and you've got zero downtime at a fraction of the cost.
Just because something's cool now, doesn't mean that everybody has to blindly follow it for fucks sake!
Same rant goes for functional vs OOP and all that crap. Going blindly with any of these is just a stupid fad, and the main reason why companies need refactoring of legacy code.13
Almost 3 weeks back I joined a company as a React developer. For a week I had nothing to work on as they were already working on few projects.
So my senior asked me to take up a project(not yet live) which was developed by 2 interns, as the frontend guy's internship was about to end in 4 days I have to take over the front-end role.
So I talked to that guy for next 2 days regarding all the project scope, codebase and whatnot. But still not entirely convinced. As i got the repo access, I began to check the codes. God !! It was all spaghetti code. I was damn frustrated. And still I am.
This whole week I am trying to do the refactoring as much as I can, I completely lost interest.
I cannot blame the intern guy, he is smart and tried to do the best he could, as he didn't know about the company standards. Maybe I was too the same kind back then. Now he is gone and I am stuck building components over that code.
Bonus: He used some old react boilerplate.
i am fucking tired of companies that come to me expecting to magically fix their STEAMING PILE OF BULLSHIT AND TRASH CODE. how about when i ask "can i get a project brief", instead of saying "just fix it" or "it just needs to do this", GIVE ME A FUCKING COHERENT AND DESCRIPTIVE WRITEUP OF EXACTLY WHAT YOU NEED. i can't read your minds, let alone read the code the previous cock sucking developer wrote, so guess what? i'm left with no other option but to completely rewrite it. to top it off, instead of giving me god damn excuses as to why you can't get me the api key for your order processing, MAKE A NEW ACCOUNT AND GET IT TO ME. how the fuck do you expect me to test an application when i don't even have access to the fucking api the whole shit pile is based around? i swear to god if these people expect me to have this done by the end of the week but want to be little cunt nuggets they can go eat shit. fuck you, fuck your "contract", fuck your company, FUCK EVERYTHING. greedy, shit faced bastards2
I spent 4 hours finding a good way to instanciate golang structures. Came up with a function that returned a value or pointer and I just kept reusing the nomenclature for an entire project. Then my buddy looks over and goes, "Ethan, you're a f****** idiot", and shows me the standard nomenclature. Now I have to refactor my entire project. FML.
So we had this legacy Objective-C codebase for a mobile app that was actually pretty good: I'd inherited the codebase and spent the past several years gradually improving it and I was actually quite proud of the work I put into it. So of course management decides to scrap it (with NO consultation from the engineers) and outsource a complete rewrite of the app in C# for Windows Universal.
Let me tell you. That code was without a doubt and without exaggeration the *worst* code I've seen in my close to 30 years of experience as a developer. I mean they broke every rule in the book, I'm talking rookie mistakes. Copypasta everywhere, no consistent separation of concerns, and yet way too many layers. Unnecessary layers. Layers for the sake of layers. There was en entire abstraction layer complete with a replicated version of every single data class *just* to map properties in pascal case to the same property in camel case. Adding a new field to a payload in the API amounted to hours of work and about eight different files that needed to be modified. It was a complete nightmare. This was supposed to be a thin client, yet it had a complete client-side Sqlite database with its own custom schema (oh and of course a layer for that!) completely unrelated to the serverside schema, just for kicks. The project was broken up into about eight or nine different subprojects, each having their own specific dependencies on various of the other subprojects in such a tightly-knit way that it made gradual refactoring almost impossible. This architecture was so impressively bad, it was actually self-preserving!
Suffice it to say it was a complete nightmare, and was one of the main reasons I ended up leaving that company. So just sayin', legacy code isn't always bad. :)
I'm rewriting a game from C++ to C just for the purpose of learning and adding more features, however; after I refactored the code, the game broke with a segmentation fault and I have no idea where the memory issue is.
I've been debugging for hours now and I've got nothing. FML5
I just spent my day analyzing module interdependencies in our project. Amfter comming up with a way to graph said dependencies using an analisys tool and some custom filtering, and comming up with suggestions for breaking unwanted dependencies, i get this as a review comment: " yeah, I don't reaaly trust that the graphs are showing the whole picture. Use <gradle dependencies> on each service instead". The lunatic actually expected me to sift through all of our services, by hand, and run that command and analyse the result, wich is a great wall of text.
Joke's on him though. I wrote a script that did all of that for me and captured the results. Then i just sent it to him. If he's so unsure, then he can sift through the wall of text himself.
Even funnier is the fact that tomorrow is the last day before i go on leave. He'll probably end up doing the actual cleanup himself. 😂
I don't want to seem stuck up but, at the moment, there are several other priorities higher than this refactor, yet management is insisting that this is a must have for go live, so I have to commit.
What would you rather have, an app that works, or perfectly neat and tidy, broken, code?6
I'm a bit cornered. A week into an ambitious refactoring effort that was supposed to take just a couple of days to finish, the end doesn't seem anywhere near. The system went from a messy albeit perfectly functional state to a much better structured non functional bag of bugs. If I leave the branch all the efforts are lost. If I soldier forward I'll be unproductive for good knows how many days to come.
How did I ever fuck myself so hard!1
Everytime I applied long leave, my client and PM will plan for important feature, but they say start the sprint and for other new people i have to give KT, and they will take care. I know how that will screw up the system. So at the time it's nightmare late night at office, in office time KT, no weekends, stand-up for 1hr(every time QA will ask, what we get after this sprint). Stupid clients changing the requirements after stand-up.
Everytime code base screwed and need to refactoring. So as much as possible core functionality I'll complete and only bug fixing for newbie. I hate those days.
Why do I always have to refactor bad written code ? Is this some kind of karma ?
Undocumented, written by a senior but looks like it was a junior, no unit tests, variables with meaningless names, duplicated code and every possible thing you can find in that kind of code.3