Profile picture

Code Review Q&A and Videos

About Code Review

How to handle the situation as a CodeOwner and push back Large Pull Request from External Team?

Anonymous User at Taro Community profile pic
Anonymous User at Taro Community

How can I handle a situation where I am frequently asked to review Pull Requests for our large monolithic application that powers web, mobile, and platform services, but some of these requests involve over 2000 lines of code and 53 modified JavaScript files from teams outside my own, and I lack context on the new features being added?

Despite declining these requests and suggesting alternative solutions, such as recommending another engineer with more familiarity with the feature, the web team still approves these large Pull Requests. How can I effectively communicate my concerns about the code quality and potential issues or bad coding practices within these large PRs, and what steps can I take to ensure that the appropriate team members are reviewing and approving them?

Context about me & external team: I'm a senior engineer and one of the code owners. I'm responsible for backend changes for API, but I am often asked to review Pull Requests coming from different changes also for Web (React, TypeScript). I noticed a lot of Pull Request coming to me since our codebase is 1 large monolithic application that powers web, mobile, and backend platform services, and it is stored in 1 GitHub Repro.

The external team are people who I do not work directly with and they are new to our codebase, but their team is pushing out new features as new major initiative from another Team and the stake are high for their project to be roll out. Lately, there's multiple bugs introduced from the external team, and it causes Production issues. And I'm getting buy-in from my Directors that we need to lay down some rules for changes from the external team.

Show more
Posted 2 years ago
101 Views
3 Comments

How can I improve the "flow" of my code?

Final year BSc CS Student at Taro Community profile pic
Final year BSc CS Student at Taro Community

Hi, I've been stuck with my current project and am hoping someone can give me a lead here.

I have different actions which need to be run depending on a variable.

Sometimes, I might have to do an action more than one time in the same "if/else" section, e.g. calling actionX() twice (X->X), or different actions in a sequence: ActionX()->`ActionY()`->`ActionZ()`.

The best approach I have come up with so far is like so:

create a sequence, sequence, which holds all the actions which need to be ran inside of it. Then use a for loop to determine which function to call.

while status is less than 2:
user_input = get_user_input()

processed_input = process_input(user_input)

action_sequence = []



# Determine which sequence to execute based on processed_input

if processed_input is 1:

    action_sequence = ["X", "X"]  # Example: X->X sequence

elseif processed_input is 2:

    action_sequence = ["X", "Y", "Z"]  # Example: X->Y->Z sequence

endif



# Execute the sequence of actions

foreach action in action_sequence:

    if action is "X":

        actionX(processed_input)

    elseif action is "Y":

        actionY(processed_input)

    elseif action is "Z":

        actionZ(processed_input)

    endif

endfor
endwhile

Unfortunately this approach is going to become troublesome real quick.

  1. What is this sort of topic called? Claude is saying System Design or Control Flow, I'm thinking it's a turing machine of some sort but don't know the software design term.
  2. Is there a better way to do this? For example:
    1. What if the actions need to be modified or cancelled? e.g. For the chain X->Y->Z, Action X runs and the loop goes to the next iteration. After Action Y runs it then decides Action X needs to be ran again instead of Z.
    2. The loop runs and then ActionY errors out. I need some way of knowing which actions were successful, which ones errored, which ones failed etc. Or even a count on how many actions took place in the sequence. Perhaps, if it errors, then the chain is dumped and actionE runs instead or something like that.

Sorry if it's a long post, this has been stalling my progress for quite a while now and I just don't know the best way to approach this.

Show more
Posted a month ago
52 Views
1 Comment

Learn About Code Review

Code review is a fundamental part of software engineering. It is a process where engineers review each other’s code to improve its quality and receive feedback. Code review gives your teammates the ability to look at your code closely and catch potential mistakes and bugs early on. This can help stop small issues from turning into larger issues later on. Code review also increases awareness of what teams are working on, encourages cross-pollination between teams, and facilitates discussions about coding standards.
Code review allows you to share knowledge with your team about industry and team best practices. You can uplevel each others’ skills by offering feedback on how to make each others’ code better. You can ensure consistency of code by ensuring contributions to the code base follow the same patterns. When the codebase follows the same patterns, it’s easier to understand, maintain, and grow a project.
There are clear guidelines you can follow to improve your code review process. You should set clear goals for code review by specifying what you want to achieve, usually maintaining high code quality, sharing knowledge, and making sure everyone uses consistent coding patterns. This will set the stage for a focused code review. Give feedback that will improve your teammates’ coding ability instead of just pointing out problems. You should always provide suggestions on how to fix the problems. You can make the code review process smoother by using tools that automatically check for common issues, like code style. These automated tools can catch problems that can be missed in a manual review.
There are some common mistakes and traps that people follow into during code review. You don’t want to focus too much on the nitpicky code style. You should have a discussion once about code style, then you should automate it away which will lead to consistent enforcement of the rule and save your team time so they don’t need to constantly look for code style mistakes.
Pay attention how you give feedback because code reviews involve people. You should be positive and considerate when reviewing other people’s code. Recognize the effort put into the code and create an atmosphere where everyone feels encouraged to work together.
As the code author, you should develop a sense of empathy for the person that is reviewing your code. This means making the review process as smooth as possible for them and being grateful for the time they spend reviewing your code. This can mean adding context in your pull requests and including before and after screenshots.
Remember that code review can have many benefits in software engineering. It helps to keep code quality high, encourages teamwork, and it makes sure that everyone follows the same patterns. Software engineers can use code review to boost the overall success of their development efforts.
Show more