Technology Sharing

Getting started with HarmonyOS development, understanding of ArkTS language

2024-07-11

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

HarmonyOS (codenamed Ark, officially known as Huawei Terminal HarmonyOS Intelligent Device Operating System Software) is a distributed operating system developed by Huawei since 2012 and officially released in August 2019. The system uses "distributed" technology to integrate multiple devices such as mobile phones, computers, tablets, TVs, cars and smart wearables into a "super terminal", making it easy for users to operate and share resources of various devices. Through this blog, I will record the key points and difficulties I encountered in learning HarmonyOS syntax.

1. The relationship between ArkTs language and TS and JS

insert image description here
ArkTSThe language is based onjavaScriptandTypeScriptThe enhancement and optimization ofjsandtsThe functions it has can be fully controlled by the web page control and data status updateArkTSto fulfill.ArkTSHas strong expansion capabilities, such as declarative UI, state management, etc.

2. Compilation efficiency of ArkTS language

Compared with our normal front-end code development, we need to master bothhtml, css, javaScriptthree languages. But we useArkTSTo develop, just useArkTSOne language, and the code is simple and convenient

insert image description here
If all of this is implemented using a language similar to JS, will its operating efficiency and performance be good?

ArktsAlthough the language is implemented with a declarative UI front end, there is an Ark compiler at its bottom. This compiler will compile the TS language we write into bytecode, and finally convert it into machine code to run. And it will advance the translation process from the runtime to the compilation phase, thereby greatly improving the efficiency of the operation. (AOTtechnology)

insert image description here

3. ArkTS multi-system adaptation and access capabilities

ArkTSThe language has a cross-platform adaptation layer and bridge layer, so we useArkTSThe applications developed also have the ability to adapt and access multiple systems.ArkTSSome characteristics and advantages of the language in multi-system adaptation and access:

  1. Cross-platform compatibilityArkTSOne of the design goals of the language is to achieve cross-platform compatibility. It provides consistent syntax and features so that developers can write code once and run it on different operating systems without a lot of modifications and adjustments.

  2. Operating system interface encapsulationArkTSIt provides interface encapsulation for different operating systems, allowing developers to easily access and call operating system-specific functions and services, including file system access, network communication, graphical interface, etc.

  3. Third-party library and tool supportArkTSSupport for integration of third-party libraries and tools enables developers to leverage existing ecosystem resources to extend the functionality and capabilities of their applications. These libraries and tools can be specific to a particular operating system or cross-platform.

  4. Multi-system adaptation layerArkTSProvides multiple system adaptation layers to handle the differences and features between different operating systems. These adaptation layers provide unified interfaces and functions, allowing developers to write common code on different systems to implement cross-platform applications.

by usingArkTSDevelopers can deploy and run the applications they develop on different operating systems. This multi-system adaptation and access capability enables developers to develop and maintain applications more efficiently, while also providing users with a better cross-platform experience.

ArkTSThe language's multi-system adaptation and access capabilities allow developers to easily develop cross-platform applications and take advantage of operating system-specific features and services. This provides developers with greater flexibility and convenience, while also bringing users a better application experience.