Inicio » Sin categoría » Tips collection for good quality code development

Tips collection for good quality code development

Introduction

Well, I have lots of sparse links and forgotten books about project development in C. I decided to put here for my own reference and as a recomendation for people asking me (I will «copy and paste from here).

Style guides

A recommended coding standard

OLD content bellow

Most of my students produce horrible code from the point of view of style.

There are lots of diverging style guides for C programming, so a couple of small and coherent ones will be sufficient for my pourpose.

Other (too complex for starters).

Repositories management

For professional developers (and not so professionals), it is a must to use a «repositories» for managing the code and documents of an evolving project.

Actually, I’m using «mercurial» for this pourpose BUT …

My recommendation is to use «GIT».  The reason is: it is distributed, it is very well accepted by the community.

You need a hosting service for your code repository. I recommend to start with «bitbucket» if you want a private repository, but if your project is clearly open, you can use «github» or «gitorius».

Industry standards

C language is prone to errors but it is the only option for developing embedded systems. In order to reduce the amount of typical coding errors, it is a good idea to use some of the well stablished industry standards that try to minimise these errors.

The recommendation is to elect one of these (I suggest MISRA ):

  • Guidelines for the Use of the C Language in Critical Systems (MISRA C: 2012); Motor Industry Software Reliability Association,2013. MISRA site
  • The CERT C Coding Standard: 98 Rules for Developing Safe, Reliable and Secure Systems; Robert C. Seacord, 2014. Cert C official site
  • Embedded C Coding Standard; Michal Barr, 2008

Bug detection at the developing stage

ASSERT

8 tips for squashing bugs using ASSERT in C

Others

I’m reading

  • Test Driven Development for Embedded C (Pragmatic Programmers); James W. Grenning, 2011

To be considered

  • Linux for embedded and real-time applications; Doug Abbott,2013