An examination of application architecture types including monolithic microservices, and component-based approaches. The article discusses the characteristics of effective components - reusability, replaceability independence, extensibility, encapsulation, and context-neutrality - and provides real-world examples of architectural components like APIs controllers, and UI elements.
Application architecture is the process of defining the framework of an application. It involves making decisions about the application's components, their relationships, and how they interact with each other. A well-designed application architecture can improve the performance, scalability, and maintainability of an application.
Application architecture is the process of defining the framework of an application. It involves making decisions about the application’s components, their relationships, and how they interact with each other. A well-designed application architecture can improve the performance, scalability, and maintainability of an application. Two common types of application architecture are monolithic and microservices.
In a monolithic architecture, all the components of an application are tightly coupled and run as a single unit. This means that all the code for the application is contained in a single codebase and deployed as a single package. Monolithic architectures are simple to develop and deploy, but they can be difficult to scale and maintain as the application grows.
In a microservices architecture, an application is broken down into smaller, independent services that communicate with each other over a network. Each service is responsible for a specific function of the application and can be developed, deployed, and scaled independently. Microservices architectures are more complex to develop and deploy, but they offer greater flexibility, scalability, and resilience.
Component-based architecture focuses on the decomposition of the design into the logical components. It provides a higher level of abstraction than object-oriented designs. The architecture defines, composes, and implements loosely coupled independent components so they work together to create an application.
A component is an individual unit of encapsulated functionality that serves as a part of an application in conjunction with other components. There are six characteristics of components: reusable, replaceable, independent, extensible, encapsulated, and non-context specific.
graph TD;
Component --> Reusable
Component --> Replaceable
Component --> Independent
Component --> Extensible
Component --> Encapsulated
Component --> Non-context-specific
Reusable?Reusable implies that components should be designed such that they can be reused in different applications.
Replaceable?Replaceable means that a component should be easily replaced with another component.
Independent?Independent means the component should be designed so it doesn’t have dependencies on other components.
Extensible?Extensibility entails the ability to add behavior to a component without changing other components.
Encapsulated?Encapsulation consists of bundling a component’s data and methods to hide its internal state, so it doesn’t expose its specific implementation.
Non-context-specific?Non-context specific means that a component should be designed to operate in different environments. The data that sets its internal state should be passed to the component rather than being included within or accessed directly by the component.
An API can be packaged as a component if it is reusable across different systems and applications. For example, an open-source API can connect a system to a specific database. Another example is a data access object (DAO) that allows switching databases without the application being aware of the change.
A controller is another type of component. It decides which other components need to be called for a particular event and manages the flow of data between components.
A user interface (UI) component is another example. It encapsulates the visual and interactive aspects of an application, such as buttons, forms, and dialogs, and can be reused across different parts of the application or in different applications.
A service is like a component, also a unit of functionality, but it is designed to be deployed independently and reused by multiple systems. A service focuses on a solution to a business need. A key difference between a component and a service is that a service will only have one unique, always running instance with whom multiple clients communicate.
In a layered architecture, services are made of components and components consist of objects. A service is also a type of component but it is meant to be deployed independently of the overall system. Examples of services include: checking a customer’s credit, calculating a monthly loan payment, or processing a mortgage application.
In an SOA, services are loosely coupled and interface with each other via a communication protocol over a network. SOA supports building distributed systems that deliver services to other applications through the communication protocol.
A distributed system is a system with multiple services located on different machines that coordinate interactions by passing messages to each other via a communication protocol such as HTTP. Even though the services in a distributed system operate on multiple machines, it appears to the end-user as a single coherent system. A distributed system shares resources such as hardware, software, and data. They are fault-tolerant, meaning if a node or service fails, the system continues to run, implying that the system may change during execution without service interruption. Multiple activities run concurrently on a distributed system, reducing latency and increasing throughput.
Another property of distributed systems is that they are scalable as the number of users increases. The computers running the distributed system do not need to use the same kind of hardware or operating systems. A distributed system may be made up of different kinds of computers and programming languages. A node is any device on a network that can recognize, process, and transmit data to other nodes on the network. A distributed system consists of multiple interconnected nodes where the nodes are running one or more services in an SOA.
Distributed systems generally use one or more of the following basic types of architecture: 1.