sroxck

sroxck

Harmony Application Package and ArkUI

Before developing applications based on the Stage model, developers need to understand the basic knowledge of application design mechanisms, application package structure, 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 the development, installation, querying, updating, and uninstallation of application packages, making it easier for developers to develop and manage applications. At the same time, the system also 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 functional implementation of the application.

Multi-Module Design Mechanism of Applications#

  • Support for Modular Development: An application typically contains multiple functions, 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 functions. This modular and loosely coupled application management approach helps 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 multiple Modules, 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 app 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 functions and features of the application. Each Ability type Module, after compilation, generates a file with the .hap suffix, which we call an HAP (Harmony Ability Package). HAP packages can be installed and run independently and are the basic unit 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. Proper 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. After compilation, it generates a file with the .har suffix, which is the static shared package HAR (Harmony Archive).
    • Shared Library: Dynamic shared library. After compilation, it generates a file with the .hsp suffix, 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 features (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 scheduling management between pages such as navigation and back operations through the page routing API, achieving decoupling of functions 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 construct 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 framework for minimalist, high-performance, cross-device UI development, providing the necessary capabilities to build application UIs, mainly including:

ArkUI Development Framework

This article is synchronized and updated to xLog by Mix Space. The original link is http://www.sroxck.top/posts/harmony/arkui

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.