Team Best Practices
Branching models
There are two options that are used on our projects:
- GitFlow is used for complicated solutions with a strict release, beta and other special rules.
- GithubFlow (translation) is used when we need the most simple and transparent code flow.
GitFlow
-
master
branch is used only for released sources. -
develop
branch is used for development purposes. -
feature
branch is used for new features. -
bugfix
branch is used for bugfixes. - Direct commits to
master|develop
are not allowed. - Every change should be done by pull request.
- Also, tags can be used for special cases.
- Development process starts from branch creation from
develop
.
Branch naming and commit messages
-
feature|bugfix
branch havefeature|bugfix/JIRAID-short-description
naming pattern. This practice allows to link every branch and pull request with git history. - Commit messages should follow
component-that-you-are-working-on: actual changes
pattern. Example:user-form: add registration link
.
GitHubFlow
-
master
branch is used as a main stable branch. - Direct commits to
master|develop
are not allowed. - Every change should be done by pull request.
- Also, tags can be used for special cases.
- Additional branches (
staging
,uat
, etc.) can be created for deployment purposes. - Development process starts from branch creation from
master
.
Branch naming and commit messages
- Branches do not have strict naming rules except
branch-name
pattern. - Commit messages should follow
JIRAID component-that-you-are-working-on: actual changes
pattern. Every commit should contain a link to corresponding JIRA ticket.
Pull requests and code review
It is required to push your code by pull requests and every pull request should be reviewed by two or more team members. This practice is used to:
- Share knowledge, code style and coding practices in both directions.
- Avoid bugs and unclear and hard-to-understand code.
- Build artifacts, run tests and linters for changed code.
- Store clear changelog in git commit history.
Pull request name should follow JIRAID: short description\n\nDetailed explanation[optional]
pattern.
How to work in your feature branch
In case if you need to implement some big feature and working in your own feature branch sometimes happens that when your pull request is ready on Github you see that there are some conflicts between your branch and develop which will be difficult to resolve since you are working in your own branch for a couple of days/weeks and a lot of files have changed in both branches. To prevent this situation it is useful to merge every accepted pull request in develop branch or merge at least every a couple of days develop into your feature branch. This approach allows:
- Prevent difficult and time consuming merge with target branch.
- Keep the code up to date and use all newly implemented features in your code.
Continuous Integration / Continuous Delivery
Every project should have its own CI/CD jobs and this approach gives:
- Automated static code analysis, build and test
develop|master
branches for any change. - Automated static code analysis, build and test for every pull request and notify source control system with its results.
- Automated delivery from certain branches to any certain environment. Code that sits in git and was not delivered to users is useless and makes nobody happy.
- Freedom from thoughts: “does my code pass tests and quality check, how to deliver my changes to users”.
- Transparent development workflow, so developers can concentrate only on features and does not spend time on stuff that definitely should be automated.
Usually we use Jenkins (especially jenkins pipelines) or TeamCity (Automatic bootstrapper) for CI/CD purposes. These tools cover all requirements, has a lot of useful and open-source plugins and it is free.
Static code analysis
Every platform and language has its own great tools for static code analysis: eslint for JS, rubocop for Ruby, lint for Android Studio and etc. So please configure and use this tools in your coding workflow and follow its recommendations and rules.
Also, there are great tools such as SonarQube that can do static code analysis, find potential bugs, calculate technical debt, visualize a lot of statistics for almost every language. It helps improve your coding skills and projects overall that you are working on. So configure SonarQube on your projects (in case if it was not done yet) and be happy!
Tests
We greatly recommend writing unit- and integration tests for your code because:
- It is a great documentation for your code.
- It does not allow to break existing code.
- Any developer can change any piece of code without fear and be sure that everything is working as expected and even better!
- The code is written faster so you have more time for cookies.
- The team can (should) establish certain requirements for test coverage on CI server.
Versioning
Semantic Versioning is a great practice for transparent and clear product versioning. It is flexible and satisfies almost any product requirements.
Communication
Usually, we use:
- Slack or Skype for real-time communication and notifications from services.
- Emails for more official and important messaging.
- JIRA/Github as progress, time and task tracking system.
It is important to have a real-time vision of plan, state, and progress of the whole company and to reach this goal we have to track our progress, notify about changes and resolve concerns as soon as possible. Described communication and tracking systems allow us to do this, so do not sit and wait when your concern will be resolved or you will be asked about it but ask and let others know. This is how reactive systems work and we have to behave the same way.
Our developer community
It is nice to know that you are not alone and can share your knowledge and ask your teammates for help. We set up technical-minutes (15 minute meeting a couple times a week) to share, discuss or ask about something. Also, we have slack channels for this purposes so in case if you know or want to know something useful - feel free to contact with teammates!
Being professional (off-top)
To be a good professional you have to learn, analyze, use best practices, methods and techniques and share your knowledge with others. But being professional does not mean only write beautiful code and unit tests, have a lot of experience in Java or JS, it means that you don’t try but just do, take responsibility for what you are doing and remember:
Comments