Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
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.12
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.
how often did this happen to you?
- fix a bug
- think, now that i'm here, let's smuggle in some refactoring, just this aspect, won't take too long
- spend more than half a day refactoring, finally finding yourself entangled in a spaghetti nightmare
- stash / shelve and revert all your refactoring changes
- continue on your other tasks and talk to noone about it ._.6
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. :)
Working on codebase of a 20+ year old system that the company I work for bought five years ago and in that time there’s been no refactoring, no security updates, no attempt to create automated testing (there is none), new features have just been built on the codebase with no regard for quality and it’s just spun into the horror cesspool that it is today.
I joined one year ago and I’m slowly refactoring the codebase and updating it to get it to a more modern codebase, cleaner code, faster load times and creating a ton of dev documentation so the devs in India can start getting into best practices and start producing quality code.4
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
Title: The problem with "good enough" code
I'm a software developer, and I've seen my fair share of "good enough" code. You know the kind of code I'm talking about: it works, but it's not pretty, and it's not very maintainable.
The problem with "good enough" code is that it's a slippery slope. Once you start writing "good enough" code, it's easy to fall into the trap of always taking the easy way out.
Before you know it, your code is a mess of hacks and workarounds. It's hard to understand, it's hard to maintain, and it's a nightmare to debug.
I've seen projects go down in flames because of "good enough" code. The code was so bad that it was impossible to fix, and the project had to be scrapped.
I'm not saying that you should never write "good enough" code. Sometimes, you just need to get something working, and you don't have the time or resources to do it perfectly.
But if you're going to write "good enough" code, you need to be aware of the risks. And you need to make sure that you're only writing "good enough" code for a short period of time.
Once you have a working prototype, you need to start refactoring your code and making it better. You need to make it more readable, more maintainable, and more testable.
If you don't, you'll eventually regret it. Your code will become a liability, and it will hold you back.
So next time you're tempted to write "good enough" code, think twice. It might save you some time in the short term, but it will cost you in the long run.7
How hard can it be to refactor this 170 lines file?
- a single “data” variable used to store everything
- arrays inside arrays inside arrays (see prev point)
- operations with a lot of obscure sideEffects
- $data = something (which in magic php land means $data.enqueue()
Why is such… biological matter… even allowed to code? Fucker’s pretending they are a senior for four years: how in hell didn’t they learn to code in this timeframe?7
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.
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
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