1

Due to circumstances I'm now working in a small software company. We make e-mail marketing management software and serve some big customers as our national railways and a big bank. The software has been developed about 6 years ago by two guys, one who left, the other now leading architect.

The problem starts with him. When he joined the company 6 years ago, this was his second job and he was a junior, but as everybody left due to a changing company directions, he in steps automatically got promoted into the role of lead. But he's not a good leader. In fact, he's not even a good programmer IMHO. E.g. he's often complaining about how we are using C#, while VB (often referring to VB6) is better. He's writing the coding guidelines, where he limits the use of many newer language features, as he doesn't understand them.

Over the years many people worked on the program, and it's now a 500000 line hot steaming mess of spaghetti. It has all the anti patterns you can imagine, like 5000+ line classes, 200+ character lines, no comments or documentation, no working tests (in intern wrote 80 application tests 4 years ago, but they were not maintained, so they're all broken).

I've learned to live with it (a bit... due to circumstances I don't have much choice), but many people don't. So we cannot keep new employees. They often leave within a year. They have a very hard time getting familiar with even the simplest code. And after that they just get frustrated after a while an go look for a more fun job. As you can imagine, a lot of the work is just bug hunting. Adding new features is not something anybody can do, as any change might break many things.

I've talked to a former long-time employee, and he says that the company is just locked in: this leading architect is the only one who really knows the software, so he gets freedom from the management. Management has tried stuff, but he gets agitated easily, so they just let him be most of the time.

Anyhow, that's the introduction. After I've been with the company for 1.5y, and me having 20+ years of programming experience, I've managed to convince the company (management and even the lead eng.) that this is a problem. And I'm now 'tolerated' to clean up the code. I'm started to writing (unit) tests. I'm breaking up the big classes into manageable chunks, etc, etc.

But this is the first time I'm doing this. I think 95-99% of the time this goes right, but every once in a while it doesn't, and some of my refactoring breaks something. This week even in production. Every time I had to have difficult conversations, and the lead eng. gets very frustrated and wants me to change everything back. As you can imagine, these conversations are demotivating for me. Also makes me want to leave.

How should I approach this? Are there best practices? Books? Ways to prevent errors?

edit: the dupe is not great. As it doesn't say how to do this in a hostile environment.... where every mistake leads to a problem. Why can I not see who closed the issue, like on SO?

JHBonarius
  • 119
  • 3
  • 2
    yeah, reading he dupe more thoroughly, I think I just should give up and change companies. It suggests I change the way of working from the ground up, put the lead eng. will never allow that. Problem is that I'm partially disabled, and it's very hard to get a job. Took me a very long time time find this one. – JHBonarius Nov 25 '21 at 08:39
  • 3
    You could consider sending the dupe link to your tech lead and ask their opinion. For example *"Hey, I've been thinking of ways we could improve our quality output and productivity using process, tooling and automation - it looks like we're not alone in the struggles we face, there are some real interesting ideas here, what do you think..?"* -- if you want to affect change and you aren't in a position of authority, then you need others to feel motivated to make the changes you want to see, and for them to feel motivated to want to learn more, discover new benefits, try new things... – Ben Cottrell Nov 25 '21 at 09:50
  • 1
    Not sure about the software (or the lead, which is the root of the problem imo), but I think I see how you can change your question so that it isn't a dupe, thus adding value to both the post and the site. Since the answers will not work in your situation, I would add your caveat to the title and question (e.g. add suffix of "without a ground-up overhaul" to title, along with additional paragraph linking dupe and explaining why answers are not an option in body). This way it is helpful to the site, as it provides an opportunity for original answers. – Nate T Nov 25 '21 at 10:30
  • 3
    There are people on Stack Exchange who see it as their duty to vote to close as many questions as they can. And it only takes a very small number of close votes to close a question. It's one of my least favourite features of this site. – Simon B Nov 25 '21 at 12:19
  • 1
    Meanwhile, as a comment, lean heavily on version control. If you make a change and it works, check it in. If you make a change and it breaks something, and you can't see why, revert it and try again. – Simon B Nov 25 '21 at 12:22
  • 2
    @JHBonarius start looking elsewhere. In the meantime, start tracking how many bugs your changes cause and how many are caused by new features. Start logging the time you are debugging code that is not refactored and compare it to the refactored one (which have full language features). Convert these numbers into amount of money the company throws away. If it doesn't work, it will stay the same at worst. The company has the problem that only one person knows what the code does: code reviews, peer programming, etc. should help with that. – Blaž Mrak Nov 25 '21 at 19:22
  • The duplicate may not be great for you. But what you are asking for is advice about a workplace issue, which should be asked at https://workplace.stackexchange.com/ instead of here. On this site, we try to focus on questions about how to deal with such evolved pieces of software, not about how to deal with the people who are responsible for this. – Doc Brown Nov 28 '21 at 09:24
  • ... FWIW, here is my advice: never ever apply any kind of refactoring when you don't also have a clear justification for changing the involved code for a hard business reason (which is one of the three "add a new feature", "optimize resources", "fix a bug"). When you break something and get asked "why did you change this", and the only answer you have "to improve readability", you will be in a much weaker position than when you can say "I had to fix this bug - and to understand what was going wrong, I had to improve the readability of the code". – Doc Brown Nov 28 '21 at 09:31
  • @DocBrown I get your point, but it's not that simple. I am in no position of power to change the workplace. I just see that the code is not well documented-not-tested-unreadible etc, giving great frustration to new employees. These new employees often leave withing a year, being frustrated about constantly fixing bugs in spaghetti code. I myself hate it, but I don't have much job opportunities, as I stated earlier, so I want to try to improve my current "habitat", to make it better: refactoring. We're now heavily understaffed, so that's the business reason. – JHBonarius Nov 29 '21 at 07:46
  • @DocBrown I also don't think you're not correct on the "only three hard business reasons", because that way you would never be able to fix code rot, intelligibility, etc. And you'll end up with an unmaintainable spaghetti mess (and that happens a lot at many companies). Code quality improvements are also required every once in a while. Many companies (including Google) even have dedicated teams that only go though the code base to fix maintenance-level things and improve code quality. So I really think my work is needed, I just want to know how to do it safely. – JHBonarius Nov 29 '21 at 07:56
  • @JHBonarius: you are not Google, and you don't have a dedicated team for this. So I recommend you refactor only *new* code, during code reviews, or longer existing code whenever there is one of the three reasons I mentioned above. That will give you more than enough occasions to improve the code, and whenever something breaks, you always can name a justification for the change. And code where the surroundings don't change does not "rot" automatically, it only rots when someone forgets to refactor it immediately when a feature is added or a bug is fixed. – Doc Brown Nov 29 '21 at 10:35
  • @DocBrown ah yeah, code reviews. that's also something we don't have. I once gave the lead some feedback on some code. He didn't appreciate it. And refactoring is not really forgotten. Usually there's just no time (understaffed). Yeah, I'm seeing the line here. Maybe I could try the other SE. – JHBonarius Nov 29 '21 at 11:15
  • You're in a difficult situation. First off, don't mind to find a different job. That situation can be devastating for a good software developer. Don't allow others to drag you down. You can have a look at SCRUM, it uses the ADAPT principle, which nicely decribes the fears people have when things are about to change. You might use some of this to convince that it's a good idea what you're proposing. Third I recently found a good blog about various issues in software development, maybe this resource can help you to convince the others: https://www.simplethread.com/where-does-complexity-go/ HTH – AdrAs Dec 03 '21 at 14:45

0 Answers0