Home IOS Development Suggestions and methods for exploring a brand new codebase – Donny Wals

Suggestions and methods for exploring a brand new codebase – Donny Wals

Suggestions and methods 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. You must get aquatinted with not only a complete new group of individuals, however you additionally need to familiarize your self with a completely new codebase that may use new naming conventions, follows patterns that you just’re not aware of, and even makes use of tooling that you just’ve by no means seen earlier than.

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

Prior to now two years, I’ve finished numerous 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 each time I’d begin to work for multiple consumer in a given week or two.

I assume it is honest to say that I’ve had my fair proportion of confusion and feeling overwhelmed with new codebases.

On this submit, I’d wish to offer you some ideas and methods that I take advantage of to get myself snug with codebases of any dimension in an affordable period of time.

Meet the group

Whereas it may be tempting to get by way of your introductory calls as quickly as attainable so you may spend as a lot time as attainable on navigating and exploring a brand new codebase, I extremely advocate letting the code look ahead to a short time. Meet the group first.

Attending to know the folks that wrote the code that you just’re working with can really assist to construct a greater understanding of the codebase as a complete. Ask questions on group dynamics, and ongoing tasks, who’s an skilled on what? Constructing empathy across the code you’ll be working with is a really useful instrument.

Realizing which group members know most about particular options, components of the codebase, instruments which might be utilized in an organization, and so forth additionally helps you determine the suitable individual to ask any questions you may need when you discover the codebase.

For instance, once I joined Disney nearly six years in the past I wasn’t all that aware of Swiftlint. I had heard about it however I had no concept 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 occurring and I’d most likely have realized quite a bit about Swiftlint however as a substitute, I selected to determine who is aware of most about Swiftlint throughout the group. Absolutely that individual might assist me be taught quite a bit about what Swiftlint was used for and the way it works.

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

We had a great 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 generally.

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 in addition why it did that. And why that was okay. And once I ought to or shouldn’t disable sure linter guidelines myself.

One other instance is a newer one.

Certainly one of my shoppers had a pretty big codebase that has had many individuals engaged on it over time. There’s some Goal-C in there, numerous Swift, it has UIKit and SwiftUI, a number of structure patterns, and way more. It’s a correct legacy codebase.

As an alternative of figuring the whole lot out by myself, I had conversations with numerous group members. Typically they have been one-on-one conversations however different occasions I met with two or three folks directly.

By way of these conversations, I realized about numerous architectural patterns that existed within the codebase. Which of them they thought of to be good suits, and which of them they have been trying to section 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 finally.

I realized that sure group members had spent numerous time engaged on particular options, patterns, and companies throughout the app. They’d inform me why sure choices have been made, and which selections they have been and weren’t significantly pleased with.

After assembly the group I knew a lot extra in regards to the venture, the codebase, the folks engaged on the venture, and the way issues transfer and evolve throughout the group. This was extremely useful data to have as soon as I began to discover the codebase. By way of realizing the group I knew a lot extra in regards to 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 could be gone quickly.

On high of that, by way of realizing the group, 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 a substitute of getting annoyed about that little bit of code, I knew who I might ask to be taught extra in regards to the complicated part of code.

Break issues

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

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

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

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

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

By making small modifications that more than likely break the app you may be taught tons. It’s a method I typically use simply to see if there are any threads I ought to begin unraveling to be taught increasingly in regards to the cool particulars of a codebase.

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

Give attention to a slim scope

While you be part of a big sufficient codebase, the thought of getting all of that code in your head sooner or later sounds not possible. And actually, it most likely is. There’s a great likelihood that the majority builders on the group for a big venture can have one or two components of the codebase internalized. They know the whole lot about it. For the whole lot else, they’ll roughly know which patterns the code ought to observe (as a result of the entire group follows the identical patterns) they usually may need some sense of how that code interacts with different modules.

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

So why would you be trying to discover the complete codebase abruptly?

For those who’re employed on a particular group, deal with the code that may be maintained by that group. Begin exploring and understanding that code in as a lot element as attainable, have group members present you ways the code works, and see in case you can break a number of the code.

Typically there will likely be bug tickets or options which you can begin to offer you a great start line to start studying extra a few codebase. If that’s the case, you should use your tickets that can assist you decide your scope. For those who’re engaged on a bug, deal with understanding the whole lot you may in regards to the part of code that appears more than likely to be the supply of the bug.

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

And in a really perfect world, leverage pair programming to double the pace at which you be taught.

Leverage pair programming

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

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

Nevertheless, there’s an infinite profit in pairing up with a teammate to discover matters and work on options. Particularly once you’ve simply joined a group, it’s tremendous vital you have got entry to your group members that can assist you navigate the corporate, group, and codebase.

While you’re pairing with a teammate throughout your exploration section, you may take the wheel. You can begin exploring the codebase, asking questions on what you’re seeing as you go. Particularly when you have got 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 accomplice.

Even in case you’re not the individual 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. For those who 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 group.

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 folks know multiple, and that is very true whereas onboarding a brand new coworker. So subsequent time a brand new individual joins your group, supply them a few pair programming classes. Or in case you’re the brand new joiner see if there’s any individual focused on spending a while with you whereas working by way of some issues and exploring the codebase.

Use breakpoints

After I was engaged on this submit I requested the group how they wish to discover a codebase and lots of people talked about utilizing a symbolic breakpoint on viewDidLoad or viewDidAppear which I discovered a reasonably cool strategy to studying extra in regards to the totally different views and consider controllers which might 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 won’t personal. For instance, you may have a symbolic breakpoint on UIViewController strategies which lets you see each time a brand new subclass of UIViewController is added to the navigation hierarchy.

Realizing this type of stuff is tremendous helpful since you’ll have the ability to be taught which view controller(s) belong to which display screen fairly shortly.

I haven’t used this one quite a bit myself however I discovered it an attention-grabbing concept so I wished to incorporate it on this checklist of ideas.

In Abstract

While you be part of a brand new group, it’s tempting to maintain your head down and research your new codebase. In your head, you would possibly assume that you just’re anticipated to already know the whole lot in regards to the codebase although you’re fully new to the venture.

You would possibly assume that each one patterns and practices within the venture are trade customary and that you just simply haven’t labored in locations nearly as good as this one earlier than.

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

On this submit, you have got realized some recommendations on why human interplay is extraordinarily vital throughout your exploration section. 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!



Please enter your comment!
Please enter your name here