Soft Examination Senior Software Architect Thesis - On Software Architecture Style

On Software Architecture Style

A software architectural style is an idiomatic pattern that describes the way a system is organized in a particular application domain. An architectural style defines a family of systems, ie an architecture defines a vocabulary and a set of constraints. The vocabulary contains some types of components and connections, and this set of constraints indicates how the system combines these components and connections. The architectural style reflects the structural and semantic properties shared by many systems in the domain, and guides how to effectively organize various modules and subsystems into a complete system.

Please focus on the topic of " On the Style of Software Architecture ", and discuss it from the following three aspects in turn.

1. Briefly describe the software system development projects you participated in the analysis and design and the main work you took on.

2. What are the commonly used software architecture styles in software system development? Elaborate on the specific meaning of each style.

3. Describe in detail what software architecture style is used in the software system you participated in the analysis and design, and analyze the reasons for adopting this architecture style design.

Summary:

In November 2019, I participated in the "one-on-one online education for foreign teachers" project of an online education platform in Guangdong Province. This project provides customers with one-on-one video teaching by European and American foreign teachers, social circles, public live broadcast and other functions, providing a full range of software Support, I am a system architect in this project team, mainly responsible for the overall architecture design and middleware selection. Taking the education platform as an example, this paper mainly discusses the specific application of software architecture style in this project. The whole system adopts the design concept of hierarchical software architecture with three layers, which are application layer, service layer and data layer. In the design of the business logic layer in the application layer, the entire business system is divided into more than ten subsystems. The service layer uses the SpringCloud Alibaba service framework as the core, and the data layer uses the Mybatis framework. The entire system development work lasted 18 months. At present, the system has been running stably for nearly a year and a half. Practice has proved that this architecture design effectively reduces maintenance costs and improves system openness, scalability, reusability and portability.

text:

As the country pays more and more attention to education, the market share of English education is gradually increasing, and users' demand for oral English improvement is increasing. To this end, some companies have started to provide platforms for chatting with foreigners. Our company decided to enter the field of oral education from the field of international communication. For this strategic shift, the company designed an online education platform system (hereinafter referred to as the "system") in November 2019. The system helps people communicate and teach face-to-face with foreign teachers in Europe and America. Among them, casual chat provides a QQ video call, and formal courses also provide H5 interactive courseware to improve teaching quality. At the same time, there are public live broadcasts to attract new students, and AI tests are used to evaluate students' abilities and reduce costs. I participated in the development of the project as a system architect and was mainly responsible for designing the system architecture. There are 9 members in this project team. I am mainly responsible for project plan formulation, demand analysis, overall architecture design and technology selection, and underlying design. The architectural work of the project was completed in February of the following year, and the entire project took 18 months to be completed in May 2021.

At the beginning of the architectural work, we realized that the architectural style defines the terminology used to describe the system and a set of rules to guide the construction of the system. solution. This architecture-level software reuse can greatly improve our system construction process.

Commonly used software architecture styles in software system development include: data flow style, call/return style, independent component style, virtual machine style, and warehouse style. Dataflow styles include batch sequences and pipeline-filters, where each step is processed independently and executed sequentially, suitable for simple linear processes. Call/return styles include main program/subroutine style, object-oriented style, and hierarchical structure style, which further reduce system coupling and clarify system levels. The independent component style includes process communication, event-driven (implicit invocation), and its component features provide support for software reuse. The virtual machine style includes interpreter style and rule-based system style, which has good flexibility and can customize rules. Warehouse styles include database system style, hypertext system style, and blackboard system style, which are data-centric. In addition, there are architectural styles such as dssa and soa.

After understanding the requirements, we decided to adopt a hierarchical architecture style with the advice of the company's technical consultants. In order to solve the code redundancy problem of the company's original communication system, we have implemented system service, and different service centers in the middle layer provide different business services. Finally, we divide the system into application layer, service layer, and data layer. The application layer is responsible for specific business and view display, such as the home page of the website, search input and result display in the app, etc. It is further divided into the view layer and the business logic layer. The service layer is responsible for providing general service support for the application layer, such as account management service, session management service, etc., which is subdivided into a logic processing layer and a data interface layer. The data layer is responsible for providing data storage access services, such as database services, cache services, file services, search services, etc. Below, I will introduce the design process of the three-tier architecture in detail.

