DEV Community

A N M Bazlur Rahman
A N M Bazlur Rahman

Posted on • Originally published at bazlur.com on

Temporary Refactoring and Improving Your Code Reading Skills

I was talking to a friend of mine, Scott, over Slack about reading code! Specifically, how to improve your code reading skills.

I asked him what he usually does when he reads source code. What he said is interesting:

He does a temporary refactoring. That’s it.

He usually takes a long method that can be separated out and then he turns it into a separate method.

For example- readEmployeeDataFromDatabase()

This method can be broken into multiple methods, and he does that. He keeps doing that until he gets a sense for what the intent of the larger method is about. Then he takes a few notes on what the method does and rolls back the changes.

He also mentioned that he does not do any unit testing because this refactoring is only temporary, and used just to understand the code!

I believe this could be a great way towards improving code reading skills. Although what he suggested isn’t really true refactoring, it can help you to understand the code you are reading.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay