User Tools

Site Tools


crpl:styleguide

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
crpl:styleguide [2015/03/28 22:54] – added stuff warrencrpl:styleguide [2025/02/14 14:57] (current) – external edit 127.0.0.1
Line 263: Line 263:
 #6 Read code with a fixed width font. This ensures that what you see is common across different machines and contexts. If you add examples to the wiki, surround with %%<code> <\code>%% and the example will automatically be displayed in fixed width. Monospace, mono, and console are common words associated with fixed width fonts. #6 Read code with a fixed width font. This ensures that what you see is common across different machines and contexts. If you add examples to the wiki, surround with %%<code> <\code>%% and the example will automatically be displayed in fixed width. Monospace, mono, and console are common words associated with fixed width fonts.
  
-#7 Any paragraph or line or even subsection that occurs more than once might make a good function. Go through your code and look for patterns and repetition at various scales. If you spot two very similar paragraphs think about how they would need to change to become identical. If it is simple, consider making a new function. The more often it occurs, the cleaner function extraction will make the code.+#7 Any paragraph or line or even subsection of a line that occurs more than once might make a good function. Go through your code and look for patterns and repetition at various scales. If you spot two very similar paragraphs think about how they would need to change to become identical. If it is simple, consider making a new function. The more often it occurs, the cleaner function extraction will make the code.
  
 #8 Precalculate stuff. Go through your code looking for patterns or repetition at various scales. If you calculate the same number twice, consider calculating it earlier, and putting it in a variable. In addition, if you pull a calculation out of a loop, the code usually becomes faster. #8 Precalculate stuff. Go through your code looking for patterns or repetition at various scales. If you calculate the same number twice, consider calculating it earlier, and putting it in a variable. In addition, if you pull a calculation out of a loop, the code usually becomes faster.
crpl/styleguide.1427583291.txt.gz · Last modified: 2025/02/14 14:56 (external edit)