Before developing applications based on the Stage model, developers need to understand the basic knowledge of application design mechanisms, application package structures, and more.
Applications and Application Packages#
User applications generally refer to programs that run on top of the device's operating system, providing specific services to users, abbreviated as "apps." The software package file corresponding to an app is called an "application package."
The current system provides management mechanisms for application package development, installation, querying, updating, and uninstallation, facilitating developers in developing and managing applications. At the same time, the system shields the differences between different chip platforms (including x86/ARM, 32-bit/64-bit, etc.), allowing application packages to be installed and run on different chip platforms, enabling developers to focus on the implementation of application functionalities.
Multi-Module Design Mechanism of Applications#
-
Support for Modular Development: An application typically contains multiple functionalities, and dividing and managing different functional features by modules is a good design approach. During the development process, we can develop each functional module as an independent Module, which can include source code, resource files, third-party libraries, configuration files, etc. Each Module can be compiled independently to achieve specific functionalities. This modular and loosely coupled application management approach aids in the development, maintenance, and expansion of applications.
-
Support for Multi-Device Adaptation: An application often needs to adapt to various device types. In applications designed with a multi-module approach, each Module will indicate the supported device types. Some Modules support all types of devices, while others only support certain types or a few types of devices (such as tablets). Therefore, when distributing application packages in the application market, precise filtering and matching can be done based on device types, allowing different packages to be reasonably combined and deployed to the corresponding devices.
Module Types#
Modules can be divided into two types based on usage scenarios:
-
Ability Type Modules: Used to implement the functionalities and features of the application. Each Ability type Module, after compilation, generates a file with the .hap suffix, which we call the HAP (Harmony Ability Package). HAP packages can be installed and run independently and are the basic units of application installation. An application can contain one or more HAP packages, specifically including the following two types.
- Entry Type Modules: The main module of the application, containing the application's entry interface, entry icon, and main functional features, generating an entry type HAP after compilation. Each application distributed to the same type of device can only contain one unique entry type HAP.
- Feature Type Modules: The dynamic feature modules of the application, generating feature type HAP after compilation. An application can contain one or more feature type HAPs, or it may not contain any.
-
Library Type Modules: Used for sharing code and resources. The same Library type Module can be referenced multiple times by other Modules. Reasonable use of this type of Module can reduce development and maintenance costs. Library type Modules are divided into Static and Shared types, generating shared packages after compilation.
- Static Library: Static shared library. It generates a file with the .har suffix after compilation, which is the static shared package HAR (Harmony Archive).
- Shared Library: Dynamic shared library. It generates a file with the .hsp suffix after compilation, which is the dynamic shared package HSP (Harmony Shared Package).
ArkUI Framework#
ArkUI (Ark UI Framework) provides a complete infrastructure for UI development of applications, including a concise UI syntax, rich UI functionalities (components, layouts, animations, and interaction events), as well as real-time interface preview tools, supporting developers in visual interface development.
Basic Concepts#
-
UI: User Interface. Developers can design the user interface of the application as multiple functional pages, managing each page in separate files and completing inter-page scheduling management such as navigation and back operations through page routing APIs, achieving functional decoupling within the application.
-
Components: The smallest units for building and displaying UI, such as lists, grids, buttons, radio buttons, progress bars, text, etc. Developers can combine various components to build a complete interface that meets their application requirements.
Two Development Paradigms#
-
Declarative Development Paradigm: Uses the ArkTS language, which is an extension of TypeScript's declarative UI syntax, providing UI rendering capabilities from three dimensions: components, animations, and state management.
-
Web-like Development Paradigm: Uses the classic three-part development approach of HML, CSS, and JavaScript, i.e., using HML tag files to build layouts, using CSS files to describe styles, and using JavaScript files to handle logic. This paradigm is more in line with the usage habits of web front-end developers, making it easier to quickly transform existing web applications into Ark UI framework applications.
The Ark development framework based on the declarative development paradigm of ArkTS is a set of development frameworks for minimalist, high-performance, cross-device UI development, providing the necessary capabilities for building application UIs, mainly including:
This article is synchronized and updated to xLog by Mix Space. The original link is http://www.sroxck.top/posts/harmony/arkui