How to improve the efficiency of idle fish structure by 30%? Research and development practice of flutter + serverless

Time:2020-11-23

How to improve the efficiency of idle fish structure by 30%? Research and development practice of flutter + serverless

Reading guide of Ali Mei:Serverless (no service architecture) is known as the next generation of cloud computing. Since the concept was introduced, it has become very popular in the industry because it can bring about the improvement of R & D delivery speed and the reduction of cost. The idle fish client is based on the architecture evolution and innovation of flutter. After unifying Android and IOS dual terminals through flutter to improve the R & D efficiency, it is hoped to use flutter + serverless To solve the problem that there is a lot of collaboration among different roles, resulting in low overall R & D efficiency, the mobile terminal is getting farther and farther away from the business, and the server has no time to settle in the underlying field, so as to further improve the overall R & D efficiency.

Evolution of R & D architecture

Next, we will review the evolution history of front-end and back-end R & D architectures with two questions.

How to improve the efficiency of idle fish structure by 30%? Research and development practice of flutter + serverless

In the early days of PC Internet, there was no concept of front-end and back-end. At this stage, a single business requirement can be developed by one developer, and the front-end web page and back-end logic are written in one project. With the business becoming more and more complex, the original developers responsible for front-end and rear-end R & D has become inefficient. In this stage, with the outbreak of mobile Internet, the server needs to serve with PC, Android, IOS and other front-end.

There is always a question on the server side: should the interface be designed for UI or general service? One solution is to extract a part of the server side as BFF (back end for front end service to the back end of the front end), as the adaptation layer between the front and rear end, the core is to solve the data aggregation and arrangement, and re explore a more reasonable hierarchical cooperation mode.

BFF writing on the server side brings new problems, and the package interface always fails to improve personal ability. If BFF is developed by end-to-side students, this problem can be solved, and the specific technical scheme is also the problem we need to consider next.

Cloud integration technology solution

How to improve the efficiency of idle fish structure by 30%? Research and development practice of flutter + serverless

Serverless is composed of baas (backend as a service) and FAAS (function as a service). It is mainly used in the service layer of baas to encapsulate the service requirements of the baas, including the service requirements of the baas. As an end-to-side development, the core concerns the code development of client and FAAS layer.

At present, FAAS environment of the company has supported Java, kotlin, swift, dart Node.js And other languages and frameworks, idle fish through Android (flutter), IOS (fluent), FAAS (DART runtime) all use dart to achieve language integration, and realize the integration of protocol and engineering.

Language integration:Android, IOS and FAAS layers are developed with dart language to realize the unification of three end languages and effectively shield the language learning cost of FAAS layer.

Protocol integration:Through the integrated framework, the communication details are shielded, and the front and rear end share the same state, which reduces protocol conversion. When the front-end students call FAAS services, they are as concise as calling local functions.

Engineering Integration:The front end and back end can be developed in the same project, and the dart feature can be used for rapid development and joint debugging through the hot reload mechanism.

Practice of single page integration

The following is an example of single page integration of idle fish, through the two parts of page rendering and interaction to carry out the integration practice process.

How to improve the efficiency of idle fish structure by 30%? Research and development practice of flutter + serverless

Single rendering integration

As can be seen from the left side of the above figure, the client needs to request five interfaces on the end side to process the logic between the rendering interfaces and convert the data returned by the interfaces into ViewModel. After the integration transformation, the original logic on the end side has been moved to FAAS layer, including aggregating five domain services, processing business logic, field mapping and page layout. There is no rendering and business logic on the end side, and the returned ViewModel page is directly obtained to refresh the page. The following is the flow chart of cloud integration.

How to improve the efficiency of idle fish structure by 30%? Research and development practice of flutter + serverless

Single page interactive operation

As can be seen from the right side of the above figure, there are four kinds of operations that will change the actual payment. Originally, these operations are processed on the end side. After the integrated transformation, there is no calculation logic on the end side. The client will request the server for each operation, and FAAS will check whether the red packet has expired, and then return the page data to refresh.

Integrated R & D framework

How to improve the efficiency of idle fish structure by 30%? Research and development practice of flutter + serverless

Nexus FrameworkIntegrated mobile UI framework based on fluent.
Logic Engine:Integrated communication and scheduling framework based on fluent.
Nexus Server:An integrated server-side framework based on dart runtime.

Code example

The following figure shows the code example of client’s single page initialization:

How to improve the efficiency of idle fish structure by 30%? Research and development practice of flutter + serverless

The following figure shows the processing of initialization request initiated by the client by FAAS layer:

How to improve the efficiency of idle fish structure by 30%? Research and development practice of flutter + serverless

The above is a development example of the integration of the two terminal protocol of flutter + FAAS. Both terminals interact through binderaction, and the states in the action are of the same type, thus effectively shielding communication details and improving R & D efficiency.

Benefits and effects

The single page has been launched. Looking back at the whole R & D process, the cloud integrated R & D architecture is not only a new technical solution, but also an extension of the end-to-side work boundary and the reshaping of production relations.

Collaborative efficiency improvement:Compared with the dual terminal integration brought by flutter, the three terminal integrated architecture further improves the overall R & D efficiency by 30%.

Business closed loop:The end side can also feedback and respond to the business more quickly and try to build a more perfect product model and create more value for the business.

Personnel growth:The end-to-end side has changed from only focusing on the development resources of user experience to the technical director of the whole business R & D, from only focusing on the local perspective of the end side to the global perspective of more focused on business closed-loop. FAAS layer calls the underlying domain services to complete their own business, and the original server can focus more on the precipitation of domain services.

Summary and Prospect

The three terminal integrated R & D architecture of flutter + serverless can solve the two problems of the original R & D architecture proposed in this paper. By changing the end-to-side functional boundaries, the client can be responsible for the whole business, and the server has more time for domain precipitation. However, when the idle fish practices the three terminal integrated R & D architecture of flutter + serverless, it also meets the following challenges:

  • The R & D experience of FAAS layer needs to be improved and debugged. It can only be viewed through Gaia log. At present, the plan is to grab the platform log locally and provide remote debugging function for FAAS code.
  • The operation and maintenance cost increases, and how to smooth the difference between the problem location, request link, pressure test and work safety transfer.

These are the new challenges found in the process of practice, which have now been included in the next stage of work. We have completed these challenges by optimizing technical solutions.


Author: ancient style

Read the original

This article is from Alibaba cloud partner “alitech”. If you need to reprint it, please contact the original author.