The first is the application layer. In the application layer, we divide the system horizontally according to the application, which is helpful for code management and maintenance. We divide the system into more than ten subsystems such as courseware management system, public live broadcast system, student testing system, and course management system. Here we take the courseware management system as an example. The courseware management system is responsible for the courseware used by students in class, and has multiple functional modules such as courseware editing, courseware preview, courseware interaction, and courseware display. The function module calls the service support of the service layer. For example, the courseware interaction needs to call the AMQP communication service implemented by RabbitMQ in the service layer. Through this communication service, the courseware synchronization between the teacher and the student is realized, so that the courseware interaction becomes interesting and vivid. Be interactive. On the other hand, in order to distinguish the interaction authority of the teacher end and the student end, the courseware module also needs to call the account service of the service layer to determine the user's identity, so as to clarify the user's interaction authority in the courseware interaction. At the same time, in order to improve the modifiability and interactivity of the courseware, the courseware is written in H5. The application layer mainly uses vue, a MVVM framework for building user interfaces. Its core is to provide two-way data binding between view and viewModel. There is no direct connection between view and model, but interaction through viewModel. View changes are automatically reflected on viewModel, and vice versa. This ensures that the view and data consistency. In addition, there are dynamic and static separation, static dynamic resources, etc., which will not be repeated here.

The second is the service layer, which is implemented using technologies such as the SpringCloud Alibba service framework. With the expansion of the server scale and the increase of developers, each application becomes complex, bloated, and there is a lot of code duplication. To solve this problem, two solutions are proposed. One is to split the application into smaller pieces, ensuring that each application remains at a suitable size. The advantage is that the design can be completed faster and the code is easier to implement. There are some problems with this solution. On the one hand, the pressure on the number of connections to the database still exists, and on the other hand, the redundancy of the code still exists. So we adopted the second solution - the service solution. The service solution means adding a service layer to the application layer and data layer. First of all, from a structural point of view, the system structure is clearer and more three-dimensional. In terms of stability, many scattered codes have become general services and delivered to a dedicated team for maintenance. In consideration of cost and technology maturity, we adopted the SpringCloud Alibaba service framework developed by Alibaba. SpringCloud Alibaba provides a one-stop solution for microservice development, which includes the necessary components for developing distributed application microservices, such as: registry component Nacos, load balancing component Ribbon, remote call component OpenFeign, gateway component Gateway, service protection The component Sentinel and the service configuration management component SpringCloudConfig facilitate developers to easily develop distributed application services through the SpringCloud programming model.

The last is the data layer, which involves modules such as cache, file system, database, data notification service, and search system. Due to the centralized nature of user access to data, we implemented a caching mechanism based on SpringCache and Redis. Due to the business characteristics of the system, the database often has far more read operations than write operations, so we separate read and write for the database. In terms of data access, Java already has many mature technologies, which can be roughly divided into three types. The first is to provide users with a proprietary API, which is convenient for implementing functions, but has poor versatility. The second is to access the database through JDBC. The data layer itself is a JDBC implementation, that is, it exposes the JDBC interface to the service layer. The cost of this method is very low, and the migration cost is also very low, but the development cost is relatively high. The third way is based on ORM or ORM-like interface. This is the way we adopt. When using the database, we use the ORM framework-Mybatis framework, and then wrap the framework in a layer to realize the functions of the data layer. The interface of Mybatis is still exposed to the outside world. The development of this method is efficient, agile, low in cost, and has good compatibility. In addition, we use ElasticSearch as the search engine at the data layer, and the physical deployment of the data access layer uses the Proxy method. Due to space limitation, no more details are given here.

In the end, the project was successfully launched and has been running normally for nearly a year and a half, receiving favorable comments from all parties. In particular, the good interactivity of H5 courseware has caused a large number of industry peers to imitate and use H5 to make courseware. Also, our service-oriented solution architecture is regarded as a classic solution for the reconstruction of many traditional Internet enterprise systems. In the architecture design of the system, we introduced the design idea of ​​hierarchical architecture, which effectively reduces the maintenance cost and improves the openness, scalability, reusability and portability of the system. Of course there are still some problems. If the H5 courseware adopts the Http protocol, it is easy to be hijacked illegally and embedded with advertisements, which can be solved by modifying the protocol to Https. In addition, the load balancing algorithm we use is a weighted round-robin algorithm, which is too simple and often causes unreasonable resource allocation. It can be solved by changing the algorithm to the weighted minimum number of connections algorithm. These are the places that I need to pay attention to and improve in the future system design and development, and they are also the directions that I should work hard in the future.

Guess you like

Origin blog.csdn.net/qq837993702/article/details/127218973