You are on page 1of 3

Trade 16: World Skills Coding

Standard Embedded Systems

September 2016 Rev 1.0


Background

This standard has been created to help WorldSkills Competitors write embedded
systems software that follow global best practices. It also serves as a guide to judges
when evaluating software quality.

Guiding Principles

The key principle that all programming best practices strive to address is that of clarity.
Code should be clear, easy-to-read and understand. This results in code that is
maintainable by others over the life of an embedded product. Within this context, the
following guidelines should be followed.
Indenting and White Space
Indented code makes is easy to identify key groups of code. Add blank lines to separate
sections of code. Be consistent in your use of indenting and blank lines. Functions
should be separated by two lines, otherwise one line should be used to separate
sections within a function.

Comments
Comments add meaning to code and do not simply paraphrase the code. Comment
blocks should be placed at the beginning of all functions.

Meaningful Names
Names of variables and functions should describe the variable or function accurately.
Naming conventions should be consistently used. Count variables that are indices to
arrays can use the single letters x, y etc. Do not create local and global variables that
have the same name.

Datatypes
Use the C99 datatypes for integers for better program portability. i.e.: Use int8_t,
uint8_t, int16_t, uint16_t, etc.

Constants
Constants are written in UPPERCASE letters.

Declaring constants using STATIC CONST is preferred in order to take advantage of type
checking and to minimize errors that can occur when mathematical operators are
combined with #defines

No Magic Numbers
The calculation used to calculate values should be included in code whenever possible.

Floating Point Numbers


Floating point numbers should have a leading 0 applied to them to improve readability.
i.e.: 0.2 is preferred over .2.

Consistent Use of Braces


Do not mix brace styles. Use one consistently throughout your program.

You might also like