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

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

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


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

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

Previously two years, I’ve accomplished a whole lot of contracting and consulting which signifies that I’ve needed to discover and perceive a number of codebases briefly quantities of time. Generally even having to discover a number of codebases without delay each time I’d begin to work for multiple consumer 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 put up, 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 inexpensive period of time.

Meet the workforce

Whereas it is likely to be tempting to get by your introductory calls as quickly as doable so you possibly can spend as a lot time as doable on navigating and exploring a brand new codebase, I extremely advocate letting the code look forward to a short time. Meet the workforce first.

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

Understanding which workforce members know most about particular options, elements of the codebase, instruments which might be utilized in an organization, and so forth additionally helps you determine the proper individual to ask any questions you might need whilst you discover the codebase.

For instance, once I joined Disney nearly six years in the past I wasn’t all that conversant in Swiftlint. I had heard about it however I had no concept what it did precisely. Within the codebase, I noticed some feedback that seemed 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 discovered quite a bit about Swiftlint however as a substitute, I selected to determine who is aware of most about Swiftlint throughout the workforce. Certainly that individual might assist me be taught quite a bit about what Swiftlint was used for and the way it works.

I requested my workforce lead and by chance it was my workforce 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 tip 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 once I ought to or shouldn’t disable sure linter guidelines myself.

One other instance is a newer one.

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

As a substitute of figuring every thing out by myself, I had conversations with a number of workforce members. Generally they had been one-on-one conversations however different occasions I met with two or three individuals without delay.

By these conversations, I discovered about numerous architectural patterns that existed within the codebase. Which of them they thought of to be good suits, and which of them they had been trying to section out. I discovered why sure bits of code had been nonetheless in Goal-C, and which elements of the Goal-C codebase needs to be refactored finally.

I discovered that sure workforce members had spent a whole lot of time engaged on particular options, patterns, and companies throughout the app. They might inform me why sure selections had been made, and which decisions they had been and weren’t notably proud of.

After assembly the workforce I knew a lot extra concerning the undertaking, the codebase, the individuals engaged on the undertaking, and the way issues transfer and evolve throughout the workforce. This was extremely useful info to have as soon as I began to discover the codebase. By understanding the workforce 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 could be gone quickly.

On prime of that, by understanding the workforce, I felt extra empathic about bits of code that I didn’t like or didn’t perceive. I do know who was more likely 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 concerning the complicated part of code.

Break issues

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

Hopefully, the codebase follows some well-established patterns that enable you 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 objective, you possibly can be taught quite a bit concerning the codebase. Generally it helps you uncover sure “this could by no means occur” crashes the place a workforce member used a power 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 perhaps the app is superb about dealing with errors and it signifies that one thing went flawed / not as anticipated however the app informs you about this.

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

By making small modifications that most probably break the app you possibly can be taught tons. It’s a way I usually use simply to see if there are any threads I ought to begin unraveling to be taught increasingly more concerning the cool particulars of a codebase.

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

Deal with a slender scope

Whenever 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 unimaginable. And actually, it most likely is. There’s a great likelihood that almost all builders on the workforce for a big undertaking may have one or two elements of the codebase internalized. They know every thing about it. For every thing else, they’ll roughly know which patterns the code ought to comply with (as a result of the entire workforce follows the identical patterns) and so they might need some sense of how that code interacts with different modules.

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

So why would you be making an attempt to discover all the codebase suddenly?

In case you’re employed on a particular workforce, concentrate on the code that might be maintained by that workforce. Begin exploring and understanding that code in as a lot element as doable, have workforce members present you the way the code works, and see for those who can break among the code.

Generally there will likely be bug tickets or options which you can begin taking a look at to present you a great place to begin to start studying extra a few codebase. If that’s the case, you need to use your tickets that can assist you decide your scope. In case you’re engaged on a bug, concentrate on understanding every thing you possibly can concerning the part of code that appears most probably to be the supply of the bug.

And as all the time, you’ll wish to be in contact with the workforce. Ask them in the event that they can assist you discover one thing to concentrate on initially. When you have got a bug ticket to work on, see if any individual on the workforce can assist you kickstart your analysis; perhaps 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 be taught.

Leverage pair programming

One software that I normally discover to be immensely underused is pair programming. In a number of locations the place I’ve labored, builders choose 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 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 unlimited profit in pairing up with a teammate to discover matters and work on options. Particularly whenever you’ve simply joined a workforce, it’s tremendous vital you have got entry to your workforce members that can assist you navigate the corporate, workforce, and codebase.

Whenever you’re pairing with a teammate throughout your exploration section, you possibly can 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 might need can instantly be bounced off of your programming companion.

Even for those who’re not the individual taking the wheel, there’s a number of profit in seeing any individual else navigate the code and undertaking you’ll work on. Pay shut consideration to sure utilities or instruments they use. In case 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 workforce.

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 train you tons about relationships between sure objects for instance.

Two individuals know multiple, and that is very true whereas onboarding a brand new coworker. So subsequent time a brand new individual joins your workforce, provide them a few pair programming periods. Or for those who’re the brand new joiner see if there’s any individual considering spending a while with you whereas working by some issues and exploring the codebase.

Use breakpoints

Once I was engaged on this put up I requested the neighborhood 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 method to studying extra concerning the completely different views and think about controllers which might be utilized in a undertaking.

A symbolic breakpoint lets you pause the execution of your program when a sure methodology known as on code you may not personal. For instance, you possibly can 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.

Understanding this type of stuff is tremendous helpful since you’ll be capable of be taught which view controller(s) belong to which display fairly shortly.

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

In Abstract

Whenever you be a part of a brand new workforce, it’s tempting to maintain your head down and research your new codebase. In your head, you may suppose that you just’re anticipated to already know every thing concerning the codebase although you’re fully new to the undertaking.

You may suppose that each one patterns and practices within the undertaking are trade commonplace 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 and so they forestall you from correctly studying and exploring a brand new codebase.

On this put up, you have got discovered some tips on why human interplay is extraordinarily vital throughout your exploration section. You additionally discovered some helpful ideas for the extra technical aspect 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