Introduction
Architecture in software engineering refers to the fundamental structures of a software system, encompassing the components or modules of the application, the relationships between these components, and the properties of both the components and the relationships. It is a high-level blueprint that provides a comprehensive understanding of how a software system is organized and how it will function.
Key aspects of software architecture
- Components: Components are individual parts of the software system, such as modules, classes, or functions, that perform specific tasks or groups of tasks.
- Connectors: Connectors are the mechanisms that allow components to communicate with each other, such as APIs, data streams, message queues, or remote procedure calls.
- Configuration: Configuration describes the arrangement and interaction of components and connectors in the system.
- Constraints: Constraints are the technical and business rules that affect the architecture, such as performance requirements, security standards, or compliance regulations.
- Rationale: Rationale is the reasoning behind the architectural decisions, including trade-offs and choices made to meet the system's objectives.
Software Architecture Principles
S.O.L.I.D
The SOLID principles are a set of five design principles intended to make software designs more understandable, flexible, and maintainable. These principles encourage software developers to create more scalable, robust, and easier-to-manage applications.
Here's a brief overview of each principle:
- Single Responsibility Principle (SRP)
- A class should be responsible for only one operation.
- Open/Closed Principle (OCP)
- Classes/modules/functions should be open for extension but closed for modification.
- By implementing this, existing code will not be changed, and because of this errors reduced.
- Liskov Substitution Principle (LSP)
- Subclasses should be able to process the functionalities independently and produce results.
- Interface Segregation Principle (ISP):
- A very large interface design is not allowed. It should be splitting large interfaces into specific smaller tasks.
- Dependency Inversion Principle (DIP):
- Parent modules should not depend on child modules.
- Both should depend on interfaces.
Important Characteristics of Software Architecture
- Performance: Performance can be measured depending on various factors like response time, throughput, and execution time for specific requests.
- Availability: System’s uptime means the system is operational and accessible.
- Maintainability: It improves the code readability and the use of standard patterns and practices.
- Testability: The system should allow the team to test all the components of the application independently and in minimum time.
- Modularity: The system should be divided into multiple modules so that each module is responsible for performing one specific task.
Steps to Design Software Architecture
- Clear requirements understanding
- System designing visualization
- Identify key scenarios
- Identify key issues
- Create Candidate Solutions
Implementation of system designing visualization by UML
Unified Modelling Language (UML) is a general-purpose modeling language. The main aim of UML is to define a standard way to visualize the way a system has been designed. It is quite like blueprints used in other fields of engineering. UML is not a programming language; it is rather a visual language.
Some UML diagrams to design system
- The Component Diagram
- It shows components
- It shows implemented and required interfaces
- It shows that components can be nested
- The Class Diagram
- It shows classes
- It shows methods and fields
- It describes the associations, generalizations, and cardinality
- The Sequence Diagram
- It shows the call sequence
- It shows the calling class, called method, and return data type
- It can depict loops
- The State Diagram
- It shows states or activities
- It shows allowed transitions
- It can be nested
- It can depict internal activities
- The Activity Diagram
- It shows the process and workflow
- It can be nested
- It can show concurrent actions
- It can have swim lanes
- The Layer Diagram
- It is non-standard and shows areas of concern
- It shows references between areas
- It can be validated
- The Use Case Diagram
- It shows actors
- It shows use cases
- It binds actors to use cases
- It can depict generalizations
Use of architecture patterns in system designing
Various architectural patterns can be used to better design the system. Some of them are listed below
Layered Architecture Pattern
Layered Architecture pattern is divided into 3 patterns
- Client/Server pattern
- Its distinct client and server
- It separated by a network
- It describes the communication protocol
- Many clients, one server
- Layered pattern
- Strict areas of concern
- Layers may only communicate with peers above/below
- N-Tier Pattern
- Layers deployed to servers
- Usually 3 tiers
- Communication between layers uses a network
Structural architecture pattern
It is divided into 2 patterns.
- Component-based pattern
- Components are modular building blocks of software
- Grouped into areas of concern
- Clearly described interfaces
- Containers provide additional services
- Object-Oriented pattern
- Use classes
- Grouped into areas of concern
- Describes public members
- Uses inheritance, composition, aggregation and association
Presentation Architecture Patterns
It is divided into 2 patterns.
- MVC Pattern
- Designed for presentation layers
- View handles output
- Model handles data
- Controller handles interaction
- MVVM pattern
- Derived from the MVC pattern
- View handles output
- Model handles data
- View Model is the binding source
Service Architecture Patterns
It is divided into 3 patterns
- Service-oriented pattern
- Discrete business services
- Use the network to communicate
- HTTP, XML, SOAP, Binary, etc.
- Microservice pattern
- Services calling services
- Can use a fast private network
- Deployed on multiple servers
- Message Bus Pattern
- Services connected to the shared data bus
- Uses messages for communication
- Supports discovery, failover
Hybrid Architecture Patterns
- It is divided into 3 patterns
- Components in layers
- Layers containing components
- Structured communication, isolation, easy scaling, and testing
- MVC in the presentation layer
- Presentation layer with MVC
- Separation of concerns, presentation code scalability
- Objects in components
- Components contain objects
- Cohesion and extensibility
How to choose the right pattern?
- Determine the current and future load. Accordingly, scaling can be decided.
- Choose a pattern that promotes modularity and is loosely coupled.
- Patterns can be considered based on the domain and context in which the application will operate.
- Understand the business goals, end-user needs, scalability demand, performance expectations, and security concerns.
Conclusion
Software architecture provides a way to find out the problems involved with the old implementation. Software architecture is the best way to remove the technical debt involved in processing unstructured data for a complex project. Solution Architecture must have a standard reliable approach to business engagements and it must work collaboratively with other architecture roles, business analysis, and service management to ensure continually along the solution delivery journey.