Ideas and tips for exploring a brand new codebase – Donny Wals


As a developer, becoming a member of a brand new venture or firm is commonly a frightening and scary job. It’s important to get aquatinted with not only a complete new staff of individuals, however you additionally should familiarize your self with a wholly new codebase which may use new naming conventions, follows patterns that you simply’re not acquainted with, and even makes use of tooling that you simply’ve by no means seen earlier than.

There are many causes to be overwhelmed once you’re a brand new member of any engineering staff, and there’s no purpose to really feel unhealthy about that.

Prior to now two years, I’ve executed loads of contracting and consulting which signifies that I’ve needed to discover and perceive numerous codebases briefly quantities of time. Typically even having to discover a number of codebases directly every time I’d begin to work for a couple of shopper in a given week or two.

I suppose it is honest to say that I’ve had my justifiable share of confusion and feeling overwhelmed with new codebases.

On this publish, I’d prefer to give you some ideas and tips that I exploit to get myself snug with codebases of any measurement in an affordable period of time.

Meet the staff

Whereas it is perhaps tempting to get via your introductory calls as quickly as doable so you may spend as a lot time as doable on navigating and exploring a brand new codebase, I extremely suggest letting the code anticipate a short time. Meet the staff first.

Attending to know the those that wrote the code that you simply’re working with can actually assist to construct a greater understanding of the codebase as an entire. Ask questions on staff dynamics, and ongoing initiatives, who’s an knowledgeable on what? Constructing empathy across the code you’ll be working with is a really priceless device.

Understanding which staff members know most about particular options, components of the codebase, instruments which can be utilized in an organization, and so forth additionally helps you determine the fitting particular person to ask any questions you may need whilst you discover the codebase.

For instance, after I joined Disney virtually six years in the past I wasn’t all that acquainted with Swiftlint. I had heard about it however I had no thought what it did precisely. Within the codebase, I noticed some feedback that regarded as follows:

// swiftlint:disable:subsequent cyclomatic_complexity

After all, I might paste this remark into Google and go down a rabbit gap on what’s taking place and I’d most likely have realized quite a bit about Swiftlint however as an alternative, I selected to determine who is aware of most about Swiftlint inside the staff. Absolutely that particular person might assist me study quite a bit about what Swiftlint was used for and the way it works.

I requested my staff lead and fortunately it was my staff lead that really knew tons and plenty of issues about Swiftlint, the way it was arrange, which linter guidelines we used, and so forth.

We had a very good chat and by the top of it, I knew precisely why we had Swiftlint at Disney Streaming, which guidelines we had disabled or enabled and why, and why it was okay to disable sure guidelines typically.

Google might have taught me that the remark you noticed earlier disabled a particular linter rule to permit one exception to the rule.

My coworker taught me not simply what that remark did but additionally why it did that. And why that was okay. And after I ought to or shouldn’t disable sure linter guidelines myself.

One other instance is a more moderen one.

One among my purchasers had a fairly large codebase that has had many individuals engaged on it through the years. There’s some Goal-C in there, numerous Swift, it has UIKit and SwiftUI, a number of structure patterns, and far more. It’s a correct legacy codebase.

As a substitute of figuring every part out alone, I had conversations with numerous staff members. Typically they have been one-on-one conversations however different occasions I met with two or three individuals directly.

By means of these conversations, I realized about numerous architectural patterns that existed within the codebase. Which of them they thought of to be good matches, and which of them they have been seeking to part out. I realized why sure bits of code have been nonetheless in Goal-C, and which components of the Goal-C codebase needs to be refactored ultimately.

I realized that sure staff members had spent loads of time engaged on particular options, patterns, and providers inside the app. They’d inform me why sure choices have been made, and which decisions they have been and weren’t notably proud of.

After assembly the staff I knew a lot extra concerning the venture, the codebase, the individuals engaged on the venture, and the way issues transfer and evolve inside the staff. This was extremely useful info to have as soon as I began to discover the codebase. By means of realizing the staff I knew a lot extra concerning the why of some bits of code. And I knew that some code wasn’t price exploring an excessive amount of as a result of it will be gone quickly.

On prime of that, via realizing the staff, I felt extra empathic about bits of code that I didn’t like or didn’t perceive. I do know who was prone to have labored on that code. So as an alternative of getting pissed off about that little bit of code, I knew who I might ask to study extra concerning the complicated part of code.

Break issues

Along with assembly the staff behind your new codebase, you’ll wish to begin exploring the codebase itself sooner relatively than later. One of many key issues to determine is how the venture is about up. Which code is chargeable for what? How does one factor impression the opposite?

Hopefully, the codebase follows some well-established patterns that provide help to determine this out. Regardless, I discover it helpful to attempt to break issues whereas I discover.

By introducing flaws within the enterprise logic for an app on goal, you may study quite a bit concerning the codebase. Typically it helps you uncover sure “this could by no means occur” crashes the place a staff member used a drive unwrap or wrote a guard let with a fatalError inside.

Different occasions issues break in additional refined methods the place the app doesn’t fairly work however no errors are proven. Or possibly the app is excellent about dealing with errors and it signifies that one thing went improper / not as anticipated however the app informs you about this.

