wdb:developers:coding_style_guide

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
wdb:developers:coding_style_guide [2008-01-08 12:18:22]
michaeloa created
wdb:developers:coding_style_guide [2008-04-16 11:13:05]
michaeloa
Line 17: Line 17:
  
 The style guide applies to C++ code. The style guide applies to C++ code.
 +
 +
  
  
Line 26: Line 28:
 A name is the result of a long deep thought process about context of the entity. Only a programmer who understands the system as a whole can create a name that "fits" with the system. If the name is appropriate everything fits together naturally, relationships are clear, meaning is derivable, and reasoning from common human expectations works as expected. A name is the result of a long deep thought process about context of the entity. Only a programmer who understands the system as a whole can create a name that "fits" with the system. If the name is appropriate everything fits together naturally, relationships are clear, meaning is derivable, and reasoning from common human expectations works as expected.
 If you find all your names could be Thing and DoIt then you should probably revisit your design. If you find all your names could be Thing and DoIt then you should probably revisit your design.
 +
 +Philosophy aside, there is a very simple reason to have naming conventions. Having naming conventions saves time; it means that you don't constantly have to look up the source to verify whether MyClass or MyFile are spelled with a large or small 'M'.
  
 ==== Class Names ==== ==== Class Names ====
Line 170: Line 174:
 }; };
 </code> </code>
 +
  
 ==== C++ File Names and Extensions ==== ==== C++ File Names and Extensions ====
  
 In short, use lowerCamelCase for file names. Use the ''.h'' extension for all C/C++ header files, ''.c'' for C source files and ''.cpp'' for C++ source files. In short, use lowerCamelCase for file names. Use the ''.h'' extension for all C/C++ header files, ''.c'' for C source files and ''.cpp'' for C++ source files.
 +
 +Filenames should be identical with the class names they implement.
  
 ===== Code Documentation ===== ===== Code Documentation =====
  • wdb/developers/coding_style_guide.txt
  • Last modified: 2022-05-31 09:29:32
  • (external edit)