Business logic layer: This layer manages the state (usually using flutter_bloc).Domain layer: This is the one in charge of transforming the data that comes from the data layer.Īnd finally, we want to manage the state of that data and present it on our user interface, that’s why we split the presentation layer in two:.Data layer: This layer is the one in charge of interacting with APIs.Very Good ArchitectureĪt VGV, we follow an architecture that has four layers. Defining layers is a critical step, as you may want to keep them as simple as possible without compromising maintainability. Define your layersĪs I said before, you can create different layers to handle the three main responsibilities in your app. Note that this is an opinionated approach to architecture, as always, feel free to implement the architecture that makes the most sense for you and your team. We’re going to mention what we think you should and shouldn’t do to structure your app the best way possible, so you have the foundation to build a scalable and maintainable application. The essence will remain independent of the architecture. In some architectures, there may be multiple layers to handle specific aspects of these responsibilities, but these are implementation details. Presentation layer: This layer presents the app content and triggers events that modify the application state.ĭepending on the architecture you choose, these components can have different names.Domain layer: This layer transforms or manipulates the data that the API provides.Data layer: This layer interacts directly with an API (REST API or a device API).This way, when we make changes, they will have less of an impact on the overall codebase.įrom my experience on mobile applications at scale, there are three main responsibilities in an app: By decoupling code, we make each chunk of less dependent on the other. Maintain specific functionality without affecting other parts of the code.We shouldn't have to mock a lot of components to test specific functionality. Better isolate components for testing.Have smaller and simpler classes that have a unique purpose.Single Responsibility is one of the SOLID principles from Object-Oriented Design. We should keep these layers simple, yet isolated enough to achieve a maintainable codebase. We can define these by assigning a specific responsibility to them. Layers are the components that compose your architecture. Now that we know what architecture is, let’s define layers. The way we establish the relationship and interactions between these components can reduce or add complexity to our projects, which has a significant impact on the team's productivity. We want to follow standards and make it easy to identify the components that we'll need to develop features in our codebase. Let’s start with the basics: what is app architecture?Īpp architecture is the logical way we organize our projects and how the various components interact with each other to fulfill the business requirements. The decisions you make regarding architecture will impact how fast you can deliver new features in the future and how well you can maintain the existing functionality with the latest language and SDK requirements. Structuring code is one of the big – if not the most important – challenges when building large-scale applications.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |