Vertical-slice architecture
Vertical-slice architecture is a software [design pattern] in which an application is divided into thin slices that encompass all layers of the system, from the user interface, via the business logic, to data access. Each slice represents a complete business function or use case of the application.
Vertical-slice architecture emphasizes the delivery of the end-to-end functionality required to implement a discrete feature or user story. This is achieved by [decomposing] code around business domains and subdomains, rather than by technical layers. This is in contrast with a traditional horizontally layered architecture, in which the decomposition of code is based on logical layers such as presentation, business logic, and data access.
A service-oriented architecture or microservices architecture may also exhibit vertical slice characteristics, if each service is designed to be a complete, self-contained feature. But we tend to talk about vertical and horizontal slices (or layers) in the context of a single-node application (which may or may not be a component of a wider distributed program). Therefore, this architectural style is one possible approach to [monolithic architecture].
Compared to a horizontally layered architecture, vertical slicing tends to reduce the need for abstractions such as services and repositories within each slide. The focus is on producing the least amount of code necessary to deliver a feature, rather than on creating reusable components that will be shared across multiple features. This can lead to a more direct mapping between business requirements and the code, and so make it easier to define, estimate, and plan the delivery of individual units of business functionality. The potential for faster delivery of features can also lead to faster feedback from users, and so to a greater degree of agility in the context of emerging/changing requirements.
On the other hand, the fragmentation of a codebase by features will tend to increase the duplication of logic and result in wider variability in design patterns and coding conventions. Consequently, vertical-slice applications may be more complex to manage in terms of dependencies between features, and may be more difficult to refactor or maintain over time.
In addition, this architectural style tends to emphasize feature delivery over cross-cutting concerns such as performance, scalability, and maintainability.
However, application may have characteristics of both vertical and horizontal slicing, to achieve a balance between the benefits of rapid feature delivery and the need for consistency, maintainability, and scalability.
References
-
Vertical slice architecture, Jimmy Bogard (2018)