Commit... Commit...
Anil Kalose
Over 20 yrs of accelerated general mgmt experience in the Process Quality Assurance. Having directly led a team of over 30+ associates and budgets ( P&L ) in excess of $20 million.
In this write-up, we will look at a few common practices followed during coding. This write-up is more of certain practice that is suitable across the coding tools or IDEs
Commit often
- This is easier said than done
Commit only the working code
- Do not check in changes related to multiple user stories or issues together
- Don't commit partial changes or partially tested code. If the tool has shelving or similar feature use it, instead of full commit
Comments and Names
- Avoid trivial commit messages Like Bug Fix, Misc changes. Describe why and what rather than how. Include relevant features, bug ticket links. Keep the entire message in less
- Avoid shortcuts for names be it variables or functions or... In simple make sure you or other developer understands what it is when looked at it after couple of months
Branches
- Branch by Environment and then branch out for development, releases, features
- Give access by branch or add collaborators for the relevant branches
- Branch out for hotfixes and merge it back in the main branch
Dependency
- Link the changeset with one Jira issues or work items so that you can view all linked changesets. You can even link (and unlink) changesets to (and from) issues after check-in
- Select only those files that are related to a defect or user story during commit
RollBack
- This is reverting back to the working code. Undo the changes and go back to the code that was there earlier. Most code management tools have this feature. Examples. in Git, this is possible by simple checkout command in command prompt. In Clearcase one can go to branch view, right-click and say undo. It will revert back to the earlier version and this act cannot be undone. All changes will be deleted and move the code back to the latest version possible. In the VS, this can be done in the solution or a code project by going to the context menu, and then choose Undo Pending Change. In the Undo Pending Changes dialog box, make sure the changes you want to undo are selected and then choose Undo Changes
- In case accidentally left off a file wanted to commit or committed a wrong file: Git allows to reset, in VS open the changeset and add or delete the files
Clean the local repo/directory
- Get rid of untracked files. Delete the forked files or checked-out files for more than a month ago and still not committed.
Repo Size
- If git, keep the repo size as small as possible
Feedback comments
- This is the same as the review. Raise the ticket or the email for all the issues
Static Analysis
- Again same as the review. Active the static code review at commit and raise the feedback comments for the issue
Integrate with other apps
- Integrate most of all steps given above as part of automation including regression test for each commit as a step in the pipeline
- Integrate with TDD or similar frameworks
- Integrate with dynamic review tools
Related Links
- Overtake Technical Debt: Make Your Code Invincible
- Continuous Reviews for Clean Code Delivery - II
- Continuous Reviews for Clean Code Delivery - I
- Streamlined CI/CD pipeline delivers direct business benefits
- Source Code Branching and Merging Models: Few Examples
Thank You