Experts share: Top ten tips for annotating embedded software

There is nothing more challenging in the software development process than obtaining a code base with little or no documentation and requiring maintenance. These documents not only tell the engineer what a particular function or variable does, but also show and communicate why the software is implemented in a particular way. Thousands of decisions are made during the software implementation process, so it is critical that maintenance engineers or even future you retain these decision processes as much as possible.

Part of the problem with the comment code is the fact that shipping pressure, incorrect design, and how the comment code works doesn't develop interesting or exciting! Many engineers (including myself) hate having to annotate the code, but this work is so important in the development of embedded engineers that we can't omit or do it in a double-pronged way. However, there are a few tricks you can keep in mind during the software development process that help ensure that future developers maintain any minor changes in code development.

Tip 1 - Comment at any time, not after

The pressure to deliver the product often leads to a whimsical coding style, and in order to complete the task in order to launch the product as early as possible, the code is where to think. In the process of writing crazy code, it is rare to remember what the code is going to do. After the product is delivered, the designer will go back to the code and "comment". The problem with this is that it has been a few weeks or even months since the code was written! For some engineers, it’s hard to remember what it was for breakfast yesterday, not to mention a piece of code written two weeks ago. The end result is an inaccurate commentary that often leads to misunderstandings and pitfalls in the future.

The trick here is of course to make notes at any time while making decisions. The formal external document annotation process will undoubtedly reduce the developer's progress, but adding comments to the codebase will not take more time. The first thing a developer can do is to write some comment lines about what the code does, and then write the code. Developers can update comments immediately if the implementation changes. In any case, writing down the notes while writing the code will save time and increase the rationality, resulting in fewer errors and faster time to market.

Tip 2 - Automatically generate annotated documents

Despite the very detailed comments on the code, there is always a requirement to generate an external document so that anyone can understand the program without looking at the code. This requirement often leads to double the amount of annotation work. Fortunately, there are ready-made tools on the market that automatically read code comments and then generate additional documentation details for the interface and code! Help engineers avoid having to do the same job twice! An example of a free tool with this feature is Doxygen. When developers write their code, they format their comments in a specified way and provide the details they want to display in an external document. Then they can run Doxygen to generate html, rtf or pdf files that truly reflect the comments in the software. The wonderful thing is that if you update the comments, the external documents will be updated automatically!

Tip 3 - Don't write explicit comments

Although developers write code comments, it is especially irritating if the comments are just duplicates of variables or function names. Comments should be descriptive text, and you need to provide more details than explicit meaning! Provide as much information as possible, and don't forget to mention related and associated variables or functions. Developers should be able to understand the behavior of the software just by reading the comments. Figure 1 shows an example of an annotation simple mapping array code.

Map array

Figure 1: Mapping an array

Tube Lights

1. Features: light emitting LED copper wire torch 360 degrees, pervious to light quality, low power consumption, long service life and low heat advantages such as environmental protection, flexible tubes, are free to bend, winding on the modelling. Products are waterproof, energy saving features.

2. Specifications: transparent pipe;
LED Color: White warm, White, Amber, Red, Green, Yellow, Blue, Multicolor, RGB.
Power Supply: Battery box, Electronic, Transformer.
3. USES: can be used indoor & outdoor, LED copper wire light string not only applied to various festival holiday decoration Christmas lights, also used for household decoration (tubes can be wrapped around the arts and crafts, eaves, the corner...The icing on the cake, the city lighting project and various entertainment venues, all the shopping malls can wait.

Tube Lights

Tube Lights,LED Tube High Light,LED Explosion-Proof Lamp,LED Linear Tube Light

Heshan Jianhao Lighting Industrial Co., Ltd. , https://www.sunclubtw.com

Posted on