Javascript required
Skip to content Skip to sidebar Skip to footer

Read Engine Codes on 2014 Durango Without Code Reader

How to propel new engineers with lawmaking review

Eric Pelz HackerNoon profile picture

Maximizing mentorship, improving code quality, and saving time

Code review can be one of the most effective and collaborative avenues for mentorship. Photograph by Helloquence.

Many think of code review as a tool to preclude bugs from hitting production, or to ensure that code meets a certain quality bar. While it's often those things, it's too an incredible tool for mentorship. Since there's already a second person reading over the lawmaking, why non do it in a manner that will teach and inspire?

During my time at Asana, I've had the pleasure of existence on a few different teams and onboarding a bunch of new engineers (some new graduates and some seasoned engineers), and accept seen offset hand the benefit of code review for mentorship. But I've likewise seen code reviews gone wrong — for example, a unequal that suffers from large issues, just the reviewer but responding with a simple "LGTM" or lots of surface-level nits. Though skilful code reviewing does accept some time, I've institute some tips and tricks to best leverage that time, with the goals of mentoring new engineers, keeping team velocity high, and maintaining high quality code.

Code review is not the right tool for everything

While code review is crawly, it's certainly not appropriate for all kinds of feedback. By the time lawmaking reaches review, it's already been written: an engineer has already thought through a design, implemented it, tested it, and polished everything upward. Imagine going through these steps, then hearing your reviewer say "this is a bad manner to do this, you could've avoided X by doing Y." That's extremely demotivating and necessitates large revisions and more follow-upward reviews. Instead, you should discuss changes before implementation — either through a pattern md or fifty-fifty a uncomplicated conversation — to get purchase-in for the overall arroyo.

For tasks that involve large design changes, write up a short outline of what you lot plan to implement (which files, any changes to abstractions, how pieces will fit together) and share it with a teammate before y'all start coding. This will reveal so many great nuggets of learning: ways to structure your thinking and technology design, implementation risks and alternative approaches, and means to split upward your changes into smaller chunks. I've found this leads to a noticeable improvement in code quality, and the net time saving is incredible.

Tips when writing lawmaking

When y'all commit lawmaking, retrieve about the code you lot're almost to commit from the context of a code reviewer. All of us should want the reviewer to have an like shooting fish in a barrel time — not simply volition it save them time, but will as well improve the quality of feedback you lot receive. Consider the following tips:

Give a detailed description and examination programme in the commit message

Information technology sounds giddy, but the commit message is there for a reason! For UI changes, it's extremely helpful to include a screenshot or animated GIF to prove the interactions. This volition put your reviewer in the correct mindset to read your changes, which volition salve them fourth dimension in context switching and help them focus.

Bespeak out whatsoever bug you lot're aware of

1 of my favorite things to do when sending out a lawmaking review is to mention problems I tin anticipate, quirks in my changes, or reasons for certain decisions that I made. This is really helpful, for a few reasons:

  • Highlights these areas for your reviewer so they can give input on whether they concord, or give tips to alleviate risk
  • Saves your reviewer fourth dimension for code with complexity, as they can understand why the complexity is in that location
  • A future engineer who looks at the code can find the review task, and can gain insight into your thought process and decision

Split your commit into digestible chunks

This is a huge fourth dimension-saver, and I believe also leads to better lawmaking. Splitting commits into small chunks helps you exist cognizant of bad test coverage, bad documentation, or other common issues. Additionally, information technology helps your reviewer by reducing the surface surface area of each commit, thus saving them time to understand the context of the change and leads to better feedback.

Note: Git provides some tools to assist you do this, like git add -i.

Find you're receiving similar feedback over and over?

Often when you're new to an arrangement or codebase, it's inevitable that you're going to hit a lot of pocket-size issues while you're still getting used to the environment. For new engineers on my team, I've found it helpful to create a task in our 1:ane project called "Mutual Lawmaking Review Feedback". Whenever 1 of the states noticed a new common theme in code review, we add together it to this task. This serves two purposes: to provide an avenue to hash out these items (e.g. why does this affair? how can I identify this earlier code review?), as well as rail progress towards ameliorate quality code. I've seen this in action a few times, and information technology's served as an amazing motivator and positive reinforcement — both for the committer, and the reviewer to meet their feedback being heard.

Tips when reviewing lawmaking

Strategies for efficient reviewing

