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 93A 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. 94 95- **Predicate** 96 97 Property or feature of a data entity, or the relationship between data entities. It is mainly used to define operation conditions. 98 99- **Result set** 100 101 A set of query results used to access the data. You can access the required data in a result set in flexible modes. 102 103 104### Working Principles 105 106*Optional. Describe the working principles that are common to all task scenarios.* 107 108***[Developers' Concerns]*** 109 110*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.* 111 112***[Key Writing Points]*** 113 114- *If the principle is simple and can be understood from the content under "Basic Concepts", do not provide this section.* 115 116- *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.* 117 118- *If necessary, use sequence diagrams and flowcharts. Ensure that the text description matches the figure description.* 119 120- *Be careful not to disclose internal information.* 121 122***[Writing Requirements]*** 123 124- *Provide clear content. Avoid vague, obscure, and ambiguous expressions.* 125 126- *Use only necessary terms, acronyms, abbreviations, and proper nouns, and provide explanations or links to the glossary.* 127 128- *Use consistent terms, acronyms, abbreviations, and proper nouns throughout the document.* 129 130***[Example]*** 131 132The 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. 133 134**Figure 1** Working mechanism 135 136 137 138 139### Constraints 140 141*Optional. Describe constraints that are common to all task scenarios.* 142 143***[Developers' Concerns]*** 144 145*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?* 146 147***[Key Writing Points]*** 148 149- *Describe perceptible constraints that affect development activities, including but not limited to the following:* 150 - ***Function constraints*** 151 - *Application scope of the solution/feature/function/module (Specify scenarios that are not supported.)* 152 - *Specification constraints* 153 - ***Operation constraints*** 154 - *Operations on known issues* 155 - *Potentially risky operations (such as performance deterioration)* 156 157- *Describe operations that are prone to errors in the procedure, but not in this section.* 158 159***[Example]*** 160 161- Data synchronization can be implemented across devices only for the applications with the same bundleName. 162 163- Each distributed data object occupies 100 KB to 150 KB of memory. Therefore, you are advised not to create too many distributed data objects. 164 165- The maximum size of a distributed data object is 500 KB. 166 167 168### Samples 169 170*Optional. Provide samples that are common to all task scenarios.* 171 172***[Developers' Concerns]*** 173 174*What sample code, codelabs, and demo projects are available?* 175 176***[Key Writing Points]*** 177 178*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.* 179 180***[Example]*** 181 182The following sample is provided to help you better understand how to develop abilities: 183 184- [Intra- and Inter-page Navigation](https://gitee.com/openharmony/codelabs/tree/master/Ability/PageAbility) 185 186 187## Setting Up the Environment 188 189*Optional.* 190 191*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.* 192 193*Specify how to prepare the development environment, including software and hardware configuration requirements, tool requirements, and device requirements.* 194 195*Delete this section if no special requirements are involved.* 196 197 198### Environment Requirements 199 200***[Writing Requirements]*** 201 202*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.* 203 204***[Example]*** 205 206The following table describes the environment configuration requirements specific to the Hi3861 development board. 207 208 **Table 1** Hi3861 development environment-specific requirements 209 210| Platform Type| Development Tool| Function| How to Obtain| 211| -------- | -------- | -------- | -------- | 212| Linux server| SCons3.0.4+ | Executes script compilation.| Internet| 213| Linux server| build-essential | Provides a basic software package for compilation and building.| Internet| 214 215 216### Setting Up the Environment 217 218***[Writing Requirements]*** 219 220*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".* 221 222***[Example]*** 223 2241. Start a Linux server. 225 2262. Run the following command to install the tool installation package: 227 228 ``` 229 xxxxx 230 ``` 231 2323. Run the following command to check whether the tool is successfully installed. 233 234 ``` 235 xxxxx 236 ``` 237 238 239### Verifying the Environment 240 241***[Writing Requirements]*** 242 243*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.* 244 245 246## *Example Task Scenario* Development (Use a specific scenario name. If there is only one scenario, use the solution/feature/function/module name.) 247 248*Mandatory.* 249 250***[Developers' Concerns]*** 251 252*How do I use or access the solution/feature/function/module?* 253 254***[Key Writing Points]*** 255 256*Provide scenarios that are close to actual development scenarios.* 257 258- *Task scenarios are what developers need to use to achieve development objectives.* 259 260- *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").* 261 262### *Example Task Scenario* Overview 263 264*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.* 265 266*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.* 267 268*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.* 269 270### Development Process 271 272***[Key Writing Points]*** 273 274- *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.* 275 276- *Provide flowcharts and tables if necessary.* 277 278 279### Available APIs 280 281***[Writing Requirements]*** 282 283- *Optional. Describe the key APIs in the development steps and provide the API introduction, so that developers can have a general understanding of development.* 284 285- *If there are more than 10 APIs, provide the main APIs only.* 286 287- *Ensure that the APIs and their functions of the corresponding version are supported when the document is released.* 288 289***[Example]*** 290 291Certain 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). 292 293**Table 1** APIs for notification enabling 294 295| API | Description | 296| ------------------------------------------------------------ | ---------------- | 297| isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean>): void | Checks whether notification is enabled.| 298| enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void | Sets whether to enable notification. | 299 300 301### How to Develop 302 303***[Writing Requirements]*** 304 305*Mandatory.* 306 307- *Completeness and Correctness* 308 - *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.* 309 - *Ensure that the code snippet provided in the document can be built with the context in DevEco Studio.* 310 - *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.* 311 312- *Clarity* 313 - *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.* 314 - *Clearly provide the APIs (if involved) in steps, as well as their usage description and sample code.* 315 - *Provide development suggestions or precautions for key steps and sample code (comments for sample code).* 316 *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:* 317 - *Branch selection principle. Provide principles or suggestions for selecting branches and parameters.* 318 319 - *Necessary supplementary description. Describe possible special operations, required operation permissions, high efficiency skills, and concise and clear background knowledge.* 320 321 - *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.* 322 323 - *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.* 324 325- *Standardization* 326 - *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.* 327 - *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.* 328 329**[Example (Excerpt)]** 330 3311. Import the required modules. 332 333 ```javascript 334 import formBindingData from '@ohos.application.formBindingData' 335 import formInfo from '@ohos.application.formInfo' 336 import formProvider from '@ohos.application.formProvider' 337 ``` 338 3392. Implement the lifecycle callbacks of **LifecycleForm**. 340 341 ```javascript 342 export default { 343 onCreate(want) { 344 console.log('FormAbility onCreate'); 345 // Persistently store widget information for subsequent use, such as widget instance retrieval or update. 346 let obj = { 347 "title": "titleOnCreate", 348 "detail": "detailOnCreate" 349 }; 350 let formData = formBindingData.createFormBindingData(obj); 351 return formData; 352 }, 353 onCastToNormal(formId) { 354 // Called when the widget host converts the temporary widget into a normal one. The widget provider should do something to respond to the conversion. 355 console.log('FormAbility onCastToNormal'); 356 }, 357 } 358 ``` 359 360 361### Verification 362 363***[Writing Requirements]*** 364 365- *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."* 366 367- *Provide only the final service commissioning. You are advised to verify the operation result of each subtask after the development is complete.* 368 369 370## FAQs 371 372*Optional.* 373 374***[Developers' Concerns]*** 375 376*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?* 377 378***[Key Writing Points]*** 379 380*Describe the problems that may occur during the development and the solutions to them.* 381 382- *Delete this section if there are no common problems.* 383 384- *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.* 385 386 387 388### 1. XX problem (simple problem) 389 390XXX 391 392 393### 2. XX problem (complex problem) 394 395**Symptom** 396 397XXX 398 399**Possible Causes** 400 401XXX 402 403**Solution** 404 405XXX 406