ability-brief.md 2.7 KB
Newer Older
W
wusongqing 已提交
1 2
# Ability Framework Overview

G
Gloria 已提交
3 4 5
Ability is the basic abstraction of applications in OpenHarmony.

Each ability is an application component that provides an independent service and is the minimum unit for the system to schedule an application. An application can contain one or more **Ability** instances.
W
wusongqing 已提交
6

G
Gloria 已提交
7
The ability framework model has two forms:
W
wusongqing 已提交
8

G
Gloria 已提交
9 10 11 12
- FA model, which is available for application development using API version 8 and earlier versions. In the FA model, there are PageAbility, ServiceAbility, DataAbility, and FormAbility.
- Stage model, which is introduced since API version 9. In the stage model, there are two classes: UIAbility and ExtensionAbility. ExtensionAbility is further extended to ServiceExtensionAbility, FormExtensionAbility, DataShareExtensionAbility, and more.

Starting from API version 9, the stage model is recommended.
W
wusongqing 已提交
13

W
wusongqing 已提交
14 15 16 17
The stage model is designed to make it easier to develop complex applications in the distributed environment. The table below lists the design differences between the two models.

| Item          | FA Model                                                      | Stage Model                                               |
| -------------- | ------------------------------------------------------------ | -------------------------------------------------------- |
G
Gloria 已提交
18 19 20 21 22
| Application component development mode      | Web-like development                    | Object-oriented development            |
| Engine instance      | Each **Ability** instance exclusively occupies a VM instance.              | Multiple **Ability** instances share a VM instance.      |
| Intra-process object sharing| Not supported                                                    | Supported                                                  |
| Bundle description file    | The **config.json** file is used to describe the HAP and component information. Each component must use a fixed file name.| The **module.json5** file is used to describe the HAP and component information. The entry file name can be specified.|
| Component          | Four types of components are provided: PageAbility (used for UI page display), ServiceAbility (used to provide services), DataAbility (used for data sharing), and FormAbility (used to provide widgets).| Two types of components are provided: UIAbility (used for UI page display) and ExtensionAbility (scenario-based service extension).  |
W
wusongqing 已提交
23

24
In addition, the following differences exist in the development process:
W
wusongqing 已提交
25 26

* Different ability types
W
wusongqing 已提交
27 28 29

  ![favsstage](figures/favsstage.png)

W
wusongqing 已提交
30
* Different ability lifecycles
W
wusongqing 已提交
31 32 33

  ![lifecycle](figures/lifecycle.png)

W
wusongqing 已提交
34
For details about the two models, see [FA Model Overview](fa-brief.md) and [Stage Model Overview](stage-brief.md).