1# Development Guide Writing Template 2 3 4> **NOTE** 5> 6> *1. This template provides the recommended development guide document framework and writing instructions for typical knowledge points. In your writing, complete the development task scenario analysis and development guide outline design based on the specific **solution/feature/function/module**, and then write the content based on this template.* 7> 8> *2. Do not add any content between level-1 title (marked with #) and level-2 title (marked with ##).* 9> 10> *3. Delete all the writing instructions in italics from your formal documents.* 11 12 13## *Example* Overview 14 15*Mandatory. Based on the scenario division of the solution/feature/function/module, you need to provide either "Example Overview" or "Example Task Scenario Overview", or both of them.* 16 17*1. "Example Overview" provides an overview that is common to all task scenarios of this solution/feature/function/module and that developers need to understand. If there is nothing in common, delete it.* 18 19*2. "Example Task Scenario Overview" describes the contents directly related to a task scenario. The knowledge points and key writing points are the same as those in "Example Overview". In this section, you need to introduce this specific task scenario and describe basic concepts, working principles, constraints, and samples that are directly related to the task scenario. If there is no specific task scenario, delete it.* 20 21***[General Instructions for Writing the Development Guide]*** 22 23***1. Target audience**: internal and external developers (including product managers). Guidelines for UX designers are usually carried by UX design specifications and are not covered in the development guide. If UX design specifications need to be mentioned in the development guide, use hyperlinks.* 24 25***2. Content positioning**: Introduce what the solution/feature/function/module is, why it is required, and how to design, develop, and release related applications/devices. The development guide aims to help developers learn necessary knowledge and achieve specified task objectives in actual development activities.* 26 27***3. User-oriented****: Always provide developer-concerned, perceptible, and useful content from the perspective of developers.* 28 29***4. Task-oriented****: Focus on actual tasks of developers, and provide complete, correct guidance that is easy to follow.* 30 31*5. This template only provides the basic document framework. You can adjust the content based on the actual requirements.* 32 33 34### Introduction 35 36*Mandatory.* 37 38***[Developers' Concerns]*** 39 40*What is the solution/feature/function/module (definition)? What problems can it solve or what benefits can it bring (purpose/customer benefits - why)? * 41 42***[Key Writing Points]*** 43 44- *Provide easy-to-understand and scenario-specific descriptions. Refer to the SCQA method below to introduce the scenarios and characteristics of the solution/feature/function/module.* 45 - *S: situation. Introduce a familiar scenario.* 46 - *C: complication. Describe the conflict between the situation and requirement.* 47 - *Q: question. Ask a question. What can I do in such a case?* 48 - *A: answer. Describe the solution.* 49 50- *Visualize abstract concepts. You can provide content from the perspective of consumers for better understanding, for example, scenario effect in UX.* 51 52***[Writing Requirements]*** 53 54- *Provide clear content. Avoid vague, obscure, and ambiguous expressions.* 55 56- *Use only necessary terms, acronyms, abbreviations, and proper nouns, and provide explanations or links to the glossary.* 57 58- *Use consistent terms, acronyms, abbreviations, and proper nouns throughout the document.* 59 60 61### Basic Concepts 62 63*Optional. Describe the basic concepts that are common to all task scenarios.* 64 65***[Developers' Concerns]*** 66 67*What are the unique concepts that I need to know when using the solution/feature/function/module?* 68 69***[Key Writing Points]*** 70 71- *Provide only the concepts that are mandatory in development tasks.* 72 73- *Describe here concepts used in multiple chapters such as the operation mechanism, restrictions, and development process. If a concept is used only in a chapter, describe the concept in that chapter only.* 74 75- *Do not describe common concepts in the industry. Use common terms in the industry instead of jargon.* 76 77- *If there are logical relationships between concepts, you are advised to use figures to describe the relationships.* 78 79***[Writing Requirements]*** 80 81- *Provide clear content. Avoid vague, obscure, and ambiguous expressions.* 82 83- *Use only necessary terms, acronyms, abbreviations, and proper nouns, and provide explanations or links to the glossary.* 84 85- *Use consistent terms, acronyms, abbreviations, and proper nouns throughout the document.* 86 87***[Example]*** 88 89Before developing relational databases, you must understand the following basic concepts: 90 91- **RDB** 92 93 94A type of database based on the relational model of data. The RDB stores data in rows and columns. An RDB is also called RDB store. 95 96- **Predicate** 97 98 Property or feature of a data entity, or the relationship between data entities. It is mainly used to define operation conditions. 99 100- **Result set** 101 102 A set of query results used to access the data. You can access the required data in a result set in flexible modes. 103 104 105### Working Principles 106 107*Optional. Describe the working principles that are common to all task scenarios.* 108 109***[Developers' Concerns]*** 110 111*How does the solution/feature/function/module work? What are the API calling and triggering time of key steps? I want to understand its principles for better use and debugging.* 112 113***[Key Writing Points]*** 114 115- *If the principle is simple and can be understood from the content under "Basic Concepts", do not provide this section.* 116 117- *Describe only the mechanisms and principles that are visible in the development tasks (use or access). Do not provide internal implementation that is invisible to developers.* 118 119- *If necessary, use sequence diagrams and flowcharts. Ensure that the text description matches the figure description.* 120 121- *Be careful not to disclose internal information.* 122 123***[Writing Requirements]*** 124 125- *Provide clear content. Avoid vague, obscure, and ambiguous expressions.* 126 127- *Use only necessary terms, acronyms, abbreviations, and proper nouns, and provide explanations or links to the glossary.* 128 129- *Use consistent terms, acronyms, abbreviations, and proper nouns throughout the document.* 130 131***[Example]*** 132 133The distributed data objects are encapsulated into JS objects in distributed in-memory databases, which allows the distributed data objects to be operated in the same way as local variables. The system automatically implements cross-device data synchronization. 134 135**Figure 1** Working mechanism 136 137![how-distributedobject-works](figures/how-distributedobject-works.png) 138 139 140### Constraints 141 142*Optional. Describe constraints that are common to all task scenarios.* 143 144***[Developers' Concerns]*** 145 146*What are the constraints for using the solution/feature/function/module? How well is the solution/feature/function/module implemented? Can it meet my requirements?* 147 148***[Key Writing Points]*** 149 150- *Describe perceptible constraints that affect development activities, including but not limited to the following:* 151 - ***Function constraints*** 152 - *Application scope of the solution/feature/function/module (Specify scenarios that are not supported.)* 153 - *Specification constraints* 154 - ***Operation constraints*** 155 - *Operations on known issues* 156 - *Potentially risky operations (such as performance deterioration)* 157 158- *Describe operations that are prone to errors in the procedure, but not in this section.* 159 160***[Example]*** 161 162- Data synchronization can be implemented across devices only for the applications with the same bundleName. 163 164- Each distributed data object occupies 100 KB to 150 KB of memory. Therefore, you are advised not to create too many distributed data objects. 165 166- The maximum size of a distributed data object is 500 KB. 167 168 169### Samples 170 171*Optional. Provide samples that are common to all task scenarios.* 172 173***[Developers' Concerns]*** 174 175*What sample code, codelabs, and demo projects are available?* 176 177***[Key Writing Points]*** 178 179*Provide links (generally Gitee links) to the released sample code, codelabs, and demo projects. Do not include project packages into the document as an attachment.* 180 181***[Example]*** 182 183The following sample is provided to help you better understand how to develop abilities: 184 185- [Intra- and Inter-page Navigation](https://gitee.com/openharmony/codelabs/tree/master/Ability/StageAbility) 186 187 188## Setting Up the Environment 189 190*Optional.* 191 192*Based on the analysis and breakdown of a specific task scenario, you can place the environment setup content under "Prerequisites" or "Preparations" and close to the "How to Develop" of the specific scenario.* 193 194*Specify how to prepare the development environment, including software and hardware configuration requirements, tool requirements, and device requirements.* 195 196*Delete this section if no special requirements are involved.* 197 198 199### Environment Requirements 200 201***[Writing Requirements]*** 202 203*Describe the software and hardware configurations required by the development environment so that developers can prepare the environment in advance. You can use subtitles if there is a large amount of content.* 204 205***[Example]*** 206 207The following table describes the environment configuration requirements specific to the Hi3861 development board. 208 209 **Table 1** Hi3861 development environment-specific requirements 210 211| Platform Type| Development Tool| Function| How to Obtain| 212| -------- | -------- | -------- | -------- | 213| Linux server| SCons3.0.4+ | Executes script compilation.| Internet| 214| Linux server| build-essential | Provides a basic software package for compilation and building.| Internet| 215 216 217### Setting Up the Environment 218 219***[Writing Requirements]*** 220 221*Describe the procedure for setting up the development environment. If there is a large amount of content, use subtitles, for example, "Setting Up the Basic Build Environment" and "Setting Up the Compilation Tool Environment".* 222 223***[Example]*** 224 2251. Start a Linux server. 226 2272. Run the following command to install the tool installation package: 228 229 ``` 230 xxxxx 231 ``` 232 2333. Run the following command to check whether the tool is successfully installed. 234 235 ``` 236 xxxxx 237 ``` 238 239 240### Verifying the Environment 241 242***[Writing Requirements]*** 243 244*Optional. Provide the criteria for checking whether the environment is set up successfully. You can also provide the criteria along with the environment setup procedure, as provided in the preceding example.* 245 246 247## *Example Task Scenario* Development (Use a specific scenario name. If there is only one scenario, use the solution/feature/function/module name.) 248 249*Mandatory.* 250 251***[Developers' Concerns]*** 252 253*How do I use or access the solution/feature/function/module?* 254 255***[Key Writing Points]*** 256 257*Provide scenarios that are close to actual development scenarios.* 258 259- *Task scenarios are what developers need to use to achieve development objectives.* 260 261- *There can be one or more task scenarios. You can use multiple "Development Guidelines" sections. Follow the hierarchical logic when writing the guidelines, that is, a task scenario -> a subtask scenario -> task logic ("Development Process") -> operation procedure ("How to Develop").* 262 263### *Example Task Scenario* Overview 264 265*Based on the scenario division of the solution/feature/function/module, you can provide either "Example Task Scenario Overview" or "Example Overview", or both of them.* 266 267*1. "Example Overview" provides an overview that is common to all task scenarios of this solution/feature/function/module and that developers need to understand. If there is nothing in common, delete it.* 268 269*2. "Example Task Scenario Overview" describes the contents directly related to a task scenario. The knowledge points and key writing points are the same as those in "Example Overview". In this section, you need to introduce this specific task scenario and describe basic concepts, working principles, constraints, and samples that are directly related to the task scenario. If there is no specific task scenario, delete it.* 270 271### Development Process 272 273***[Key Writing Points]*** 274 275- *Optional. If there are many development steps (five or more core operations) or complex logical relationships between steps, provide the development process so that developers can have a panoramic view of the operations to be performed.* 276 277- *Provide flowcharts and tables if necessary.* 278 279 280### Available APIs 281 282***[Writing Requirements]*** 283 284- *Optional. Describe the key APIs in the development steps and provide the API introduction, so that developers can have a general understanding of development.* 285 286- *If there are more than 10 APIs, provide the main APIs only.* 287 288- *Ensure that the APIs and their functions of the corresponding version are supported when the document is released.* 289 290***[Example]*** 291 292Certain APIs can be called only by system applications that have been granted the **SystemCapability.Notification.Notification** permission. The APIs use either a callback or promise to return the result. The tables below list the APIs that use a callback, which provide the same functions as their counterparts that use a promise. For details about the APIs, see the [API document](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-notification.md). 293 294**Table 1** APIs for notification enabling 295 296| API | Description | 297| ------------------------------------------------------------ | ---------------- | 298| isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean>): void | Checks whether notification is enabled.| 299| enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void | Sets whether to enable notification. | 300 301 302### How to Develop 303 304***[Writing Requirements]*** 305 306*Mandatory.* 307 308- *Completeness and Correctness* 309 - *Describe the complete development process (for example, steps related to the code, resources, third-party libraries, and application configuration files in the HAP) so that developers can correctly complete the development. Do not omit key configuration operations.* 310 - *Ensure that the code snippet provided in the document can be built with the context in DevEco Studio.* 311 - *Ensure that the complete sample code provided in the document can be run in DevEco Studio, and the execution result is the same as that described in the document.* 312 313- *Clarity* 314 - *Provide a clear execution owner (who), operation purpose (why), operation content (what/how), and scenario (when/where) for each step. Use imperative sentence to describe steps.* 315 - *Clearly provide the APIs (if involved) in steps, as well as their usage description and sample code.* 316 - *Provide development suggestions or precautions for key steps and sample code (comments for sample code).* 317 *Think about what questions may be raised when developers are performing the operations.* *These problems are obstacles to developers.* *Provide support information in the document to help them handle these obstacles.* *Examples of support information:* 318 - *Branch selection principle. Provide principles or suggestions for selecting branches and parameters.* 319 320 - *Necessary supplementary description. Describe possible special operations, required operation permissions, high efficiency skills, and concise and clear background knowledge.* 321 322 - *Precautions. Describe operations that may adversely affect other functions or system performance and reliability, and operations that may cause data loss or security problems.* *Provide this type of information in a style different from that of the body prior to the operation procedure.* 323 324 - *Error prevention/correction information. Provide guidance for preventing, locating, or rectifying typical problems that may occur in the development process.* *This type of information can be provided in "How to Develop" or "FAQs", depending on the content amount.* 325 326- *Standardization* 327 - *Provide both logically and syntactically correct sample code and write it in a standard manner. Anonymize sensitive information, such as mobile numbers, ID cards, and account names, for example, 186\*\*\*\*\*\*\*\*. Use private IP addresses or a corresponding format, for example, xx.xx.xx.xx and www.example.com, rather than real IP addresses and domain names.* 328 - *Provide code that complies with the code indentation requirements. Do not use the **Tab** key to indent code. Instead, use four spaces, to avoid incorrect display.* 329 330**[Example (Excerpt)]** 331 3321. Import the required modules. 333 334 ```javascript 335 import formBindingData from '@ohos.application.formBindingData' 336 import formInfo from '@ohos.application.formInfo' 337 import formProvider from '@ohos.application.formProvider' 338 ``` 339 3402. Implement the lifecycle callbacks of **LifecycleForm**. 341 342 ```javascript 343 export default { 344 onCreate(want) { 345 console.log('FormAbility onCreate'); 346 // Persistently store widget information for subsequent use, such as widget instance retrieval or update. 347 let obj = { 348 "title": "titleOnCreate", 349 "detail": "detailOnCreate" 350 }; 351 let formData = formBindingData.createFormBindingData(obj); 352 return formData; 353 }, 354 onCastToNormal(formId) { 355 // Called when the widget host converts the temporary widget into a normal one. The widget provider should do something to respond to the conversion. 356 console.log('FormAbility onCastToNormal'); 357 }, 358 } 359 ``` 360 361 362### Verification 363 364***[Writing Requirements]*** 365 366- *Optional. After the development is complete, provide a guide to check whether the operation is successful if there is an independent commissioning and verification operation. The operation procedure is the same as that described in "How to Develop."* 367 368- *Provide only the final service commissioning. You are advised to verify the operation result of each subtask after the development is complete.* 369 370 371## FAQs 372 373*Optional.* 374 375***[Developers' Concerns]*** 376 377*What are the typical problems that may occur in the development process of the solution/feature/function/module? How do I locate and solve these problems?* 378 379***[Key Writing Points]*** 380 381*Describe the problems that may occur during the development and the solutions to them.* 382 383- *Delete this section if there are no common problems.* 384 385- *It is recommended that common problems in each task scenario be described in a separate chapter. Common problems related to a single task scenario be described in the corresponding chapter.* 386 387 388 389### 1. XX problem (simple problem) 390 391XXX 392 393 394### 2. XX problem (complex problem) 395 396**Symptom** 397 398XXX 399 400**Possible Causes** 401 402XXX 403 404**Solution** 405 406XXX 407