How I Read Code I've Never Seen Before

Jan 07, 2023 2:01 pm

Read Time: 4.5 minutes


Reading code is just as important as writing.


On a team you will spend more time working with existing code than writing new lines.


That's just how it goes.


A new codebase comes with new:


- File structure

- Data structure

- System design


These take time to learn.


The faster you learn them:

The faster you work


Here are 3 simple questions I ask before diving into new code:


What

Understand what a system does.


Is it exporting data, storing files, or editing images?


Before you start coding anything ask:

"What problem are we solving"


It is easy to get derailed by what I call a B-Type error:


A - I need a function to validate emails (A)

B - I encounter issues setting up a library (B)

C - I spend hours trying to debug the library (B)


The original issue was validating emails (A)

Avoid spending time wrestling with the library (B)


Get hyper-focused on the "what" of the system before diving in.


Don't focus on speed.

You can go fast in a circle and get nowhere.


Focus on velocity.

Choose direction then increase the speed


How

Understand how it does what it does.


- What libraries does it use?

- What do the inputs look like?

- What do the outputs look like?


Learn how data flows through the system.


How the system is structured.

Why things are the way they are.


Something that will be less than ideal because of past compromises.

Understand why before criticizing.


Sit down with a developer and walk through the file system.


5 minutes and will speed up your coding by 10x.


Leverage the team.

You should lean on each other.


Why

Understand why the system is necessary.

Understrand how the system relates to the others.


Where is data coming from?

Where is it going?

Why?


This process will help you become an effective developer in any system.

The person who understands the most can move the fastest.


Nothing will ever slow you down more than uncertainty.


Get certain. Get Clear. Ask Question.


Nothing has served me more in my life than my willingness to ask an "annoying" amount of questions


Don't feel bad.


If you're willing to ask an "annoying" amount of questions now:

You get asked an "annoying" amount of questions in the future


It evens out.


Get a mental map of how the systems interact.

Ask different people different questions about the things they know.


All before you dive into writing code.


Take 2 hours to set up a meeting and clarify.

So that you can spend half the time reading and writing code.


One step back. Two steps forward.


In general: Admit your ignorance and clarify early


It will save you thousands of hours


_________________________________________


Become a developer who knows everything about a system.


The ironic thing about the building:

The person who knows most grows the fastest


They have more opportunities to:


- Teach

- Design

- Explain

- Implement


Than anybody else on the team.


It is a great position to be in.


So as your "What", "How", and "Why" early.

Before you write any code.


As always send me an email at swdlodonnell@gmail.com if you have any questions or just want to say hi.


Thank you all for reading.

I appreciate a few minutes of your attention.


Have a great weekend 😎


Comments