It'due south sometimes hard to strike a good balance betwixt a quick "LGTM", but finding surface-level bug in lawmaking, and spending hours reviewing a change. It's not easy, especially when changes aren't in an expanse of the lawmaking that you're very familiar with. In these cases, I try to break down the code review procedure into a few parts:

  1. Go a high-level sense of the changes
    First, read the commit message. If this is a UI change, look at a screenshot or GIF of the modify.
  2. Get a sense of the surface area of the changes
    Read the list of files that were changed. Have you seen these files recently? If non, skim them first (API and documentation) to get a sense of them. If there's style also much context to gain, consider cc'ing someone else.
    By gaining more context of the changed files, you lot can limit the number of times yous add together comments and subsequently keep reading to find out they were all for moot.
  3. Skim the changes to see if there were any API, abstraction, or structural changes
    Don't look at the actual implementation changes yet. One of the most important things to encounter is how the change fits into the overall organisation. Is there a follow-up modify (by someone else) coming which is incompatible with these changes? Volition the changes lead to an intractable or complex pattern that others will want to follow?
    You may decide that the entire approach should be rethought. In these cases, exist tactful in how you explicate your thoughts (I often choose to ask leading questions or relate to other examples). Additionally, consider that you may be missing context and could be wrong — the engineer probably had good reason to do what they chose.
  4. Finally, look at the actual implementation changes and tests
    Now, once you're happy with the loftier level changes, go through the code and look for surface-level feedback. For case, are their methods unproblematic and easy to understand? Do they follow best practices and style guidelines? Have they given acceptable comments? Practice their changes have ample test coverage, or have a adept reason to miss tests?

Proceed giving the same feedback?

This tin be frustrating, especially if information technology's to multiple people. Consider writing a canonical case or documentation of the best practices and link to information technology in future code reviews. Not only will this save you typing, but will also hateful that others tin read this reference, expand upon information technology, or inquire you questions about the underlying motivations or philosophy.

Ane of my favorite ways to do this is equally function of an "example component" and "example test": actual code that lives and breathes like all other code, just with the single purpose of educating on best practices and underlying motivations.

Spending a lot of time on lawmaking review?

Is it with a specific person? Consider spending some time to reflect on the past few lawmaking reviews. Exercise you discover any themes? There might be an underlying reason they're non improving, like a lack of clarity in the company's engineering values, or a misalignment in some technology philosophy. I've often institute it helpful to send manufactures or videos on certain areas in engineering, and to talk to the engineer in person.

Do you ofttimes receive code that is hard to review? Tell the engineer! No one intentionally makes life difficult for their reviewer. Explain to them why the code is hard to review (due east.k. the commits are besides large, commit messages are disruptive, or the lawmaking is just too complex). Information technology may also assistance to review the code with them in person, which will help them come across why it's difficult to review. Additionally, don't be afraid to decline the change and inquire them to address the problems with the commit structure or messages; the merely fashion to improve this is to surface the outcome.

Giving way too many pocket-size nit comments?

Sometimes, especially for new engineers, there are many small but important things to mention. It would be ideal for these to be handled past a compiler or linter, but sometimes that isn't possible. Be mindful of your feedback — it might be best to but mention a subset at a time, or explicate the loftier-level philosophy of the style guidelines in person. Otherwise, you risk decision fatigue for yourself equally the reviewer, and the engineer is likely to feel overwhelmed when seeing the never-ending stream of comments. Y'all can always proceed to teach the engineer, and they'll blot more information if yous incrementally introduce them to new concepts and learnings.

Feeling overwhelmed past a review in your inbox?

Every so often, I'll get a code review for something that I'm not super excited to look at. Whether it'southward old code that I haven't worked in months, or an expanse of the codebase that's notoriously complex. This is totally normal, but it'southward not doing anyone whatever good, so reverberate on this and be existent. Information technology may be best to pass the review to someone else who is a better person for the review, or, if it's not fourth dimension sensitive, to snooze it for a few days.

Thanks to Greg Slovacek for support and contributions, and to R.J. Aquino, Tim Bavaro, Kevin Der, Bella Kazwell, Vincent Siao, and Isaac Wolkerstorfer for reviewing a draft.

Want more than tips? Follow me on Medium for more posts similar this one.

Tags

# code-review# software-development# mentorship# code# engineering

Related Stories

Read Engine Codes on 2014 Durango Without Code Reader

Source: https://hackernoon.com/maximizing-mentorship-in-code-review-f479ae74fe3f