We’re taught from a young age that the hardest workers enjoy the most success. Hard work pays off, or so we’re told. But "hard work" can be a bit problematic for software developers, because it often means going well above and beyond the original scope of the project.
This is especially true when it comes to understanding legacy code. When you deal with legacy code, you often find yourself having to engage in so-called "deep thinking." You’re expected to understand large problem scopes before you even begin trying to fix the small bugs. For a long time, this stressed me out. Then I got an idea: be lazy.
At my company, Zerocracy, we practice a #NoAltruism policy. We, quite literally, think only about ourselves and our personal profit. This might sound a bit harsh. Isn’t it better to play nice and try to appease your clients? In an ideal world, maybe. But here’s what we’ve learned about clients: they also practice #NoAltruism.
Clients want to keep costs low and if they can, they’ll pass costs onto outside companies. That’s why we decided to "get lazy" and only do what we are paid to do. We won’t go out of our way to improve a project, refactor, or fix code unless we are getting paid for it.
And when we find ourselves with a task in front of us and we don’t understand how to solve it, we usually don’t blame ourselves. This is especially true if the problem has something to do with legacy code. See, here’s the thing, we weren’t paid to understand the legacy code. We were paid to add a feature, solve a bug, or whatever.
Suddenly becoming experts in a project’s legacy code would be outside the scope of our work, and since we’re lazy, we’re not going to venture outside of our assignment unless we’re paid to do so. A project shouldn’t expect you to be intelligent or tech-savvy, as far as the legacy code is concerned. Instead, you need to focus on closing tickets.
It’s not your fault if the code is a complete mess, or the bug is serious, or you can’t estimate how much time it’ll take to understand the legacy code, let alone how to fix the bug. So whose fault is it? The first guilty party is the code itself. And the clients overseeing the code are also at fault.
Once you accept that, you can put together a basic report by creating new tickets. This report could be lazy-simple:
- There is no documentation for Class Y, can’t figure out how it works.
- Library Z is in use but why aren’t you using library B?
- This algorithm is a complex mess, can you explain what it does?
- The class naming rules are incoherent, can you provide documentation?
Suddenly, your initial "report" is instead a list of questions. You can’t provide the answers because you don’t honestly know them and you’re too lazy to figure it out. Answering these questions falls outside of the scope of work you were hired for, so it’s reasonable to expect the client to provide documentation.
Now, you might have noticed a common thread in the questions above. I didn’t ask for help. I didn’t ask someone to create something for me. Programmers will often reach out for help, saying something like "which library should I use for this task?"
Here’s the thing, your clients aren’t hiring you so they can do your work for you. They aren’t hiring you so they can be your teacher, either. They don’t really want to explain anything to you. For them, it’s money and time they’d rather not spend.
So your goal, then, is to get your clients to fix the code base so that the code itself becomes more obvious and easier to read. This will help not only you, but everyone else. As such, focus on asking for documentation and code source fixes.
Okay, so you’ve got the tickets out and you’ve asked the client to fix their source code and address other problems. So what now? Sit back and relax! You wait for the tickets to be resolved and don’t sweat who is resolving the issues; that’s not really our business.
Now, your employer may decide to kick the problem back to you, asking you to solve it on your own. That’s fine, so long as you’re getting paid for it and the employer expands the scope of your work. Instead of fixing bugs, you’re now documenting some functionality or refactoring this and that.
As you create tickets and blame everyone else around you, you’ll continue to create smaller and smaller scopes. Eventually, you may find that the tickets can be fixed in a half hour or less. And keep in mind, when I say "blaming everyone else," that doesn’t mean shouting at other people. It simply means not beating yourself up for problems you didn’t create, and shifting responsibility for poorly written code to the original source.
Being lazy can take a lot of effort (seriously). We’re programmed not to be lazy. Some people will resist the call. They might feel ashamed (stop it!). They want to be perfectionists (only perfect what you’re paid to!). Or maybe you lack the passion needed to be lazy (get a new job!).
Yegor Bugayenko is founder and CEO of software engineering and management platform Zerocracy.