Code review without git (with Dynamics NAV example)

About culture

Kirill Cheremisin
6 min readJul 31, 2019

Code review — is a good practice to keep your code clean, teach your team and spread knowledge among it. It is an important part of the quality assurance process: the earliest step in identifying future mistakes is code review (with automated tests).

When you work with your code via git repo (or another version control system) it is easy to handle code review. The basics option is a pull request. Besides, you have lots of tools which help you handle it.

But when you keep your codebase in a database only, as we do in Dynamics NAV, it is a question how to conduct code review.

In my opinion, if you can describe the process essentials and conduct it manually, you can automate it next. Code review is a process of reviewing (sorry) changes of code to [put your goals]. The main thing is keeping changes and the ability to show them to other participants (developers, team leader, QA team…). It’s not easy without special tools and requires a culture of work.

For a manual experiment, you can just keep objects before and after development.

Create a folder for a task [task-XXX]. Create subfolders “Before” and “After”.

Before changing an object, export it to the “After” folder and copy to “Before” folder.

Now you have 2 folders containing the same files.

Change the object and then export it to the “After” folder again. That’s it.

Now you have a changeset and you can share it as a zipped folder.

Also, you can see the changes to prevent mistakes. You can control your changes before giving objects to release.

I use BeyondCompare for this purpose:

Another advantage of this approach is the ability to merge objects between databases easily and faster (google for “three-way merge”).

Tools

Now you keep your changes but the next question is how to conduct discussions around your code.

It’s not a common case to have code review without git but some tools provide you with an opportunity to keep files inside a code review. So just choose a tool and test it.

We use Review Board. Download it from the official web site and install.

Then open Review Board management tool and check if the servers running.

Push the “Go to Application” button

Register as usual.

On the main page push “New Review Request”

On the left bar choose “None — File attachments only” option and then push “Create Review Request”

Fill in the mandatory information: Summary, Description, Reviewers (if you added groups, use groups, otherwise type other users), then push Publish.

Then you have to import your files. Place the cursor on “Update” and select “Add file”.

Select your file from the “Before” folder and upload. Write a small description and push “Publish changes”. It is your initial version.

Now you have to upload changes. Place the cursor on your file and select the “Update” option.

Upload the file with the same name from the “After” folder, write a small description and push “Publish”.

Now you have your changeset in the system and you able to see the changes. Push on file, Review Board opens a window with the file overview:

You see the versions:

  1. “No Diff” — no file;
  2. 1 — initial version;
  3. 2 — the latest version.

You can choose which versions to see:

A reviewer can place comments on each file. Place cursor on line number and click:

Write a comment and push “Save”.

When you finished commenting, push “Publish Review” button at the top of the screen. You can see the list of the issues below the files in your review.

Author of the review works with comments, answer them and update files (or not).

Now I have 3 versions of the file:

And I can see the difference between every 2 versions.

If the reviewer agrees with the changes, he pushes the “Ship It” button and the author can see the result in the comment list:

When all needed approvals exist, the author closes the review request.

Tips

Encoding

If your files contain not UTF-8 symbols, they look like as hieroglyphs. You can use my dev tool to export objects in the correct encoding. You can find the instruction here.

Another solution is the correct installation and setting up the Review Board/MySQL Database.

Emails

The tool sends emails. You have to specify a correct email address in your profile and set up email options. You can do this with admin account only.

Open review board as admin.

Go to “E-Mail” windows and then specify settings.

We use emails on every publishing and changing review (except cases when a user chooses not to send emails).

Groups

It’s tiring to enter reviewers one by one every single review request. With the admin account, you can set up groups and specify groups instead of particular users as reviewers in review requests.

Open review board as admin. Push “+” plus sign on the “Review Groups” line and specify details.

The system is really customizable, experiment with it.

Good luck!

--

--