Login
Software Engineering

Mastering the Art of Self-Code Review

As a software engineer, how can one work on critically reviewing their own code? I think that one can critically review their own code. All it takes is a shift in perspective. You...

Tim Mensch · 5 FEBRUARY 2023
· 2 min read

As a software engineer, how can one work on critically reviewing their own code?

I think that one can critically review their own code. All it takes is a shift in perspective.

You do first need to learn the kind of things to look for. You can't learn how to get better in a vacuum. You might be able to pick up some ideas for improvements simply by reading a lot of code, but it's much easier if you can get someone else to review your code.

I find that, after I've had a few reviews with a really good developer—let's call her Patricia—I can ask myself, “What would Patricia say?”

And then it see things I can improve.

It can help to take a break before looking at your code again, but for me just changing mental gears is enough to see what I was missing before.

Why didn't I write the code in the improved way the first time? Because my brain was deep in the problem I was solving, and sometimes it's easy to miss the overall pattern when you're immersed in the details.

The real trick is to be willing to throw away code when you see a better way to do something. And before you can even start down that path, you need to be accurate enough at creating code that rewriting a hundred lines seems like an easy task.

So practice with intentionality, and don't let yourself rely on code you're finding on the internet. Write every line of code you use, every time. Copying and pasting gains you no practice at all, even if you spend a lot of time fixing it to make it work.

More from this author