Code Management Fundamentals
The Selection of a proper Code Repository is fundamental, generally companies use GIT. The Best practises in GIT usage is very important to a Cloud Native Delivery or for that matter any Software Delivery to help maintain their edge in rapid delivery with quality ensuring a good collaboration is maintained across the teams
GIT Version Control Main Points
- Make Incremental Small Change - Every change including a feature or a problem/bug should first have a different change. Once the work is identified the solution can be divided in small chunks and then released, getting it validated with QA or customer , this allows in less challenges during integration also. Smaller branches also allow for easier maintenance and reduced conflicts with other developers merging in the main branch.
- Keep commits Atomic - Generally this involves only one commit for one task or one unit of work e.g Feature, Bug, Refactor. This allows for easier code review by other teams. The goal of atomic commit is not to create hundreds of commit but to group commits by context. For e.g If a developer wants to develop a feature or fix a bug, he should do it seperately.
- Develop using Branches - This is the most efficient way of coding as this ensure that teams work on branches and only after it is ready it gets merged to the main trunk. This ensures vulnerabilities and bugs which can be caught via SAST ( Static Application Security Testing ) is enforced early in the application. This gives better control to Software Management practises.
- Write Descriptive Commit Messages - More then the change this is very important, teams should be trained to write proper commit messages. Each commit should have only a single purpose and the same should be described in the Commit Messages.
- Code Reviews - To increase Code Quality and improve knowledge inside the teams. Sometimes someone external from team can also be brought in to review the code. Industry call is Peer reviews which is very important before a change is pushed ahead.
- Branching Strategy - This is the most Important Point as this has the potential to create lot of Chaos in a Software Development Team, leading to lot of Rework and wastage of precious development and operation time. Centralized Work Flow - Teams use only a single repository and commit directly to the main branch. This is extremely useful in small teams sitting in the same office/ same cabin . The project is under maintenance and code is stable with rare bugs. The Project is only for quick demo purpose, with all developers are like minded.Feature Branching - Teams use a new branch for every new Feature and don't commit directly into the branch. This is generally recommended for mature solutions where each some teams are working on new features, some teams are working on bugs. The features are also long lived more then 15 day generally sprint cycle. Care to be taken to close the feature branch even if feature is left in middle. Hanging branches for long time puts extra load in maintenanceGit Flow : An advanced form of Feature Branching where development happens in Feature , moves to Release Branch and Merges to Main Branch. This is recommended to teams where product is sacro -sanct and multiple teams working in Geo Mode and Main Branch has to be the Reality of the truth. Should be practised by Mature Teams only.Personal Branching : A form of Feature Branching, instead of Feature branch is followed as per Developer. Every user merges their work to the main branch after completion of their work. This is generally followed by mid size teams.Some teams follow customised approach, regardless of the same , the methodology has to be communicated and all of it should be published so new team members can follow it easily. The knowledge of the same is very important for Software teams. Irrespective of the team or the company orientation and training in this areas helps team productivity increase.