Instead, that should be left to comments interspersed in the function's code.Įvery function should mention what the inputs and outputs are, unless it meets General, these comments do not describe how the function performs its task. These comments should beĭescriptive ("Opens the file") rather than imperative ("Open the file") theĬomment describes the function, it does not tell the function what to do. sectarianizes: sectarianises neutralization: neutralisationĮvery function declaration should have comments immediately preceding it thatĭescribe what the function does and how to use it. # It contains words with general spelling variation patterns: # led/lled, ize/ise, or/our, er/re, plus # and these extras: # learned/learnt, practices/practises, airplane/aeroplane. # This list is made with # lib/tasks/list_american_to_british_spelling_variants.rake. # List of American-to-British spelling variants. File/class-level commentsĮvery class definition should have an accompanying comment that describes whatĪ file that contains zero classes or more than one class should have a comment Portions of this section borrow heavily from the GoogleĬ++ and Python style guides. When writing your comments, write for your audience: the next contributor who Than using obscure names that you must then explain through comments. Giving sensible names to types and variables is much better Remember: while comments are very important, the best code is The following rules describe what you should comment and where. Though a pain to write, comments are absolutely vital to keeping our code You have a reason not to, keep lines to fewer than 100 characters. Keep each line of code to a readable length.add ( car ) car endĮnd each file with a newline. Def transformorize_car car = manufacture ( options ) t = transformer ( robot, disguise ) car.
0 Comments
Leave a Reply. |