Coding standards

View previous topic View next topic Go down

Coding standards

Post  maximinus on Fri Jun 04, 2010 11:29 pm

Based on Pep8:

4 spaces per indentation, use tabs not spaces.
Maximum line length 100 characters.
Variables - a noun, in lower_case_with_underscores
Functions - a verb, in mixedCase (first letter always lowercase)
Class - a noun, in StudlyCaps
Constants - CAPS_WITH_UNDERSCORES
Use docstrings, but keep them short!

Other guidlines:

Keep functions short, and make them do only one thing. More than 30 lines means we probably have a problem.
Make the names of functions and variables easy to understand.
Avoid using None if at all possible.
avatar
maximinus
Admin

Posts : 63
Join date : 2010-06-04
Age : 45
Location : Harbin, China

View user profile

Back to top Go down

Re: Coding standards

Post  maximinus on Wed Jun 23, 2010 10:19 pm

For the main code, I will add unit tests starting this week.

I actually did a cyclomatic complexity check on the current code (SVN r71) and got a "This code looks all good!" result, that made my day! cheers
avatar
maximinus
Admin

Posts : 63
Join date : 2010-06-04
Age : 45
Location : Harbin, China

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum