??? 08/20/05 14:16 Read: times |
#99731 - Coding Bible Responding to: ???'s previous message |
My coding bible is 'Code Complete' - it covers this issue and more. There's also another book in the series called 'Writing Solid Code'. The second book concentrates on the use 'and abuse' of 'c'.
http://www.microsoft.com/MSPress/books/28.asp http://search.barnesandnoble.com/booksearc...5514&itm=3 I tend to follow the requirements of MISRA C. This document can be purchased from www.misra.org.uk for 10pounds. A program called DAC (design assistant for C)www.ristancase.com performs compliance checks on your code and does software metrics to give an indication as to how 'complex' your code is. Metrics such as 'cyclomatic complexity' give indicators as to how maintainable the code is. There are also many other programs that do 'static' code checks to give you numbers that relate to the maintainability of code. By following all the above, one would expect that the code is of commercial quality produced using 'best practice'. All in all, simple code is normally the 'best' code. In 'Code Complete' the author maintains if you need to read the 'c' manual to figure out the precedence of the operators then your code is too hard to read. Use brackets to show what you want to do explicitly. Just the other day I downloaded some code that had some extra stuff in the For(). Whilst legal 'c', I had to grab the 'c' book to figure out exactly what the programmer wanted to do. Was this good coding practice? Or was my 'c' knowlege not good enough? |