syque.com

The Psychology of Quality and More

| Menu | Books | Share | Search | Settings |

C Style: Standards and Guidelines (contents)

The story of the book

I wrote this book some years ago in frustration at the 'write-only' code written with other programmers, many of whom were friends and with whom I often had spirited arguments about what made 'good code'.

Electronic beginnings

I was originally an electronic engineer who had come into 'big boys' software via writing assembler code, where it's 'you and the hardware' and your first task is to write the operating system. When you build an electronic circuit, doing it wrong can easily lead to the whole thing going bang when you power it up for the first time, leading to a long, tedious and often expensive 'bug-finding' expedition. Assembler code, likewise, is very detailed and disciplined care is needed. The approach to hardware-firmware design was thus highly disciplined and included significant review before starting the system.

The legacy of prototyping

With this background, I was shocked at the prototyping approach to higher-level software -- bash it out, trying it out, fix the bugs and increment forward. The result was whizzy programs that were quick to get off the ground and largely worked, but for those folks who came after to extend and maintain the code, it was a nightmare. In assembler code you add comment to almost every line. In the code I was working with, comments were often absent and somewhat cryptic at best.

To be fair, I also worked with elegant code and crystal-clear comment, which only served to make the poor code stand out even more.

Do it better

My 'do it better' drive led me to work in software quality, where the first thing to develop was a set of coding standards. Doing this directly led to writing a book about it. Books about the subject, written by people like Plum and Ledgard, gave sage advice but did not argue the reasons for that advice. I joined the comp.lang.c usenet chat (very early, text-based internet) and learned more, both about style and also about how people thought about it. Through more argument and concern, the histories and rationale became clearer.

Writing the book

I had not written before and didn't think I could write, and took about three years to pluck up courage to put pen to paper. I was surprised that when I sent sample chapters to four publishers, three replied with interest and I was lucky enough to be able to go with Prentice-Hall, who published the original 'bible' by Kernighan and Ritchie.

And it worked! The book sold well and was used by a number of universities. I did not make lots of money from it, but it is nice to be recognized outside of your immediate sphere. It even got translated into Japanese, which was kind of fun.

Webifying the book

Even now, I get occasional emails. The latest was from Colin Sheppard (see his IT blog and the HCMS blog), with whom I coincidentally crossed paths when we both worked for Agilent Technologies a few years ago. He urged me to put it out on the web and so here it is. So thanks to Colin, from everyone who finds it and finds it useful.

C is perhaps not as popular as its descendants these days, but the book is more than about C. It is first about programming style and writing code that others can read and understand (including yourself, at a later date). It looks at programming from a psychological viewpoint and carefully considers naming, layout and other factors that affect how understandable the final program is for its readers.

In turning a book into web, there is a question of division, of how to decide what to put on one page. One approach is to use a physical size, just like a paper book. The original book was divided into numbered sections, so I thought this a better approach. It does mean, however, that some pages are rather short and some rather long. Not everyone will be happy with this, perhaps, but it is intended to make it easier to reference and use.

After the book

After writing the book, I got more into quality and more into business. Working Hewlett Packard for many years was a wonderful education and I traveled the world learning from the early masters. Now, I am a business consultant with a reach from technology to psychology, mostly working in business change. I wrote five more books and still write, but direct to the web now (see the extent of the Syque sites).

So enjoy. I do hope you find value in this book now and that it leads to clearer programs that you and others find easier to read and use.

 

Best regards

 

Dave

 

Site Menu

| Home | Top | Settings |

Quality: | Quality Toolbook | Tools of the Trade | Improvement Encyclopedia | Quality Articles | Being Creative | Being Persuasive |

And: | C Style (Book) | Stories | Articles | Bookstore | My Photos | About | Contact |

Settings: | Computer layout | Mobile layout | Small font | Medium font | Large font | Translate |

 

You can buy books here

More Kindle books:

And the big
paperback book


Look inside

 

Please help and share:

 

| Home | Top | Menu |

© Changing Works 2002-2015
Massive Content -- Maximum Speed