What’s a composable architecture platform? It’s a way of thinking about your system as a set of distinct components that can be reused and composed together. Each component is defined by its interface (a contract) rather than implementation details. This makes it easy to build more complex systems out of smaller, simpler parts—and even easier to update those components without disrupting the rest of your system or other people using your code.
Structuring The Application State
There are a few things to keep in mind when structuring the application state:
● You should try to keep the state as simple as possible and strive for a single source of truth. A good rule of thumb is that if you can’t represent it on one screen, it may not belong there.
● An immutable state management library can help you keep track of changes to the application’s data over time. This makes it easy to query what the current state looks like at any given moment and also makes debugging easier since any errors will occur only at the point at which you make an update or action that causes those errors.
● Querying and transforming the application’s state are important tasks that should be handled by dedicated components rather than buried deep within other functions/classes/modules.
Uniform experts say, “Delivers personalization at your edge of choice in milliseconds.”
Architecting The Application State
The best architectures for composability are ones that use a single source of truth. A Single Source of Truth (SoT) is a design principle with only one canonical representation of information in your system.
In this architecture, it means that the only place where the state exists for the application is in one particular location: the business logic layer.
This also means that when they’re making changes to how data flows through their application, it’s easy to understand how things work together because everything has a single definition and point of origin.
Architecting The Business Logic Layer
The next layer of architecture is the business logic layer. This layer contains all of the business logic, which handles all the data manipulation and processing within their application.
It’s important to separate this, as well as from any state that they have in their application. This is because you can reuse this code in other parts of the application or even on other websites.
Managing side effects with effects of middleware
Side effects are the things that happen outside of your application. They can be asynchronous, synchronous, internal, or external to your program. Side effects can be errors, bugs, or API calls. Side effects are a problem for composability because they make it hard for you to reason about your system as it grows in size and complexity.
In particular, when you compose two programs with side effects, there is no guarantee that they will work correctly together (assuming they even do). If one of these programs has an error handling code but not the other, you may get unexpected behavior in places where the program expects an error response from one component. But it gets an incredible value from another component due to an error in its logic flow somewhere else along the chain!