Recently, I had the pleasure of speaking at 2 programming events – World Engineering Days and one of the biggest software conferences in Poland, 4Developers. During both speeches, I talked about many different things related to the modern way of software development – continuous deployments, short-living branches, canary releases, and more. All are linked to the short feedback cycle. One of the side topics was vertical slices.
What is a vertical slice? Before we look at the definition, it is worth looking at a quite common software development process. There is a feature to implement. For the purposes of this article, let’s assume that this is a file upload. Pretty popular, right?
Estimates, plans for next weeks. In the end, after 1.5 months of work, we have an entire “cake” that contains the following:
- Upload of a single file
- Upload of multiple files
- Standard modal for the selection of files to upload
- Drag and drop for upload of files
- Each file can be small (< 1GB) or large (> 1GB)
In theory, everything seems to be fine. In theory. From analyzing user traffic, it looks like almost no one is using the modal to upload. 95% of files are small ones. What does this mean? You have delivered too much. The market does not need it. Now there are 2 options. First, keep it inside the application and this means higher cost of maintenance and more places to care about in the area of new bugs. Second, drop it but that will mean you have burned through money for nothing.
Instead, the feature of the upload can be approached as vertical slices. The vertical slice provides a fully usable portion of the whole. You can imagine it as a slice of the cake:
When you translate each layer of the above cake into software development, this piece contains everything that is needed to use it inside your application:
in contrast to the horizontal approach where we first provide the database, then in another task API, in another business logic, use cases, etc. Now it is time for a real example based on the upload feature.
Signals from the market say that users would like to be able to upload a profile picture inside your application. So, you decide to define the first vertical slice:
- Upload of a single, small file
- Upload is done through modal
Now it is time to release and validate it with part of your users (canary releases). There are different scenarios that might happen:
- First users will love it and everything is great – perfect situation, now you can release to more and more users until reaching 100%. Great, you can finish here or improve step by step.
- In general, it looks fine but this upload through the modal is not user friendly and it would be great to drag and drop instead – now you can decide what to do, one solution is to replace modal with drag and drop, another to extend the current solution with the new way (drag and drop). Vertical slice number 2.
- Looks like the market signals were false and almost no one uses this functionality. You can drop it.
In the case of scenarios 1 and 3, you saved a lot of money. There is no need to continue, now the team can focus on other features. Scenario 2 results in another vertical slice. After implementation, you again release it and the validation process starts. It can be a full success, failure, or again the next vertical slice:
- It would be great to upload multiple files and select a profile picture from this group (e.g. today I use this picture, tomorrow the other one). Vertical slice number 3.
And so on. It is an iterative way to add a fully functional piece of software. In the end, you need to remember that every slice that you add should allow your user to fulfill the process (e.g. of upload, ordering process, etc.). One of the easiest ways to split is to think about the user manual – try to define the minimum process that is understandable and doable by the application user.
The list of benefits related to vertical slices is quite long:
- Validate your ideas with real users
- Do not overwhelm your users with tons of new features at once
- Save money
- It helps to start short-living branches
- Quality can improve due to limited scope of focus (fewer edge cases) and iterative test coverage
- Decrease the time of release
- Decrease the number of reported bugs (limited scope)
If you would like to train your skills related to vertical slices outside of your application, one of the easiest options is to open any web application that you know, select the area of your interest (e.g. shopping cart, training, or anything else) and try to analyze how would you split the work on it, if it would be your application.