While you break the networking layer in your app, you may uncover some hints about how the app handles caching.

By making small modifications that more than likely break the app you may study tons. It’s a method I usually use simply to see if there are any threads I ought to begin unraveling to study an increasing number of concerning the cool particulars of a codebase.

After all, you don’t wish to go round and begin poking at random issues. Often, after I begin exploring I’ll select one or two options that I wish to concentrate on. That is precisely the main target of my subsequent tip.

Concentrate on a slim scope

While you be a part of a big sufficient codebase, the thought of getting all of that code in your head in some unspecified time in the future sounds inconceivable. And truthfully, it most likely is. There’s a very good probability that the majority builders on the staff for a big venture can have one or two components of the codebase internalized. They know every part about it. For every part else, they’ll roughly know which patterns the code ought to observe (as a result of the entire staff follows the identical patterns) and so they may need some sense of how that code interacts with different modules.

General although, it’s simply not reasonable for any staff member to know all the ins and outs of each module or function within the codebase.

So why would you be trying to discover your complete codebase suddenly?

When you’re employed on a particular staff, concentrate on the code that may be maintained by that staff. Begin exploring and understanding that code in as a lot element as doable, have staff members present you ways the code works, and see in case you can break among the code.

Typically there might be bug tickets or options which you can begin to offer you a very good place to begin to start studying extra a couple of codebase. If that’s the case, you should utilize your tickets that can assist you decide your scope. When you’re engaged on a bug, concentrate on understanding every part you may concerning the part of code that appears more than likely to be the supply of the bug.

And as at all times, you’ll wish to be in contact with the staff. Ask them in the event that they might help you discover one thing to concentrate on initially. When you may have a bug ticket to work on, see if any individual on the staff might help you kickstart your analysis; possibly they’ve some ideas on the place you can begin trying first.

And in a great world, leverage pair programming to double the velocity at which you study.

Leverage pair programming

One device that I normally discover to be immensely underused is pair programming. In numerous locations the place I’ve labored, builders desire to work alone. Headphones on, deep within the zone. Questions needs to be initiated on Slack so that you’re disturbed as little as doable. Disable notifications if it’s important to.

There’s completely a time and place for deep centered work the place you’re to not be disturbed.

Nevertheless, there’s an unlimited profit in pairing up with a teammate to discover subjects and work on options. Particularly once you’ve simply joined a staff, it’s tremendous necessary you may have entry to your staff members that can assist you navigate the corporate, staff, and codebase.

While you’re pairing with a teammate throughout your exploration part, you may take the wheel. You can begin exploring the codebase, asking questions on what you’re seeing as you go. Particularly when you may have one thing to work on, this may be extraordinarily helpful.

Any query or thought you may need can instantly be bounced off of your programming companion.

Even in case you’re not the particular person taking the wheel, there’s numerous profit in seeing any individual else navigate the code and venture you’ll work on. Pay shut consideration to sure utilities or instruments they use. When you see one thing you haven’t seen earlier than, ask about it. Possibly these git instructions your coworker makes use of are utilized by all people on the staff.

Particularly when there’s debugging concerned it pays dividends to ask for a pairing session. Seeing any individual that’s skilled with a codebase navigate and debug their code will educate you tons about relationships between sure objects for instance.

Two individuals know a couple of, and that is very true whereas onboarding a brand new coworker. So subsequent time a brand new particular person joins your staff, provide them a few pair programming classes. Or in case you’re the brand new joiner see if there’s any individual fascinated with spending a while with you whereas working via some issues and exploring the codebase.

Use breakpoints

Once I was engaged on this publish I requested the neighborhood how they prefer to discover a codebase and lots of people talked about utilizing a symbolic breakpoint on viewDidLoad or viewDidAppear which I discovered a fairly cool method to studying extra concerning the completely different views and examine controllers which can be utilized in a venture.

A symbolic breakpoint means that you can pause the execution of your program when a sure methodology is named on code you may not personal. For instance, you may have a symbolic breakpoint on UIViewController strategies which lets you see every time a brand new subclass of UIViewController is added to the navigation hierarchy.

Understanding this sort of stuff is tremendous helpful since you’ll be capable to study which view controller(s) belong to which display screen fairly rapidly.

I haven’t used this one quite a bit myself however I discovered it an fascinating thought so I needed to incorporate it on this listing of ideas.

In Abstract

While you be a part of a brand new staff, it’s tempting to maintain your head down and research your new codebase. In your head, you may suppose that you simply’re anticipated to already know every part concerning the codebase though you’re utterly new to the venture.

You may suppose that every one patterns and practices within the venture are trade customary and that you simply simply haven’t labored in locations pretty much as good as this one earlier than.

All of those sorts of concepts exist in just about anyone’s head and so they forestall you from correctly studying and exploring a brand new codebase.

On this publish, you may have realized some recommendations on why human interplay is extraordinarily necessary throughout your exploration part. You additionally realized some helpful ideas for the extra technical facet of issues that can assist you successfully sort out studying a brand new codebase.

Good luck in your subsequent journey into a brand new codebase!

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles