Skip to content

Conversation

@thomaskileyukaea
Copy link
Contributor

@thomaskileyukaea thomaskileyukaea commented Jul 27, 2023

Changes to the code review section, fixes #217

The exercises are going to have the reader be reviewing a pull request identical to this one: thomaskileyukaea/python-intermediate-inflammation#3

One major outstanding issue is how to get the example branch onto the users repo (templates don't copy branches in a way that would work).

It may be easiest to see the changes commit by commit, as I did the structural changes first, before adding new things.

  • Rewrite Code Review and Pull Requests In Action for the new exercise
  • Update branch diagram for new branch situation (or remove)
  • Update screen shot for the new pull request
  • Update Raising a pull request for the new exercise
  • Screenshot todos
  • Fix numbering
  • Tidy up or remove Best Practice for Code Review
  • Line by line edit of new content
  • SemBr pass
  • Final read through

@thomaskileyukaea
Copy link
Contributor Author

I've added the last of the missing sections. This is ready for a structural / content review. Once I've got that I will do a line by line edit to make sure it makes sense / flows.

Copy link
Contributor Author

@thomaskileyukaea thomaskileyukaea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation of why I removed certain sections / exercises as well as some ❓ questions for the maintainers that we should think about before merging this.

Comment on lines -68 to -99
> ## Group Exercise: Advantages of Code Review
> Discuss as a group: what do you think are the reasons behind, and advantages of, code review?
> > ## Solution
> > The purposes of code review include:
> > - improving internal code readability, understandability, quality and maintainability
> > - checking for coding standards compliance, code uniformity and consistency
> > - checking for test coverage and detecting bugs and code defects early
> > - detecting performance problems and identifying code optimisation points
> > - finding alternative/better solutions.
> >
> > An effective code review prevents errors from creeping into your software
> > by improving code quality at an early stage of the software development process.
> > It helps with learning, i.e. sharing knowledge about the codebase,
> > solution approaches,
> > expectations regarding quality,
> > coding standards, etc.
> > Developers use code review feedback from more senior developers
> > to improve their own coding practices and expertise.
> > Finally, it helps increase the sense of collective code ownership and responsibility,
> > which in turn helps increase the "bus factor"
> > and reduce the risk resulting from information and capabilities
> > being held by a single person "responsible" for a certain part of the codebase
> > and not being shared among team members.
> {: .solution}
{: .challenge}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't think this exercise added much and I wanted to add other more exercises - but I'm happy to discuss.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to agree that this doesn't add much. It has a large amount of overlap with the similar
"reflective" exercise at the very end of the episode, which I do think adds some value because it
gets participants to actively think about how they might use code review in their own work.
Moreover, this exercise comes quite early in the lesson before much has been said about code review. I imagine
anyone who hasn't come across code review before won't have much to contribute to the discussion at
this point.

However, I haven't run the course with this episode, so it would be good to get some input from
@anenadic @steve-crouch @smangham @douglowe about whether this exercise generated any valuable
discussion about code review.

Comment on lines 112 to 160
There are several **code review techniques** with various degree of formality
and the use of a technical infrastructure, including:

- **Over-the-shoulder code review**
is the most common and informal of code review techniques and involves
one or more team members standing over the code author's shoulder
while the author walks the reviewers through a set of code changes.
- **Email pass-around code review**
is another form of lightweight code review where the code author
packages up a set of changes and files and sends them over to reviewers via email.
Reviewers examine the files and differences against the code base,
ask questions and discuss with the author and other developers,
and suggest changes over email.
The difficult part of this process is the manual collection the files under review
and noting differences.
- **Pair programming**
is a code development process that incorporates continuous code review -
two developers sit together at a computer,
but only one of them actively codes whereas the other provides real-time feedback.
It is a great way to inspect new code and train developers,
especially if an experienced team member walks a younger developer through the new code,
providing explanations and suggestions through a conversation.
It is conducted in-person and synchronously but it can be time-consuming
as the reviewer cannot do any other work during the pair programming period.
- **Fagan code inspection**
is a formal and heavyweight process of finding defects in specifications or designs
during various phases of the software development process.
There are several roles taken by different team members in a Fagan inspection
and each inspection is a formal 7-step process with a predefined entry and exit criteria.
See [Fagan inspection](https://en.wikipedia.org/wiki/Fagan_inspection)
for full details on this method.
- **Tool-assisted code review**
process uses a specialised tool to facilitate the process of code review,
which typically helps with the following tasks:
(1) collecting and displaying the updated files and highlighting what has changed,
(2) facilitating a conversation between team members (reviewers and developers), and
(3) allowing code administrators and product managers
a certain control and overview of the code development workflow.
Modern tools may provide a handful of other functionalities too, such as metrics
(e.g. inspection rate, defect rate, defect density).

Each of the above techniques have their pros and cons and varying degrees practicality -
it is up to the team to decide which ones are most suitable for the project and when to use them.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this section contributes to the goals, so removing this gives more time to focus on the kind of review system we're recommending - tool assisted review.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the level of detail isn't needed for the objectives of this section. However, it might
be nice to mention somewhere that tool-assisted code review on GitHub isn't the only way to do code
review, and then list these types so that learners can go look at them if they are interested. The
next paragraph seems like the obvious place to do this.

Copy link
Collaborator

@bielsnohr bielsnohr Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see that this is briefly mentioned in one of the sections below now, so ignore my comment
above. I'm now fine to get rid of this section.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will make this adjustment as I think you're right, it is nice to have some other terms to look up, but with less detail.

Comment on lines -248 to -278
To achieve this, the following steps are needed.

#### Step 1: Adding Collaborators to a Shared Repository

You need to add the other team member(s) as collaborator(s) on your repository
to enable them to create branches and pull requests.
To do so, each repository owner needs to:

1. Head over to Settings section of your software project's repository in GitHub.
![Accessing settings for a repository in GitHub](../fig/github-settings.png){: .image-with-shadow width="900px"}
2. Select the **vertical** tab 'Collaborators' from the left and click the 'Add people' button.
![Managing access to a repository in GitHub](../fig/github-manage-access.png){: .image-with-shadow width="900px"}
3. Add your collaborator(s) by their GitHub username(s), full name(s) or email address(es).
![Adding collaborators to a repository in GitHub](../fig/github-add-collaborators.png){: .image-with-shadow width="900px"}
4. Collaborator(s) will be notified of your invitation to join your repository
based on their notification preferences.
5. Once they accept the invitation, they will have the collaborator-level access to your repository
and will show up in the list of your collaborators.

See the full details on
[collaborator permissions for personal repositories](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings/permission-levels-for-a-user-account-repository)
to understand what collaborators will be able to do within your repository.
Note that repositories owned by an organisation have a
[more granular access control](https://docs.github.com/en/get-started/learning-about-github/access-permissions-on-github)
compared to that of personal repositories.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I restructured the examples so they don't require adding collaborators. I would be tempted to move this into the extras though, as it might be useful in some instances to know how to do this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The language above (L149 in changed file) still mentions adding collaborators and then the
description of the exercise is still claiming that the learner will implement the tests of SR1.1.1
or 1.2.1. I am assuming that this still needs to be reworked? Just wanted to flag in case it slipped
off your radar.

My other concern with removing this particular section about adding collaborators is that future
exercises will require participants to work in groups on a single shared repository. If we don't do
the steps of adding a collaborator here, we will need to more it to a more suitable location. I
think Assessing Software for Suitability and
Improvement

is probably the natural place.

Comment on lines -274 to -316
#### Step 2: Preparing Your Local Environment for a Pull Request

1. Obtain the GitHub URL of the shared repository you will be working on and clone it locally
(make sure you do it outside your software repository's folder you have been working on so far).
This will create a copy of the repository locally on your machine
along with all of its (remote) branches.
~~~
$ git clone <remote-repo-url>
$ cd <remote-repo-name>
~~~
{: .language-bash}
2. Check with the repository owner (your team member)
which feature (SR1.1.1 or SR1.2.1) they implemented in the
[previous exercise](/32-software-design/index.html#implement-requirements)
and what is the name of the branch they worked on.
Let's assume the name of the branch was `feature-x`
(you should amend the branch name for your case accordingly).
3. Your task is to add tests for the code on `feature-x` branch.
You should do so on a separate branch called `feature-x-tests`,
which will branch off `feature-x`.
This is to enable you later on to create a pull request
from your `feature-x-tests` branch with your changes
that can then easily be reviewed and compared with `feature-x`
by the team member who created it.

To do so, branch off a new local branch `feature-x-tests` from the remote `feature-x` branch
(making sure you use the branch names that match your case).
Also note that, while we say "remote" branch `feature-x` -
you have actually obtained it locally on your machine when you cloned the remote repository.
~~~
$ git checkout -b feature-x-tests origin/feature-x
~~~
{: .language-bash}

You are now located in the new (local) `feature-x-tests` branch
and are ready to start adding your code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the exercises are reviewing a fixed changeset this is no longer required.

Comment on lines 313 to 351
> ## Exercise: Implement Tests for the New Feature
> Look back at the
> [solution requirements](/31-software-requirements/index.html#solution-requirements)
> (SR1.1.1 or SR1.2.1)
> for the feature that was implemented in your shared repository.
> Implement tests against the appropriate specification in your local feature branch.
>
> *Note: Try not to not fall into the trap of
> writing the tests to test the existing code/implementation -
> you should write the tests to make sure the code satisfies the requirements
> regardless of the actual implementation.
> You can treat the implementation as a
> [black box](https://en.wikipedia.org/wiki/Black-box_testing) -
> a typical approach to software testing -
> as a way to make sure it is properly tested against its requirements
> without introducing assumptions into the tests about its implementation.*
{: .challenge}

> ## Testing Based on Requirements
> Tests should test functionality,
> which stem from the software requirements,
> rather than an implementation.
> Tests can be seen as a reflection of those requirements -
> checking if the requirements are satisfied.
{: .callout}

Remember to commit your new code to your branch `feature-x-tests`.

~~~
$ git add -A
$ git commit -m "Added tests for feature-x."
~~~
{: .language-bash}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above - reader is no longer required to write some tests for someone else to review

Comment on lines 359 to 381
### What not to look for

The overriding priority for reviewing code should be making sure progress is being made -
don't let perfect be the enemy of good here. Further, research has shown that the first hour
of reviewing code is the most effective, with diminishing returns after that.

To that end, here are a few things you shouldn't be trying to spot when reviewing:

#### Linting issues, or anything else that an automated tool can spot

Get the CI to do this - this will save the reviewer time, be more accurate
and avoid needless conflict.

#### Bugs

It is easier to make sure there are sufficient tests - you are not an accurate
computer simulator anyway.

#### Issues that pre-date the change

You may spot something that the reviewer didn't introduce and think they could
fix it while in the area, but this can be a rabbit hole. A better approach would be to
raise a PR after this one has been merged fixing the thing you spotted.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ I'm not sure this is actually that useful so I'm tempted to just cut it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sort of like this because it helps focus what code review should be about. That being said, it
isn't as important as the previous tips about what to look for, so perhaps we assess this based on
how long the section takes to deliver?

Comment on lines 522 to 543
## Designing a review process

To maximize the benefit of a code review it needs a process that is followed by everyone
involved, and that everyone believes that process provides value.

One way to foster this is to design the process as a team. When you're doing this you
should consider:

* Do all changes need to go through code review
* What technologies will you use to manage the review process
* How quickly do you expect someone to review the code once you've raised a PR?
* How long should be spent reviewing code?
* What kind of issues are (and aren't) appropriate to raise in a PR?
* How will someone know when they are expected to take action (e.g. review a PR).

Once you've introduced a review process, you should monitor (either formally or
informally) how well it is working.

It is important that reviews are processed quickly, to avoid costly context switching.
We recommend aiming for 3 hours to get a first review, with the PR being merged the same
day in most cases. If you are regularly missing these targets, then you should review
where things are getting stuck and work out what you can do to move things along.
Copy link
Contributor Author

@thomaskileyukaea thomaskileyukaea Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Here I am assuming the reader is part of a team. However, I remember in discussions we talked how lots of users of this course are working independently. How do those scientists who are working independently use the code review section? Do they find someone else in their dept to review their code, reviewing it themselves, or just skipping this section?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good question. As someone who has lone coded in various scientific settings, I still use
merge/pull requests as a gate check on what I have just done. Of course, I haven't done that in
every instance, but it is a nice idea to strive for.

In terms of actual code review, this is tough. I was part of a community effort to try and define
what code review in research might look like: https://dev-review.readthedocs.io/en/latest/index.html

There, we did recommend trying to find someone to review your code. That person could be in your
research group (but just not working directly on what you are). We could link to that page here do
deal with the case of solo researchers working on code.

@bielsnohr bielsnohr self-requested a review August 2, 2023 13:29
Copy link
Collaborator

@bielsnohr bielsnohr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I really like where this is heading. The exercise based on a pre-determined changeset should help better achieve the objectives of this section. In the previous version, not having control over the incoming changes meant that learners might not see many of the points being raised in this section. So, this new approach gets my full endorsement.

It will be great to see how the section flows once the wording around this new exercise is added.

Comment on lines -68 to -99
> ## Group Exercise: Advantages of Code Review
> Discuss as a group: what do you think are the reasons behind, and advantages of, code review?
> > ## Solution
> > The purposes of code review include:
> > - improving internal code readability, understandability, quality and maintainability
> > - checking for coding standards compliance, code uniformity and consistency
> > - checking for test coverage and detecting bugs and code defects early
> > - detecting performance problems and identifying code optimisation points
> > - finding alternative/better solutions.
> >
> > An effective code review prevents errors from creeping into your software
> > by improving code quality at an early stage of the software development process.
> > It helps with learning, i.e. sharing knowledge about the codebase,
> > solution approaches,
> > expectations regarding quality,
> > coding standards, etc.
> > Developers use code review feedback from more senior developers
> > to improve their own coding practices and expertise.
> > Finally, it helps increase the sense of collective code ownership and responsibility,
> > which in turn helps increase the "bus factor"
> > and reduce the risk resulting from information and capabilities
> > being held by a single person "responsible" for a certain part of the codebase
> > and not being shared among team members.
> {: .solution}
{: .challenge}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to agree that this doesn't add much. It has a large amount of overlap with the similar
"reflective" exercise at the very end of the episode, which I do think adds some value because it
gets participants to actively think about how they might use code review in their own work.
Moreover, this exercise comes quite early in the lesson before much has been said about code review. I imagine
anyone who hasn't come across code review before won't have much to contribute to the discussion at
this point.

However, I haven't run the course with this episode, so it would be good to get some input from
@anenadic @steve-crouch @smangham @douglowe about whether this exercise generated any valuable
discussion about code review.

Comment on lines 112 to 160
There are several **code review techniques** with various degree of formality
and the use of a technical infrastructure, including:

- **Over-the-shoulder code review**
is the most common and informal of code review techniques and involves
one or more team members standing over the code author's shoulder
while the author walks the reviewers through a set of code changes.
- **Email pass-around code review**
is another form of lightweight code review where the code author
packages up a set of changes and files and sends them over to reviewers via email.
Reviewers examine the files and differences against the code base,
ask questions and discuss with the author and other developers,
and suggest changes over email.
The difficult part of this process is the manual collection the files under review
and noting differences.
- **Pair programming**
is a code development process that incorporates continuous code review -
two developers sit together at a computer,
but only one of them actively codes whereas the other provides real-time feedback.
It is a great way to inspect new code and train developers,
especially if an experienced team member walks a younger developer through the new code,
providing explanations and suggestions through a conversation.
It is conducted in-person and synchronously but it can be time-consuming
as the reviewer cannot do any other work during the pair programming period.
- **Fagan code inspection**
is a formal and heavyweight process of finding defects in specifications or designs
during various phases of the software development process.
There are several roles taken by different team members in a Fagan inspection
and each inspection is a formal 7-step process with a predefined entry and exit criteria.
See [Fagan inspection](https://en.wikipedia.org/wiki/Fagan_inspection)
for full details on this method.
- **Tool-assisted code review**
process uses a specialised tool to facilitate the process of code review,
which typically helps with the following tasks:
(1) collecting and displaying the updated files and highlighting what has changed,
(2) facilitating a conversation between team members (reviewers and developers), and
(3) allowing code administrators and product managers
a certain control and overview of the code development workflow.
Modern tools may provide a handful of other functionalities too, such as metrics
(e.g. inspection rate, defect rate, defect density).

Each of the above techniques have their pros and cons and varying degrees practicality -
it is up to the team to decide which ones are most suitable for the project and when to use them.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the level of detail isn't needed for the objectives of this section. However, it might
be nice to mention somewhere that tool-assisted code review on GitHub isn't the only way to do code
review, and then list these types so that learners can go look at them if they are interested. The
next paragraph seems like the obvious place to do this.

Comment on lines -248 to -278
To achieve this, the following steps are needed.

#### Step 1: Adding Collaborators to a Shared Repository

You need to add the other team member(s) as collaborator(s) on your repository
to enable them to create branches and pull requests.
To do so, each repository owner needs to:

1. Head over to Settings section of your software project's repository in GitHub.
![Accessing settings for a repository in GitHub](../fig/github-settings.png){: .image-with-shadow width="900px"}
2. Select the **vertical** tab 'Collaborators' from the left and click the 'Add people' button.
![Managing access to a repository in GitHub](../fig/github-manage-access.png){: .image-with-shadow width="900px"}
3. Add your collaborator(s) by their GitHub username(s), full name(s) or email address(es).
![Adding collaborators to a repository in GitHub](../fig/github-add-collaborators.png){: .image-with-shadow width="900px"}
4. Collaborator(s) will be notified of your invitation to join your repository
based on their notification preferences.
5. Once they accept the invitation, they will have the collaborator-level access to your repository
and will show up in the list of your collaborators.

See the full details on
[collaborator permissions for personal repositories](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings/permission-levels-for-a-user-account-repository)
to understand what collaborators will be able to do within your repository.
Note that repositories owned by an organisation have a
[more granular access control](https://docs.github.com/en/get-started/learning-about-github/access-permissions-on-github)
compared to that of personal repositories.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The language above (L149 in changed file) still mentions adding collaborators and then the
description of the exercise is still claiming that the learner will implement the tests of SR1.1.1
or 1.2.1. I am assuming that this still needs to be reworked? Just wanted to flag in case it slipped
off your radar.

My other concern with removing this particular section about adding collaborators is that future
exercises will require participants to work in groups on a single shared repository. If we don't do
the steps of adding a collaborator here, we will need to more it to a more suitable location. I
think Assessing Software for Suitability and
Improvement

is probably the natural place.

Comment on lines 182 to 183
When you have finished adding your tests
and committed the changes to your local `feature-x-tests`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the content below will also need to be removed or updated for the new exercise?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - this is now done.

Comment on lines 359 to 381
### What not to look for

The overriding priority for reviewing code should be making sure progress is being made -
don't let perfect be the enemy of good here. Further, research has shown that the first hour
of reviewing code is the most effective, with diminishing returns after that.

To that end, here are a few things you shouldn't be trying to spot when reviewing:

#### Linting issues, or anything else that an automated tool can spot

Get the CI to do this - this will save the reviewer time, be more accurate
and avoid needless conflict.

#### Bugs

It is easier to make sure there are sufficient tests - you are not an accurate
computer simulator anyway.

#### Issues that pre-date the change

You may spot something that the reviewer didn't introduce and think they could
fix it while in the area, but this can be a rabbit hole. A better approach would be to
raise a PR after this one has been merged fixing the thing you spotted.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sort of like this because it helps focus what code review should be about. That being said, it
isn't as important as the previous tips about what to look for, so perhaps we assess this based on
how long the section takes to deliver?

> have all been addressed, you can approve the PR.
{: .challenge}

#### Step 6: Closing a Pull Request
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need to get rid of "Step 6" and make sure the heading level is in line with the above.

Comment on lines 484 to 501
The most important thing to keep in mind is how long your pull request is. Smaller
changes, that just make one small improvement, will be much quicker and easier to
review. There is no golden rule, but 100 - 500 lines is a good size. More than
1000 lines is almost certainly too big.

Even within a single review, try to keep each commit to be making one logical change.
This can help if your review would otherwise be too large. In particular, if you've
reformatted, refactored and changed the behavior of the code make sure each of these
is in a separate commit (i.e reformat the code, commit, refactor the code, commit, alter
the behavior of the code, commit).

Make sure you write a clear description of the content and purpose of the change.
This should be provided as the pull request description.
This should provide the context that reading the code will make more sense.

It is also a good idea to review your code yourself. In doing this you will spot
the more obvious issues with your code, allowing your reviewer to focus on the
things you cannot spot.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The paragraphs need some semantic breaks at periods.

Comment on lines 505 to 510
Code is written by humans (mostly!), and code review is a form of communication. As such
empathy is really important for effective reviewing.

When reviewing code, it can be sometimes frustrating when code is confusing, particularly
as it will be implemented differently to how you would have done it. However, it is important
as a reviewer to be compassionate to the person whose code you are reviewing. Specifically:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sembr

Comment on lines 522 to 543
## Designing a review process

To maximize the benefit of a code review it needs a process that is followed by everyone
involved, and that everyone believes that process provides value.

One way to foster this is to design the process as a team. When you're doing this you
should consider:

* Do all changes need to go through code review
* What technologies will you use to manage the review process
* How quickly do you expect someone to review the code once you've raised a PR?
* How long should be spent reviewing code?
* What kind of issues are (and aren't) appropriate to raise in a PR?
* How will someone know when they are expected to take action (e.g. review a PR).

Once you've introduced a review process, you should monitor (either formally or
informally) how well it is working.

It is important that reviews are processed quickly, to avoid costly context switching.
We recommend aiming for 3 hours to get a first review, with the PR being merged the same
day in most cases. If you are regularly missing these targets, then you should review
where things are getting stuck and work out what you can do to move things along.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good question. As someone who has lone coded in various scientific settings, I still use
merge/pull requests as a gate check on what I have just done. Of course, I haven't done that in
every instance, but it is a nice idea to strive for.

In terms of actual code review, this is tough. I was part of a community effort to try and define
what code review in research might look like: https://dev-review.readthedocs.io/en/latest/index.html

There, we did recommend trying to find someone to review your code. That person could be in your
research group (but just not working directly on what you are). We could link to that page here do
deal with the case of solo researchers working on code.

Without going into detail, shows that there are other options that can
be looked into.
Exercise has changed, so update the text to reflect this.

It is a little confusing that you raise a PR on your own repository, and
then comment on a different one, but this does allow for not needing to
work out the collaboration.
Rather than have an unsorted list, work the useful recommendations into
relevant sections of the course.
This is covered in Designing a review process
These are important points that are covered by other parts of the
episode, so include the relevant source material.
This is again a bit of an aside so a callout makes it clearer we are
taking a diversion. Also compressed the content quite substantially -
this would make good content for a discussion but is a bit verbose for
the lesson format.
Clearer than mulitple single sentence paragraphs
This works as a good overview of the section so it is easy to see what
the points are, before diving into more detail
This way if the timeline gets longer it will stay a consistent font size
as the diagram gets bigger
This text can be used in mermaid.live to regenerate the diagram
@thomaskileyukaea
Copy link
Contributor Author

Thanks @anenadic for the review - it was really helpful. I've tried to address your comments - or else have replied with further clarifications. Do let me know if you have any further feedback.

I've merged the latest gh-pages into this so that it has the same collaborative code models.

@thomaskileyukaea
Copy link
Contributor Author

I also looked into using Mermaid diagrams directly - at first it seemed tricky, but ended up being quite straight forward - here's a PR on my fork showing how it could be done: thomaskileyukaea#1

If we did go down this route, we could convert a few of the git diagrams into mermaid diagrams too, which would make maintenance easier.

@bielsnohr
Copy link
Collaborator

bielsnohr commented Sep 27, 2023

Comments from maintainer sprint:

  • Concern about confusion when initially forking and having multiple branches.
    • Solution: add some text around initial forking instructions about ignoring the additional branches
  • The reasons for forking: as @thomaskileyukaea implies above, the use of a template for the learner project repository makes this redesigned section impossible to do. When you use a template, all of the history from the source repository is lost. The initial commit on any branch in the generated project is completely new and does not have a parent. Although in principle is should be possible to raise a merge request between two commits that don't share history, in practice GitHub does not allow this. Therefore, based on our testing, it is not possible to have a template repository, generate a repository from it with multiple branches, and then raise a merge request from one of the branches into another.
  • Options to retain templating:
    1. GitHub action that creates the required branch and changes upon creation of the copy from the template. It is unclear if it is possible to design a GitHub action that only runs at project creation and then never again. It also means that the learner repository would have a GitHub action already set up inside, which could cause confusion.
    2. Have a script in the template repo that learners would run themselves (downside: system dependencies and learner error). I think this is the more straightforward to implement, but has greater risk of going wrong.
  • Both of the above solutions would likely involve the use of patch files in git, which is relatively straightforward from what I can tell.
  • The downsides of retaining the template with these solutions are developer time to get these up and running (we still need to put a little bit of time into creating the actual technical solutions), and then maintenance costs
  • Forking the original project repo is more appealing because it avoids any technical solutions having to be developed.

@bielsnohr
Copy link
Collaborator

I also looked into using Mermaid diagrams directly - at first it seemed tricky, but ended up being quite straight forward - here's a PR on my fork showing how it could be done: thomaskileyukaea#1

If we did go down this route, we could convert a few of the git diagrams into mermaid diagrams too, which would make maintenance easier.

Aha! Great that you were able to get this working. Of course, I should have remembered the solution of just injecting the required Javascript somewhere in the HTML. One gets quite used to everything being done with packages/gems/etc...

I would vote that we do go down the route of adding Mermaid. The diagram for this lesson looks great, see the bottom of this comment. GitHub already supports Mermaid, so the below is actually a rendering of the source code. Also, as @thomaskileyukaea mentions, we can convert other diagrams to Mermaid and it will make maintenance of the website easier (no more fiddling with svg, regenerating a png/jpeg, making sure they are in the right folder, etc).

Could I request that we get a maintainer vote on this? @anenadic I'll have a look through the governance document we are working on, but email list probably best?

%% Must disable useMaxWidth to have the diagram centre
%%{init: { 'sequence': {'useMaxWidth':false} } }%%
sequenceDiagram
    participant A as Author
    participant R as Reviewer
    A->>A: Write some code
    A->>R: Raise a pull request
    R->>R: Add comments to a review
    R->>A: Submit a review
    loop Until approved
        A->>R: Address or respond to review comments
        R->>A: Clarify or resolve comments
    end
    R->>A: Approve pull request
    A->>A: Merge pull request
Loading

@bielsnohr
Copy link
Collaborator

we'd like to have another meeting with you to discuss bigger changes which may be more difficult to explain in the PR's comments (and also because it affects some earlier episodes). If you are not available to meet and to work on this - we'd be happy to accept the PR to the dev branch and then apply our changes on top of yours, if that is OK with you.

@anenadic I think because of various AL schedules, it has been difficult to arrange a synchronous call about the bigger changes you mention above. By "bigger changes" are you referring to the fact that steps in some of the initial episodes for obtaining the project would need to be modified?

If that is the extent of the changes, then I think it is quite manageable. There is the issue of regenerating some images of the GitHub interface, but I can assist with that.

As you suggest, it is probably best that we accept this MR in its current state into the dev branch and then continue working on the other changes earlier in the course ourselves (i.e. maintainers). I am keen to have Thomas get going on his proposed modifications to the Architecture and Design sections.

Copy link
Collaborator

@bielsnohr bielsnohr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in comments above, I think we are fine to merge this into the dev branch and then take some time to make the edits to earlier parts of the lesson to advise on using forking.

By extending the layout we can load the mermaid script directly to use
diagrams in the lesson
By default the diagrams generated by mermaid use max-width property.
This means that they cannot be centre aligned in their parent container.
Disabling this combined with setting the element to be 100% with auto
margins will centre the diagram.
No reason to have a grey background on the diagrams
The wrong base template had been used for episodes, resulting in the
schedule appearing at the bottom.
@thomaskileyukaea
Copy link
Contributor Author

✔️ Addressed issue where the schedule appeared at the bottom after the mermaid change.

@bielsnohr
Copy link
Collaborator

Summary of outcome from Maintainer Meeting 2023-10-25:

  • @anenadic and @steve-crouch have communicated that there is some content from the original version of the episode that they don't want to see removed, as has been done here
    • with @thomaskileyukaea having no more immediate time to work on this, the maintainers will take on the task of making any changes to get this updated episode to a state where it is ready to merge
  • it was decided that it probably isn't a good idea to merge this into dev since there are still things that need to be reviewed and changes to be made; therefore, this PR will stay open for the immediate future while this work is done
  • @bielsnohr will take on the task of modifying the earlier part of the lesson where a fork is now required, as stated in Change initial retrieval of course project to be a fork rather than template copy #249 .
    • this work will be pushed to a separate branch that stacks on top of this one

@anenadic
Copy link
Collaborator

anenadic commented Nov 2, 2023

Summary of outcome from Maintainer Meeting 2023-10-25:

  • @anenadic and @steve-crouch have communicated that there is some content from the original version of the episode that they don't want to see removed, as has been done here

    • with @thomaskileyukaea having no more immediate time to work on this, the maintainers will take on the task of making any changes to get this updated episode to a state where it is ready to merge
  • it was decided that it probably isn't a good idea to merge this into dev since there are still things that need to be reviewed and changes to be made; therefore, this PR will stay open for the immediate future while this work is done

  • @bielsnohr will take on the task of modifying the earlier part of the lesson where a fork is now required, as stated in Change initial retrieval of course project to be a fork rather than template copy #249 .

    • this work will be pushed to a separate branch that stacks on top of this one

We can either re-create a dev branch for this PR or have a new branch of the same name rework-review-section. Will try to find some time to work on this with @steve-crouch - hopefully tomorrow. So we can have this merged as soon as possible. Apologies for not responding sooner - things have gone a bit hectic.

@bielsnohr
Copy link
Collaborator

We can either re-create a dev branch for this PR or have a new branch of the same name rework-review-section. Will try to find some time to work on this with @steve-crouch - hopefully tomorrow. So we can have this merged as soon as possible. Apologies for not responding sooner - things have gone a bit hectic.

I think creating a new branch within our repo to hold this work is the best next step. I'll do that shortly.

It would be good if we could collect the concrete items that need to change in this issue: #217

@bielsnohr bielsnohr changed the base branch from gh-pages to rework-code-review-section November 10, 2023 10:22
@bielsnohr bielsnohr merged commit ada593b into carpentries-incubator:rework-code-review-section Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the code review section more engaging

3 participants