HomeiOS DevelopmentIdeas 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 commonly a frightening and scary process. It’s a must to get aquatinted with not only a entire new group of individuals, however you additionally must familiarize your self with a completely new codebase which 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 if you’re a brand new member of any engineering group, and there’s no purpose to really feel dangerous about that.

Previously two years, I’ve accomplished a number of contracting and consulting which signifies that I’ve needed to discover and perceive a lot of codebases briefly quantities of time. Generally even having to discover a number of codebases directly each time I’d begin to work for multiple shopper in a given week or two.

I suppose it is honest 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 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 group

Whereas it may be tempting to get by way of your introductory calls as quickly as attainable so you possibly can 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 while. Meet the group first.

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

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 suitable particular person to ask any questions you might need when you discover the codebase.

For instance, after 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 thought what it did precisely. Within the codebase, I noticed some feedback that regarded 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 lots about Swiftlint however as a substitute, I selected to determine who is aware of most about Swiftlint inside the group. Absolutely that particular person may assist me be taught lots 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 an excellent 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 may have taught me that the remark you noticed earlier disabled a selected 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.

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

As an alternative of figuring every part out by myself, I had conversations with a lot of group members. Generally they have been one-on-one conversations however different instances I met with two or three individuals directly.

Via these conversations, I realized about numerous architectural patterns that existed within the codebase. Which of them they thought-about 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 elements of the Goal-C codebase ought to be refactored finally.

I realized that sure group members had spent a number 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 significantly pleased with.

After assembly the group I knew a lot extra in regards to the undertaking, the codebase, the individuals 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. Via 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 could be gone quickly.

On prime 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 pissed off about that little bit of code, I knew who I may 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 wish to begin exploring the codebase itself sooner slightly than later. One of many key issues to determine is how the undertaking is ready up. Which code is chargeable for what? How does one factor affect the opposite?

Hopefully, the codebase follows some well-established patterns that aid you 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 function, you possibly can be taught lots in regards to the codebase. Generally it helps you uncover sure “this could by no means occur” crashes the place a group member used a pressure unwrap or wrote a guard let with a fatalError inside.

Different instances issues break in additional refined 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 improper / not as anticipated however the app informs you about this.

Whenever 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 most probably break the app you possibly can be taught tons. It’s a way 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 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 focus of my subsequent tip.

Give attention to a slim scope

Whenever you be a part of a big sufficient codebase, the thought of getting all of that code in your head sooner or later sounds not possible. And truthfully, it in all probability is. There’s an excellent likelihood that the majority builders on the group for a big undertaking can have one or two elements 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 group 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 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 all the codebase all of sudden?

In the event you’re employed on a selected group, concentrate on the code that will 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 among the code.

Generally there can be bug tickets or options which you could begin to provide you an excellent start line 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 the event you’re engaged on a bug, concentrate on understanding every part you possibly can in regards to the part of code that appears most probably to be the supply of the bug.

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

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

Leverage pair programming

One software that I normally discover to be immensely underused is pair programming. In a lot of locations the place I’ve labored, builders desire 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 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 if you’ve simply joined a group, it’s tremendous vital you’ve got entry to your group members that can assist you navigate the corporate, group, and codebase.

Whenever you’re pairing with a teammate throughout your exploration part, 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’ve 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 in case you’re not the particular person taking the wheel, there’s a lot of profit in seeing anyone else navigate the code and undertaking you’ll work on. Pay shut consideration to sure utilities or instruments they use. In the event 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 all people on the group.

Particularly when there’s debugging concerned it pays dividends to ask for a pairing session. Seeing anyone 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 particular person joins your group, supply them a few pair programming classes. Or in case you’re the brand new joiner see if there’s anyone concerned about spending a while with you whereas working by way of some issues and exploring the codebase.

Use breakpoints

Once I was engaged on this put up 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 strategy to studying extra in regards to the totally 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 technique is named on code you won’t 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.

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

I haven’t used this one lots myself however I discovered it an attention-grabbing thought so I wished to incorporate it on this listing of ideas.

In Abstract

Whenever you be a 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 just’re anticipated to already know every part in regards to the codebase although you’re utterly new to the undertaking.

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

On this put up, you’ve got realized some recommendations on why human interplay is extraordinarily vital throughout your exploration part. You additionally realized 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!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments