The call for product agility requires development teams to ensure continuous delivery of solutions to customers and end-users. In this regard, the app development approach may have a decisive impact on the success of your production efforts and the choice of your team in general.
Trunk based development (TBD) offers exactly what you need for development synchronization, ensuring effective version control and sustaining the CI/CD pipeline. Favored by tech giants like Google and Meta, TBD is totally worth consideration when choosing the methodology for building applications.
In this blog, we are going to explore the intricacies of trunk based development and discuss whether or not you should apply it to your project.
The Benefits of Being In Real-Time Sync
First off, what is trunk based development? Essentially, TBD is one of the existing ways to execute version control (a process used to synchronize code and monitor the current and historical condition of the development environments). The use of TBD accounts for better code audits and disaster recovery.
Let’s get through the main benefits that businesses can gain from trunk based development.
From a business standpoint, the main advantages of the TBD system are as follows:
- Workflow optimization
The use of TBD accounts for the seamless and non-disruptive workflow since most of the integration issues are eliminated.
Read also: How Workflow Management Software Can Power Up Business
Discover how to automate business processes and boost productivity
As the app development team works together, they gradually develop a unified programming style. The code is more consistent and the application has fewer performance issues.
- Shared expertise
The development team members learn from each other and hone their programming skills in real-time mode. Thus, each one complements the project with their unique expertise and creates more advanced and sophisticated solutions.
- Accelerated time-to-market
TBD allows you to achieve faster time-to-market. It’s also a perfect solution for building an MVP. The code is always ready for production, since features, which are still under construction, are easily turned off.
- Instant updates
As your solution gets feedback from users and stakeholders, TBD enables you to act on it instantly and introduce solution updates on the go.
- Lower costs of development
Trunk-based development allows you to quickly reach excellent results with smaller teams and reduce the costs of development.
Read more: How to Save Money on a Web Project for Businesses
Learn how to select the best tech stack for your web application
In the next sections, we will explore TBD in more detail and compare it with the GitHub branching strategy.
Trunk-Based Development vs GitFlow – What’s Better?
Trunk development is frequently compared to GitFlow, so it may be difficult to choose which VCS is best for your app development project. Many sources define GitFlow as a legacy development method, which gets gradually replaced by TBD. Some practitioners, however, do not view the two methods as mutually exclusive and use GitFlow in combination with TBD for different purposes. In short, trunk based development vs GitFlow is a topic of ongoing debate.
To help you decide which model would suit you best, below is a brief description of a GitFlow method and how it compares to trunk development.
Feature Branching (GitFlow) vs TBD
As version control systems (VCS) become more sophisticated, they tend to become more capable of tracking the history of the projects and changes introduced by different people. These systems also allow distributed teams to work on the same product simultaneously. This speeds up solution delivery and facilitates QA testing eliminating potential vulnerabilities.
A popular method of version control is feature branching. A single branch is separated from the mainline (or trunk) and is used by software developers to build a specific feature. Basically, a feature branch is a small trunk that developers work on in order to add a particular functionality. The process may take up to several weeks. When the task is complete, the updates are pushed back into the mainline.
Trunk-based development (TBD) is grounded on other principles. Instead of applying code branching, app developers work on small portions of code and push it back into the trunk in little chunks, on a daily basis. They do not trail off from the mainline and commit features instantly, the moment they are developed. The branch life is limited, and branches normally last several hours before they are committed.
Trunk based development release branch is the only branch with a long life span. Release branches are isolated and never merged back into the mainline.
Below is a graphic description of the TBD process and the attributes of trunk based development:
GitFlow is a VCS for Git that is based on feature branching. As mentioned above, git feature branch is, substantially, chunks of code built independently from a trunk branch, also known as the mainline or master. After a particular feature has been created, the updates are integrated back into the master.
The below GitFlow diagram illustrates how it works:
In essence, GitFlow doesn’t add anything new to the feature branching method. It makes branches more manageable, though, by assigning them different roles and interaction capabilities. Isolated branches may also be used for preparing, recording, and maintaining releases.
The problem associated with the use of a git flow method is that long-lasting feature branches are notoriously difficult to merge. Integrating them into the code mainline may involve serious conflicts.
By comparison, when the developers apply the trunk-based development method, they work directly on a master branch. Updates are committed instantaneously, and it’s easier to eliminate bugs and maintain the consistency of code.
Trunk-based development is perfect if you want to quickly build an MVP, test it for a proof of concept and return it back to users as soon as possible with an excellent-functioning solution. It’s also a great fit if you want to introduce fast updates into an already functioning software without disrupting its performance.
How Does Trunk Based Development Improve the SDLC?
TBD is also beneficial from the development perspective.
More specifically, below are examples of how TBD improves the SDLC.
- Feedback quality
If the code gets delivered in real-time, so does the feedback. When feedback comes early, it enables software development teams to introduce changes as fast as possible. It’s also given by word of mouth and can be more nuanced.
- Overcoming difficulties
If any member of the development team needs help, it’s easy to detect in real-time and overcome difficulties on the spot. This accounts for a seamless production process.
- Collective code ownership
Trunk based development promotes an ownership mentality – the understanding that all the members of the team are working towards a common goal.
The code is consistent and it’s easier to establish a unified code style. TBD also facilitates code reviews, since the original commit history is preserved.
- Easier refactorings
One of the advantages of TBD is that large refactorings are easier to handle since there are no merge conflicts.
- Continuous deployment
TBD is believed by some experts to be a facilitator of continuous deployment and a signature of a team’s health. If a team knows how to work without breaking the mainline into branches, they have probably mastered effective methods of working together.
TBD offers software development teams more freedom with their projects, eliminates micromanagement, and accelerates the production process. By using the TBD approach, the developers are capable of speeding up the development and introducing changes instantly, with no unnecessary bureaucracy interfering with their tasks. If you’re looking for ways to optimize your team’s throughput and gain a competitive edge by minimizing time-to-market, this development approach is the way to go.
Now that we’ve explored the advantages of trunk based development vs feature branch methods, let’s talk about the type of projects that it suits most.
Does TBD Fit All Solution Development Projects?
Given the obvious benefits of trunk based development, should you discard other methods altogether? Well, it depends. In fact, the tried-and-true GitFlow method may be more justified in some cases.
Using GitFlow is best when:
- Your solution is an open-source project with different contributors, so the responsible senior app developer should be able to review every line of code;
- Your solution is already functioning and you can afford to make gradual changes;
- You work with junior developers and need to keep an eye on the development process.
By contrast, TBD is best when:
- You are creating an MVP for a proof-of-concept;
- You need to make fast changes to your project to meet user expectations;
- You’re working with a development team of skilled professionals who demonstrate excellent collaboration and are confident with pushing code straight into the trunking software.
Read also: How Tech Consulting Firm Can Grow Your Business
Learn about tech consulting benefits, implementation & costs
In a modern world, when companies are pressured to deliver value fast, live up to severe competition, and continuously improve customer experience, the trunk-based approach offers them all it takes to ensure maximum efficiency. Indeed, TBD is associated with high performance, team maturity, fast time-to-value, and excellent software quality.
Best Practices of Trunk Based Development
So how do you make TBD work for your project?
Below is the list of the best practices and attributes of trunk based development that make it so effective.
Feature Branches vs Single Branch Strategies
Unlike setting up the feature branch, and then merging it with the code trunk, TBD uses a single-branch strategy. This speeds up software production and helps avoid the so-called “merge hell” during feature branch integration.
To leverage the full potential of TBD, software engineers need to learn how to work in small batches and implement synchronized reviews and automated unit testing.
Modern Architecture for Deployment in Isolation
By this, we mean microservice architecture, the cloud-based development approach under which an application is assembled from many small isolated components, i.e. services. TBD presupposes continuous testing and builds, and is perfect for microservice architecture since it simplifies workflows and ensures continuous delivery.
Feature toggling is absolutely necessary for successful TBD and involves the use of feature flags. To understand what feature flags are, think of them as controls, which help to turn off the manifestation of incomplete application features during production. So that the software developers can work on them until they are tested and complete.
Feature toggles or flags are usually stored in a configuration of the specification file. Controlling them, however, may not be easy, so you can use the feature flag software for more feature toggle control.
Continuous Development Patterns
CD is one of the main concepts within the Agile product management paradigm. Instead of delivering a complete solution in one batch, the software development teams work on updates continuously, introducing improvements to customers as soon as they are tested and ready. After they collect customer feedback, the developers make improvements based on it.
The process is iterative and includes continuous integration (CI), continuous deployment, and delivery (CD). If you’re wondering “what are continuous integration pipelines?” or “what is continuous integration in DevOps?” and “how does continuous integration work?”, this manual will set you on the right track.
The question of how continuous integration pipelines work falls beyond the scope of this article. If you need continuous integration explained, visualize a process when coders push their updates into the master within several hours and run automated tests prior to and following the integration. Setting up the continuous integration platform requires using automation whenever you can, plus robust and secure development infrastructure.
TBD facilitates continuous integration. Some experts claim that if you’re not leveraging TBD, you’re probably not doing CI at all.
Risks and Pitfalls Your Development Team Has to Overcome
Trunk development isn’t for everyone. The fact you’re using it is an indicator of your developers’ expertise and the maturity of your team.
However, some pitfalls may hamper your success. Below is a list of possible TBD risks and advice on overcoming them.
Maintain a Stable Mainline
How to build a trunk and avoid merge hell may become your team’s major challenge. TBD involves working on small portions of updates and pushing them straight into master. The development team should commit updates regularly. Preferably, several times per day. In the case of feature branches, app developers have to check whether they are short-lived and practice daily merges into the code trunk. It’s better for the development team to run regular tests and reviews.
To maintain a stable mainline, some teams use pair programming. This practice ensures higher code quality, provides code reviews in real time and promotes knowledge sharing between team members.
Properly Manage Toggles
As said above, feature toggle management can be a tricky task. Their number may reach hundreds depending on your project size, so it may be easy to lose track of them.
Specific software may be used to manage toggles or create customized tools. Specifically made feature toggles may even be preferable since the development team can later introduce other toggles for operations and release control.
Also, the toggles have to be cleaned up, once the project is completed. Feature toggles may mess up the code in case they are not temporary.
Scaling Problems With Branches
A lot of teams use Git for version control. The problem with Git is that this open-source system wasn’t meant for large enterprise projects and doesn’t scale easily. To overcome the Git scaling challenges you need to:
- keep your processes unified and standardized;
- run regular audits to detect bugs and vulnerabilities in the code;
- store the code and assets in a single repository;
- stick to the TBD standards and make sure that branches have a short life span to eliminate merge problems.
Control the Overall Architecture
Architecture plays an important part in ensuring continuous delivery. Because of architectural constraints, many companies fail to achieve solution agility goals. Clearly, there’s a connection between solution architecture and the communication style of a team. The architecture of products often reflects the current evolutionary stage of your organization.
Hence, new features or services may be extremely difficult to introduce. In this case, we would recommend implementing an evolutionary architecture approach for introducing gradual incremental changes.
Which Companies Use Trunk Based Development?
If you look at the examples of companies that leverage trunk based development you’re likely to be impressed. TBD for version control is reported to be leveraged by giants like Facebook, Google, and Amazon. According to the State of DevOps Report, TBD is applied by high performers. In fact, it is gaining more traction and is increasingly adopted by companies committed to Agile principles.
Companies that need ongoing solution updates to their projects are leveraging TBD to stay flexible and implement fast changes to their projects. At the same time, TBD is mostly applied by skilled development teams, with high levels of collaboration and teamwork.
How Visartech Enables Trunk Based Delivery in Action
At Visartech we work with a diversity of companies from various industries satisfying a wide range of their requests. In particular, we help them both create new digital solutions from scratch and update the already existing software products. We use innovative collaboration techniques and a trunk based development to infuse interactivity into solutions, which are already live and have a community of loyal users. As the enabler of CI and CD, TBD helps us to continuously add features to already existing apps without disrupting their performance.
Our company delivers different types of software solutions: interactive 3D graphics apps, cloud software, and data visualization services. We also specialize in collaboration software. VR chat is the very solution we developed to organize immersive meetings with real collaboration over a VR whiteboard.
TBD allows us to develop applications in real-time mode. We happened to work on a huge project in the field of virtual collaboration software. The solution we delivered is aimed at facilitating communication and virtual interaction between co-workers and entrepreneurs through virtual tools. Due to the trunk based development approach, we managed to keep the app constantly updated and avoid the merge hell.
Trunk based development comes across as a perfect solution. If you aim to strike a delicate balance between the need to instantly adapt to customer expectations, and the demand for non-disruptive application performance.
However, to utilize a TBD method, you need an experienced software development team of seasoned developers that are comfortable with pushing updates straight into master, and capable of maintaining continuous delivery and integration.
Our developers at Visartech know how to apply trunk based development, and have all the necessary hard and soft skills.
Need an expert team to breathe new life into your software solution? Contact us now for a free consultation!