In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what is the cross-platform architecture model of web". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn what the cross-platform architecture model of web is.
1. Based on library / mode library encapsulation
A pattern library is a collection of reusable code, such as front-end components, general tool functions, and so on.
Before I was exposed to Web development, I was a Qt fan (Qt is a cross-platform C++ application development framework. Because you didn't have much choice for desktop application development more than a decade ago, either GTK or Qt. And I am still a KDE fan and an OpenSuSE fan by the way, because I have the most stable desktop environment.
In the past, the performance of CPU was not so good, the JavaScript engine was not so fast, and the Web browser was just an auxiliary tool. If you want to develop cross-platform applications, you have to start with the underlying library.
Um, so, people who develop games choose frameworks such as Qt, wxWidgets, Gtk+ and so on as the infrastructure for their applications. I'm used to calling such tools pattern libraries because they abstract patterns into code, otherwise how can they cross platforms?
1.1 IDE encapsulation mode library details
With IDE, we no longer focus on these low-level details. However, we are still based on these pattern libraries.
two。 Build through cross-compilation
Cross-compilation refers to generating executable code on one platform on another.
On my college campus, what I come into contact with most is the cross-compilation of embedded applications, so I don't like it at all. Because it is not cross-platform, but also depends on specific MCU, SoC IDE, my code can only run on a specific platform.
When I was poor, I thought I was far from cross-compiling-after all, you started with three machines Windows, macOS, GNU/Linux, or through a continuous integration server to do something like that. When I had only one machine, only the virtual function of Kaka solved my conflicts.
Until last year, when I wrote Coca in Golang, I reacquainted myself with cross-compilation. Under macOS, I can directly compile a program that can run under GNU/Linux or Windows operating systems.
Language running environment
The details are encapsulated through the platform, and then the language is provided as an API for external system calls.
3. On top of the operating system: language interpreter
This is actually very easy to understand, such as the languages we use every day, such as Ruby, Python, and so on, can fall into this category.
They encapsulate the underlying details of the operating system and provide a variety of API abstractions. Get rid of some platform-specific code, just pick up the source code and run it directly on another platform.
For those operating systems without an interpreter, executable files such as Pyinstaller can be packaged into the target platform.
4. Embedded runtime
Considering the particularity of embedded devices, I regard the embedded runtime as an independent mode. Because running a language interpreter on an embedded device, you must need an operating system. In turn, a large number of API needs to be customized for different hardware situations. Open source applications that adopt this kind of architecture pattern include NodeMCU using Lua language, IoT.js using JavaScript language, and so on.
5. Based on application software
There is no doubt whether this is a cross-platform architecture model for Lua as a scripting language in the game world or JavaScript, which is widely used in the Web world.
Browser / Electron
Web application is the most widely used cross-platform application. Even, you don't need to use the same manufacturer's browser to run the same Web application. And these are precisely the browsers that provide JavaScript + HTML + CSS. JavaScript is one of the few languages that can read code and run directly from notepad-after all, operating systems offer Web browsers.
Due to the rapid development of front-end technology, the ecology has become increasingly perfect, making frameworks such as Electron, so that more and more companies use it as a desktop application development framework, the most representative is: Visual Studio Code.
Tool runtime: Emacs
PS:Emacs is both the best editor and the best operating system.
In addition to browsers, Emacs also has a built-in literal scripting language called Emacs Lisp, which extends the functionality of the operating system.
There is no doubt that the main purpose of this pattern is to use the platform language as an extended development language.
Cross-language
Building a cross-language platform is not an easy task. This part is mainly about cross-platform mobile applications and cross-front and back-end applications.
6. Encapsulate differences with DSL / language
In the past few years, cross-platform mobile application frameworks have become very popular, among which React Native and Flutter are on the rise. Although the operating mechanisms of the two frameworks are not quite the same, considering that both frameworks + languages encapsulate the differences of the Android + iOS platform, I classify them into the same category.
PS: as soon as it happens, although Flutter is architecturally better, its damned layout is only for native app developers to like.
However, it is not easy to develop such a DSL or language. In a sense, we need at least Android x 1 + iOS x 1 + Web x 1 + AppDev x 1.
7. Language converter
Language conversion is carried out through AST, and then a series of wrapper is used to encapsulate the framework of the target language, so as to achieve the goal of using A language to develop B language applications. This is common in the field of Web front-end development.
It is not a big problem to convert B language directly from A language. However, in the transformation, we need to consider what is the core?
Frame wrapper
This type of tool is too niche, and it can never keep up with the speed of change at the front end. Apart from this, it may be written in a strange way, as an example of Scala.js-React:
Val Hello = ScalaComponent.builder [String] ("Hello") .render_P (name = >
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.