Thursday, September 28, 2023
HomeiOS DevelopmentIdeas and tips for exploring a brand new codebase – Donny Wals

Ideas and tips 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 group of individuals, however you additionally should familiarize your self with a completely new codebase that may use new naming conventions, follows patterns that you simply’re not conversant in, and even makes use of tooling that you simply’ve by no means seen earlier than.

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

Previously two years, I’ve completed loads of contracting and consulting which implies that I’ve needed to discover and perceive numerous codebases in brief quantities of time. Typically even having to discover a number of codebases without delay at any time when I’d begin to work for multiple shopper in a given week or two.

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

On this put up, I’d prefer to give you some ideas and tips that I take advantage of to get myself comfy with codebases of any measurement in an affordable period of time.

Meet the group

Whereas it is perhaps tempting to get by means of your introductory calls as quickly as attainable so you’ll be able to spend as a lot time as attainable on navigating and exploring a brand new codebase, I extremely advocate letting the code await a short while. Meet the group first.

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

Figuring out which group members know most about particular options, elements of the codebase, instruments which can be utilized in an organization, and so forth additionally helps you determine the appropriate particular person to ask any questions you might need whilst you discover the codebase.

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

// swiftlint:disable:subsequent cyclomatic_complexity

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

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

We had an excellent 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 generally.

Google may 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 newer one.

Certainly one of 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 an alternative of figuring all the things out by myself, I had conversations with numerous group members. Typically they had been one-on-one conversations however different instances I met with two or three folks without delay.

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

I realized that sure group members had spent loads of time engaged on particular options, patterns, and companies inside the app. They might inform me why sure choices had been made, and which decisions they had been and weren’t significantly pleased with.

After assembly the group I knew a lot extra in regards to the undertaking, the codebase, the folks engaged on the undertaking, and the way issues transfer and evolve inside the group. This was extremely useful data to have as soon as I began to discover the codebase. By means 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 value exploring an excessive amount of as a result of it will be gone quickly.

On high of that, by means 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 more likely to have labored on that code. So as an alternative of getting annoyed about that little bit of code, I knew who I may ask to study extra in regards to the complicated part of code.

Break issues

Along with assembly the group behind your new codebase, you’ll wish to begin exploring the codebase itself sooner quite 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 affect the opposite?

Hopefully, the codebase follows some well-established patterns that enable you 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 objective, you’ll be able to study rather a lot 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 power unwrap or wrote a guard let with a fatalError inside.

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

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

By making small adjustments that most certainly break the app you’ll be able to study tons. It’s a way I typically use simply to see if there are any threads I ought to begin unraveling to study increasingly more in regards to the cool particulars of a codebase.

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

Deal with a slim scope

Once you be part of a big sufficient codebase, the thought of getting all of that code in your head sooner or later sounds unimaginable. And actually, it in all probability is. There’s an excellent probability that the majority builders on the group for a big undertaking may have one or two elements of the codebase internalized. They know all the things about it. For all the things else, they’ll roughly know which patterns the code ought to comply with (as a result of the entire group follows the identical patterns) they usually might need some sense of how that code interacts with different modules.

General although, it’s simply not practical for any group 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 the complete codebase all of sudden?

When you’re employed on a particular group, give attention to the code that might 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 might be bug tickets or options you can begin taking a look at to provide you an excellent place to begin to start studying extra a few codebase. If that’s the case, you should utilize your tickets that will help you decide your scope. When you’re engaged on a bug, give attention to understanding all the things you’ll be able to in regards to the part of code that appears most certainly to be the supply of the bug.

And as all the time, you’ll wish to be in contact with the group. Ask them in the event that they can assist you discover one thing to give attention to initially. When you’ve a bug ticket to work on, see if someone on the group can assist you kickstart your analysis; perhaps they’ve some ideas on the place you can begin wanting first.

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

Leverage pair programming

One instrument that I often 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 ought to be initiated on Slack so that you’re disturbed as little as attainable. Disable notifications if it’s important to.

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

Nonetheless, there’s an unlimited profit in pairing up with a teammate to discover subjects and work on options. Particularly while you’ve simply joined a group, it’s tremendous essential you’ve entry to your group members that will help you navigate the corporate, group, and codebase.

Once you’re pairing with a teammate throughout your exploration section, you’ll be able to take the wheel. You can begin exploring the codebase, asking questions on what you’re seeing as you go. Particularly when you’ve 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 associate.

Even in case you’re not the particular person taking the wheel, there’s numerous profit in seeing someone else navigate the code and undertaking 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. Perhaps these git instructions your coworker makes use of are utilized by everyone on the group.

Particularly when there’s debugging concerned it pays dividends to ask for a pairing session. Seeing someone that’s skilled with a codebase navigate and debug their code will train 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 particular person joins your group, supply them a few pair programming periods. Or in case you’re the brand new joiner see if there’s someone all for spending a while with you whereas working by means of some issues and exploring the codebase.

Use breakpoints

Once I was engaged on this put up I requested the group 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 reasonably cool strategy to studying extra in regards to the completely different views and examine controllers which can be utilized in a undertaking.

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

Figuring out this sort of stuff is tremendous helpful since you’ll have the ability to study which view controller(s) belong to which display screen fairly shortly.

I haven’t used this one rather a lot myself however I discovered it an fascinating thought so I wished to incorporate it on this record of ideas.

In Abstract

Once you be part of a brand new group, it’s tempting to maintain your head down and examine your new codebase. In your head, you would possibly suppose that you simply’re anticipated to already know all the things in regards to the codebase regardless that you’re fully new to the undertaking.

You would possibly suppose that every one patterns and practices within the undertaking are business commonplace and that you simply 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 stop you from correctly studying and exploring a brand new codebase.

On this put up, you’ve realized some recommendations on why human interplay is extraordinarily essential throughout your exploration section. You additionally realized some helpful ideas for the extra technical facet of issues that will help you successfully sort out studying a brand new codebase.

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



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments