How can hybrid App development be played?

As more and more software is provided in the form of saas or cloud, the proportion of hybrid app development is increasing, and major companies are turning to this type of development. I have seen some articles recently, and the development of hybrid apps can also use the theory of the father of computers - the von Neumann structure to open up brain holes.

In this article, let's briefly introduce it.

Front science popularization: Which apps can be put on the app market?

Many people have a misunderstanding when Apple puts it on the shelves. They think that as long as they are not natively developed apps (even with a little function), they cannot be put on the shelves.

It is not. The software received by Apple does not distinguish between Web App, Hybrid App or Native App:

1. Web App: The webview in the App opens the remote website. The biggest disadvantage of Web App is: loading resources are remote every time you have to reload and the speed will slow down, commonly known as website packaged APP.

2. Hybrid App: The webview in the App opens local H5, js, css and image resources without reading remote data. The reduction of loaded resources greatly speeds up the opening of the App, commonly known as the mixed-developed APP

3. Native App: The logical framework and image resources are local, and the data is rarely read. When submitting the application market for review, because they are all packaged and loaded locally, there are not many business processes that can be changed after the App is put on the shelf, so Native apps cannot flexibly respond to market demand, which is one of the important factors why many apps, even big manufacturers, need to switch to hybrid app development.

Hybrid app development method-1: webview loads web pages

WebView is a component that embeds web content in mobile applications and is used to implement Hybrid App development. In Hybrid development, you combine native app code (usually written in a language such as Java (Android) or Swift/Objective-C (iOS)) with web technologies (such as HTML, CSS, and JavaScript) to simultaneously Take advantage of native apps and web content.

The working principle of WebView is roughly:

1. Embed web content: This is the most basic component. Developers can use the WebView component to create a view to display a specified web page (local or remote);

2. Load HTML, CSS and JavaScript to create a more interactive and dynamic interface, thereby enhancing the user experience of the application;

3. Create a communication bridge and call native functions: JavaScript code can use native functions of the device by calling native interfaces, such as accessing the camera, location information, storage, etc. Native code can expose these functions to JavaScript scripts for use in WebView;

4. Performance and security: Although WebView can embed Web content, it is far less secure than a complete native application. In addition, WebView essentially runs in the sandbox environment of the application and is separated from the rest of the application, so security can be guaranteed to a certain extent.

This kind of App, at the beginning of the Internet 2.0 stage, when the web page was popular, its technical layer was once favored by developers, but with the improvement and progress of the application market review mechanism, after the development of this kind of App is completed, it needs to go through many times. The review can only be put on the shelves, or even never passed.

As a result, hybrid App development using Java classload has entered the mainstream of App development.

Hybrid app development method-2: java classload class loading mechanism

Using Java's class loading mechanism to read bytecode from a network stream to load classes is often referred to as Remote Class Loading. This technology can be used to achieve hybrid App development in specific cases, especially when it is necessary to dynamically update application functions or modules. Here's the rationale:

  1. Generate and transmit bytecode: In hybrid app development, you can compile the bytecode of some Java classes into binary form and transmit it to the mobile application over the network. These bytecodes represent some new functionality or module that you want to introduce, or update existing functionality.

  2. Custom class loader: In the application, you need to implement a custom class loader to read the bytecode from the network stream and load the corresponding class. Java's class loading mechanism allows you to create custom class loaders by extending the ClassLoader class, which can override the default behavior of loading classes.

  3. Class loading process: When the application code needs to use a certain class, it will first search and load it through a custom class loader. If the class has not been loaded, the class loader will read the corresponding bytecode from the network stream and convert it into a Class object. Loaded classes can be instantiated and used in the application just like classes loaded in the normal way.

  4. Security and isolation considerations: Remote class loading involves issues of security and isolation. You need to ensure that only trusted bytecode is loaded to prevent malicious code injection. In addition, you also need to pay attention to avoid problems such as class conflicts and memory leaks.

  5. Dynamic updates and modularization: Remote class loading allows you to introduce new features, fix bugs, or modify existing features by updating the remote bytecode without re-publishing the application. This is useful when you need to quickly respond to user requests or perform A/B testing.

Hybrid App Development Method-3: Referring to the von Neumann structure, the packets transmitted over the network can be either data or code

Referring to the von Neumann structure, storing code and data in the cloud for hybrid app development can realize an architecture similar to "cloud hybrid application". The basic principle of this architecture is to store the core logic and data of the application on the cloud server, while the application on the mobile device is mainly responsible for displaying the interface, user interaction and communication with the cloud.

​The following is its rationale:

  1. Separation of front-end and back-end: In this architecture, the application on the mobile device mainly acts as the front-end, responsible for displaying the user interface, responding to user input, and communicating with the cloud. The core logic and data storage of the application are placed on the cloud server, acting as the back-end role.

  2. Cloud logic and data: The core logic of the application, business processing and data storage are all carried out in the cloud. This includes the application's business logic, database, file storage, etc. Applications on mobile devices communicate with cloud servers to obtain required data and perform necessary operations.

  3. Mobile interface: The application on the mobile device is mainly responsible for displaying the user interface, receiving user input and passing it to the cloud. Mobile applications can use local technologies (such as native UI components or local WebView) to build user interfaces, and at the same time initiate requests to cloud servers through network requests.

  4. Cloud communication: Mobile devices communicate with cloud servers through network connections. This can be done through HTTP protocol, WebSocket, etc. The mobile application sends a request to the cloud, and the cloud executes logic according to the request and returns corresponding data or results.

  5. Dynamic update and maintenance: Under this architecture, the core logic and data of the application are stored in the cloud, so it is possible to dynamically update the application's functions, fix bugs, or introduce new features without requiring users to manually update the application. This enables faster response to user needs and market changes.

The construction technology of modern super apps such as WeChat, Alipay, Baidu, Meituan, etc. is a similar concept: small program + App shell

Compared with the traditional native application development technology, the applet technology has the advantages of light weight, rapid development, cross-platform, no installation, and more user-friendly. Mini programs can be used without downloading and installing by users. At the same time, the development cost of mini programs is relatively lower, the development speed is faster, and it is easier to maintain and update. The applet technology also supports cross-platform operation and can run on multiple mobile devices at the same time, which greatly expands the coverage of applications and brings greater commercial value to enterprises and developers. Some of the more well-known small program container technology products on the market include: WeChat, Alipay, Baidu, Douyin small programs, etc., all of which are based on the technology base to improve the small program ecology of the big social platform, and can provide third parties for privatization deployment There are: FinClip , mPaaS and other products. It is understood that the small program container technology independently developed by FinClip can enable enterprises’ apps to have the ability to quickly run small programs, and their SDK can also be embedded in functional device terminals other than apps (such as Linux, Windows, MacOS, Kirin and other operating systems).

With the vigorous development of the mobile Internet, traditional native applications and Web applications are gradually merging, and the von Neumann structure provides a solid theoretical foundation for this. By storing the core logic and data of the application in the cloud, the separation of applications is realized, which not only brings more convenient maintenance and update methods for developers, but also provides users with a more lightweight experience. Small program technology further promotes this trend. With its low entry threshold and rapid development characteristics, developers can build feature-rich applications more flexibly.

However, the development of cloud hybrid applications also faces some challenges. Issues such as network connection stability, security, and user privacy need to be carefully considered and resolved. At the same time, the development of technology should also be closely integrated with user needs to ensure that application performance and user experience can be continuously improved. The integration of cloud storage, applet technology and other elements is leading the new trend of mobile application development. In the future, we can expect more innovations and breakthroughs to make the development of mobile applications more intelligent, convenient and in line with user expectations. Both developers and users will benefit from this wave of change.

Guess you like

Origin blog.csdn.net/speedoooo/article/details/132410305