<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://socialledge.com/sjsu/index.php?action=history&amp;feed=atom&amp;title=Coding_Standards</id>
		<title>Coding Standards - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://socialledge.com/sjsu/index.php?action=history&amp;feed=atom&amp;title=Coding_Standards"/>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Coding_Standards&amp;action=history"/>
		<updated>2026-04-04T22:36:11Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.27.1</generator>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Coding_Standards&amp;diff=120&amp;oldid=prev</id>
		<title>Preet at 14:38, 6 May 2012</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Coding_Standards&amp;diff=120&amp;oldid=prev"/>
				<updated>2012-05-06T14:38:59Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;#  Do not use magic numbers.&lt;br /&gt;
#:  Instead of: &amp;lt;code&amp;gt;sendSpi(12)&amp;lt;/code&amp;gt;&lt;br /&gt;
#:  Use: &amp;lt;code&amp;gt;int readOpCode=12;  sendSpi(readOpCode); &amp;lt;/code&amp;gt;&lt;br /&gt;
#:  Leave it to the compiler to optimize&lt;br /&gt;
#:  Make case statements descriptive; don't use hex value&lt;br /&gt;
#:* For instance, create an enumeration: &amp;lt;code&amp;gt;typedef enum {moveForward = 0x80}myStateType; &amp;lt;/code&amp;gt;&lt;br /&gt;
#:* Instead of &amp;lt;code&amp;gt; case 0x80: &amp;lt;/code&amp;gt;, use &amp;lt;code&amp;gt;case moveForward:&amp;lt;/code&amp;gt;&lt;br /&gt;
#  Do not have a large code section without sub-routines&lt;br /&gt;
#:  Anything longer than viewable screen(monitor) length should be split in functions&lt;br /&gt;
#  Use meaningful variable names&lt;br /&gt;
#:  Do not use i,j,k unless they are '''for''' loop counters&lt;br /&gt;
# Variable names' Standards&lt;br /&gt;
#: Global Variables should be ALL_CAPS (Use underscore to separate a word)&lt;br /&gt;
#: Class variables should be preceded with an m: ie: mMyClassVar&lt;br /&gt;
#: Pointers should be preceded with a p: ie: pDataBuffer&lt;br /&gt;
#: C Private variables (only declared in *.c files) should be also preceded with an &amp;quot;m&amp;quot;&lt;br /&gt;
#  Refactor ALL duplicate code&lt;br /&gt;
#*  Any code that needs to be changed in more than 1 place needs to be refactored.&lt;br /&gt;
#*  This is wrong:&lt;br /&gt;
#*: &amp;lt;code&amp;gt;char arr[128]; &amp;lt;br/&amp;gt; for(int i=0; i &amp;lt; 128; i++)&amp;lt;br/&amp;gt; { arr[i] = getchar(); }&amp;lt;/code&amp;gt;&lt;br /&gt;
#*: Here, if you change value of 128, you will need to change it at more than 1 place.&lt;br /&gt;
#*  This is okay:&lt;br /&gt;
#*: &amp;lt;code&amp;gt;const int size = 128; &amp;lt;br/&amp;gt; char arr[size]; &amp;lt;br/&amp;gt; for(int i=0; i &amp;lt; size; i++)&amp;lt;br/&amp;gt; { arr[i] = getchar(); }&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Other Thoughts ===&lt;br /&gt;
#  Test each thought before moving on&lt;br /&gt;
#:  Guarantee functionality before moving on to next task&lt;br /&gt;
#:  Write Unit Tests for each sub-routine.&lt;/div&gt;</summary>
		<author><name>Preet</name></author>	</entry>

	</feed>