I will describe two development and code review processes, both describing the upsides and downsides to each version. Ideally we want to have a process that has no downsides and as much upsides as possible:
We have two environments, the acceptance environment (main branch) for the customer to access and check whether the features they requested are correctly implemented, and the development environment (development branch), which is an internal environment for developers to merge all their finished code to, to test it as a whole both as a developer as well as the product owner.
Process 1:
The developer creates a feature branch from the development branch and implements their code and writes unit tests for it. Once they deem the feature complete, they merge it to the development branch and create a merge request from their feature branch to the main branch. This merge request is reviewed by a second developer and once the review is complete and they have merged the feature branch into the main branch, they archive the branch and merge the main branch into the development branch.
Upsides:
- A review is small and only contains changes required for that feature
- If fix comments are required to be resolved, nothing else is blocked and it will only be merged into the main branch if everything is complete and deemed correct.
Downsides:
- The development environment never fully mirrors the acceptance environment as there could be features on the main branch separately when they were only tested on the development environment with other feature branches included.
- The requirement for reviews per feature requires developers to switch focus more often during a working day, switching from developing to reviewing possibly multiple times a day.
Process 2:
The developer creates a feature branch from the development branch and implements their code and writes unit tests for it. Once they deem the feature complete, they merge it to the development branch and archive their feature branch. They then create a merge request from the development branch to the main branch if it does not already exist. Once a week a developer reviews the merge request from development to main with all the features that were completed that week.
Upsides:
- The development environment always perfectly mirrors the main environment after a review, meaning that the acceptance environment never has unexpected behaviour.
- The review is done once a week, allowing it to be planned and developers are not constantly switching focus.
- Not requiring developers to review allows for more speedy development as a whole.
Downsides:
- The review once a week has a lot of code and takes a lot of time and focus, sometimes up to half a day.
- When features are not implemented correctly, faulty code is still pushed to the main branch to not bloat the gigantic merge request further and never having perfect code while also having everything reviewed.
- Developers lose individual feedback on their code as it is all done in one go.
- Tasks sometimes will remain in review for a long time as developers fix their fix comments in new feature tasks that sometimes are large and take a while to complete.
What would be an ideal solution without the requirement of a third environment, keeping the server infrastructure as is. I know there probably isn’t a perfect ideal solution, but there must be something better than these two.
GSerum_ is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.