Coding Conventions Flashcards
explains itself without need for external documentation, like flowcharts, UML diagrams, process flow diagrams, etc.
Self documenting
Coding conventions target:
How you write statements in the language, organize them into modules, format them in the source files
reuse as much legacy code as possible
true
The project needs to progress as fast as possible
true
You have a team working on a project that will extend over a moderately long period of time. Over the course of the project, people will come and go.
Motivation
Style of Working
- read many modules, and edit many.
- They will “factor out” duplicate code
- few modules will be able to be said to have an author
It’s easier to integrate modules that use a common consistent naming
standard
true
Comments, 3 types:
– File headers
– Function headers
– Explanations of variables and statements
Statements:
– Organization: files, “modules,” nesting
– Format: spacing and alignment
Divide each module into a public part and a private part.
- public part goes into an include (.h) file
– private part goes into a source (.c) file
Comments provide _____ information about the program
meta
Commenting _______ is an especially good thing to do.
interfaces
don’t need to be commented heavily if their interfaces are well documented.
Implementations
Use simple, descriptive variable names.
true
how many levels is enough for major nesting?
3 levels