Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you ensure that you as programmer have written quality C code?

I m looking to write some quality C code. Can someone point me to some articles , websites..whatever I need something with examples. I have already seen and read K&R C book.

But times have changed, some one must have more to say on quality C Code. and another important thing is How do you ensure that you as programmer have written quality C code??

like image 479
linkedlist Avatar asked Jan 11 '09 12:01

linkedlist


People also ask

How do you write a high-quality C code?

use fairly short, easy to read identifiers for high-use, limited-scope variables. use longer, more descriptive names for less often seen identifiers. use variable names that give an idea of their purpose (see K&R for examples) ensure identifiers are long enough and different enough to be easily distinguished.

What is a high-quality code?

A quality code is one that is clear, simple, well tested, bug-free, refactored, documented, and performant. But the primary measure of high-quality code in compliance with the specification depends on the needs of the company.


1 Answers

Someone mentioned some compiler switches, but having syntactically smooth code is not going to ensure a quality end-product, because there's more to software quality than that.

There are several classifications of software qualities, but here's a list that you can use as a checklist:

  • Correctness (does it work according to spec?)
  • Reliability (can de user depend on it?)
  • Robustness (does it work in unexpected situations?)
  • Performance (does it do the job fast enough for the user?)
  • Usability (is it user-friendly?)
  • Verifiability (can its properties be verfified easily?)
  • Maintainability (can modifications be made easily?)
    • Repairability (can defects be fixed within reasonable time?)
    • Evolvability (can new functionality be added simply?)
  • Reusability (can the code easily be used in other projects?)
  • Portability (can it run easily in different environments?)
  • Understandability (can maintainers easily understand it?)
  • Interoperatability (how well does it cooperate?)
  • Productivity (efficienct and performant delivery)
  • Timeliness (ability to deliver on time)
  • Visibility (are all steps documented clearly?)
like image 197
Wouter van Nifterick Avatar answered Nov 15 '22 21:11

Wouter van Nifterick