English (United Kingdom)French (Fr)
Resources Programming rules What is a programming rule?

Poll of the month

Have you measured your software projects statistics?
 
What is a programming rule?
Resources

What is a programming rule?

A programming rule is the description of a set of constraints to respect when writing software code. There are several types of programming rules:
  • naming rules: they define the way identifiers are used in an application to make the code easier to read and help to detect errors.
    Example: all constant names must be in UPPERCASE.
  • portability rules: they identify language constructs in the code that can induce a different behavior depending on the operating system or the microprocessor being used.
    Example: two floating numbers shouldn't be compared using strict equality.
  • rules that protect from language difficulties.
    Example for the C language: do not mix up the "=" used for affecting a value and the "==" used to compare.
  • presentation rules that make the code easier to read.
    Example: write a single instruction per line.
  • rules that make application maintenance easier.
    Example: when writing code in C, C++ or Java, use opening and closing braces in the if and then blocs of a test.
  • rules that limit code complexity.
    Example: limit the complexity of expressions to 4 operators at the most.
  • rules that allow better code structure.
    Example: declare shared variables in a header file.

Checking programming rules

Checking a set of programming rules is usually done during a source code audit. It can either be done manually by reading the source code, or automatized using a tool that points out rule violations.
Logiscope allows to check programming rules for C, C++, ADA and Java languages.

Standard programming rules

  • MISRA C: a set of rules initially conceived for the automobile industry and now widely used.
  • MISRA C++: a version of the MISRA C rules adapted to the C++ language
  • Scott Meyers rules: these rules are described in the following books:
    • "Effective C++: 50 Specific Ways to Improve Your Programs and Designs" (Addison-Wesley, second dition, 1997, ISBN: 0-201-92488-9)
    • "More Effective C++: 35 New Ways To Improve Your Programs And Designs" (Addison-Wesley, first edition, 1996, ISBN: 0-201-63371-X).
 

Actualités

Prochain séminaire gratuit le 23 septembre à Paris

"En route vers le niveau 2 du CMMI !" 

Consulter le programme de la matinée

S'inscrire


Autour d'un petit déjeuner convivial, nos consultants vous aideront à repositionner les objectifs du niveau 2 du CMMI, avec une présentation des meilleurs outils pour relever ce véritable challenge de l'industrialisation des processus support du cycle de vie des logiciels :

  • gestion des exigences : Doors, RequisitePro, …
  • gestion de configuration : Team Concert, ClearCase, …
  • assurance et contrôle qualité : Quality Manager, Logiscope, ...
  • mesure et analyse : SQuORE, …
N'hésitez plus ! Venez prendre la route vers le niveau 2 du CMMI ... en vous inscrivant dès aujourd'hui  pour nous rejoindre le 23 septembre à la Cité Internationale Universitaire de Paris.

Kalimetrix IBM Business Partner

In june, 2009, Kalimetrix became ISV (Independant Software Vendor), approved by IBM to sell the Rational product line for software development.