Go to Post But when it comes down to it, the best teams usually end up winning regardless. - Cory [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 23-11-2005, 17:30
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 7,019
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Programming Organization

Quote:
Originally Posted by Rickertsen2
Document the code well. Maintain change logs.
Both are excellent ideas, and will save you a ton of grief when things don't work right.

I personally document every line of code, and usually my code has more comments than code. Comments should be sufficient for anyone moderately familiar with code to understand completetly and fully what a line is supposed to be doing.

Cange logs are harder to enforce, but literally writing down every change (was Foo == bar, changed to foo==bar, DAR 11/23/05) with who did it and when can be extraordinarily useful when something that was working suddenly stops. Reviewing it later is also an excellent learning tool, you see how things evolved and learn ways to get there sooner next time. (Note that some CV systems do this for you)

This is how professional programmers are supposed to do it. Sadly, it's not always the case, but projects that do are often more successful. Learn it the right way, the discipline will serve you well for a lifetime.

Don
__________________

I am N2IRZ - What's your callsign?
  #17   Spotlight this post!  
Unread 24-11-2005, 01:51
TimCraig TimCraig is offline
Registered User
AKA: Tim Craig
no team
 
Join Date: Aug 2004
Rookie Year: 2003
Location: San Jose, CA
Posts: 221
TimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to behold
Re: Programming Organization

Quote:
Originally Posted by Dave Scheck
Please not that C compilers are not required to support the double slash style comment.
For a C compiler to be compliant with the ISO/ANSI C99 standard, it must accept the // style comments. These were not in the earlier C89 standard although most mainsteam compilers accepted them as an extension. The problem is the demand for pure C has dropped in favor of C++ and the bulk of users are probably now in the embedded market. So many of the compilers there haven't been updated to be compliant with the new standard, probably to lower sales volumes. Although recognizing the // style comment should be child's play to a compiler writer whom you're going to entrust with optimizing your source into machine code.
  #18   Spotlight this post!  
Unread 24-11-2005, 22:18
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Programming Organization

Everything said so far is good. Here is my list of the important stuff:

Use a standard formatting style. This includes how to position braces ({ and }), spacing between arguments, amount of indent (2 spaces, 4 spaces, or a tab), line overflow, etc. I believe the de facto standard of C is like this:
Code:
// You should use more descriptive names for everything
void AFunctionName(int an_argument, int other_argument)
{
	int retval = DoSomething(other_argument, an_argument + 1);
	int n = 0;
	for (int i = 0; i < retval; i++)
	{
		// So, do something here...
		n = an_argument * i;
	}
}
Use a versioning system. CVS and Subversion are the best (only) free ones I've heard of. Do some googling as to how to use them/set them up. If used appropriately, this can also cover changelogs. (Write a descriptive commit message! I prefer many commits with specific changes to few large commits that can't have a good description.)

Document. I find doxygen works well for API-type documentation (Which functions do what, and what arguments they take). For logic documentation, nothing beats good ol' comments.

Create functions for conceptual reasons. A function should perform a specific task, and that task should be fairly clear from the name. (And having clearly named functions with unambiguous purposes also helps with self-documenting code, if you believe in such a thing.)

I agree entirely with teaching basic OOP concepts, since that includes ideas of abstraction and encapsulation (not to mention a few other things), concepts I consider important to writing clear code that works.

Code reuse. Last year, I used a system much like the autonomous scripting to handle motor control (control loops). This was a great boon for me, because when part of the robot didn't work, I could say, "It's not the code. The same code works on the other joint." (This is greatly undervalued. Definately going to do something similar again.)

Many files are good. You should actually reduce the number of functions in user_routines.c and user_routines_fast.c. Have a file devouted to translating human input, another one for driving, and several for autonomous. (I consider autonomous a 95-10 situation: 95% of your work goes into 10% of the match.)

In 2004 (code) and in 2005, I organized code based on function on the robot. All the hardware interaction went through abstraction macros/functions. This ment higher-level code would do things like:
Code:
 //user_routines.c, line 175
 //Map Joysticks to drive train
 Drive_Joystick(OI_Left, OI_Right);
While code farther in would be doing:
Code:
// Drive.c, line 51
void Drive_Joystick(char Left, char Right)
{
	if(Left > 127)
	{
		Left_CIM = Left_Drill =  (128 + JOYSTICK_SMOOTHING[Left - 127]);
	}
	else
	{
		Left_CIM = Left_Drill = (127 - JOYSTICK_SMOOTHING[127 - Left]);
    }
    
//	Right_CIM = Right_Drill = Right;
   	if(Right > 127)
	{
		Right_CIM = Right_Drill =  (128 + JOYSTICK_SMOOTHING[Right - 127]);
	}
	else
	{
		Right_CIM = Right_Drill = (127 - JOYSTICK_SMOOTHING[127 - Right]);
    }
}
(These same routines were used for autonomous, as well.)
This is a simplistic sample. The Hand_*() functions in Grabber.c (which maybe should have been broken up) are the most complex, due to the current-limiting sensor. BTW, this example is not from the year I used doxygen, so the functions themselves are poorly documented. *_Check() functions compared the input value to the current value and reacted appropriately (except the drive code, which just mapped input to output without feedback).
  #19   Spotlight this post!  
Unread 25-11-2005, 21:39
prograid's Avatar
prograid prograid is offline
Registered User
AKA: Ben Cherian
FRC #0254 (The Cheesy Poofs)
Team Role: Alumni
 
Join Date: Oct 2004
Rookie Year: 2004
Location: San Jose
Posts: 80
prograid will become famous soon enough
Re: Programming Organization

If you are intent upon using Subversion (like someone I know is.) and you want to use Eclipse (which I do) then I would suggest using an Eclipse plug-in called Subclipse. It's made by the same people that make Subversion. It's not as nice as Eclipse's CVS integration but it's more than adequate for FIRST purposes. Also, more information on Eclipse (e.g. installation instructions, setting up a basic project, etc) along with an updated version of my plug-in can be found in this white paper.
The white paper itself is not very useful if you are already familiar with Eclipse, but otherwise it should be helpful.
  #20   Spotlight this post!  
Unread 29-11-2005, 19:29
Timothy D. Ginn's Avatar
Timothy D. Ginn Timothy D. Ginn is offline
I check here maybe once a year.
no team
 
Join Date: Apr 2003
Rookie Year: 2002
Location: Port Perry, ON. Canada
Posts: 247
Timothy D. Ginn is a name known to allTimothy D. Ginn is a name known to allTimothy D. Ginn is a name known to allTimothy D. Ginn is a name known to allTimothy D. Ginn is a name known to allTimothy D. Ginn is a name known to all
Send a message via ICQ to Timothy D. Ginn Send a message via AIM to Timothy D. Ginn Send a message via MSN to Timothy D. Ginn Send a message via Yahoo to Timothy D. Ginn
Re: Programming Organization

Quote:
Originally Posted by coastertux
How would I set up a SVN/Subversion?
A brief description of many free version control system is at http://producingoss.com/html-chunk/vc-systems.html (I just happened to stumble across that by chance when reading something else and figured you or others might be interested).

For how to setup a repository see http://subversion.tigris.org/faq.html#repository (how to make Eclipse use it has already been mentioned).
__________________
Alumni of FRC Team 1006
Former mentor of Full Lego Alchemist (FLL 5621) - Sempar School / Computing Students' Association of Queen's University
  #21   Spotlight this post!  
Unread 29-11-2005, 19:35
coastertux coastertux is offline
Penn State Class of 2010!
AKA: Steve
FRC #1640 (sab-BOT-age)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Downingtown, PA
Posts: 264
coastertux is just really nicecoastertux is just really nicecoastertux is just really nicecoastertux is just really nicecoastertux is just really nice
Send a message via AIM to coastertux
Re: Programming Organization

We are using CVS now as I could not find a free SVN server.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming Vex w/ MPLab dababyjebus FIRST Tech Challenge 27 25-04-2008 09:11
Programming - Getting Started Mark McLeod Programming 80 16-04-2008 23:37
Organizing a programming team. scitobor 617 Programming 7 28-01-2005 19:18
Team 342 Training and Organization cbolin Team Organization 1 15-01-2005 10:37
Robot Programming Education phrontist Programming 11 03-05-2004 07:32


All times are GMT -5. The time now is 21:12.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi