Standards mentioned here may be ones you use already, but they are mentioned here because they are more important for a group project of this size. Come talk to me if you dispute any of the standards.
In general, the cs32 coding standards may be considered for anything not mentioned here.
// Get the function node identified by the name passed. Node* getFuncNode(string name);Though it gives some indication of what is going on, it leaves some unanswered questions. What happens if you name a function that doesn't exist, or encounter some other error? Who is responsible for managing the memory of the pointer returned? Try to leave no doubt on questions like these.
// Get the named function node, or return NULL if it doesn't exist. // Do not deallocate the pointer returned; it is managed by this class. Node* getFuncNode(string name);Group comments if possible. It's a waste of everyone's time to say the same thing repeatedly:
// Get a function node, or return NULL if it doesn't exist. // Do not deallocate the pointer returned; it is managed by this class. Node* getFuncNode(string name); // Get a variable node or return NULL if it doesn't exist. // Do not deallocate the pointer returned; it is managed by this class. Node* getVarNode(string name); ...Where possible, make a statement about an entire class, or about a set of methods in the class. Avoid redundancy, but also add short clarification where needed.
// These accessors get the type of node that corresponds to the method name. // if an error occurs, NULL is returned. // Do not deallocate the pointer returned; it is managed by this class. Node* getFuncNode(string name); Node* getVarNode(string name); // variable Node* getNumNode(int num); ...Put logical spacing between functions.
Avoid useless comments. They just waste time!
string getName(); // get the name
Put comments every so often (e.g. every few lines) mentioning what your code is trying to do. Such comments should be denser for more complicated code, and less dense for obvious code.
Comment as you go.
Put logical spacing between sections of code.
Use assertions often. It is also helpful to comment assertions, in case they fail for someone else.
// if this fails, it means i was passed a function node without initializing // it in the function library first. assert(func_node->getNumArgs() != -1);
main.C - for filenames containing a main, use all lowercase, e.g. foo.C is a test program.
FAnimator.H - external headers should be prepended by only the project abbreviation.
FAInterpreter.H - internal headers/C files should have project and module abbreviations, generally with a file for each class. For many small subclasses of one superclass, it is reasonable to put them all in the same H/C file.
libtfanimator.so - shared objects should be named according to the directory that you are working out of, and prefixed with "libtf". So, if you are working out of src/flarp, your shared object should be named libtfflarp.so. This is done to avoid conflicts with any system shared objects.
FAnimator - top level module interface FAInterpreter - class that is part of a module member_ - I don't care if you put your underscores before or after. myMethod() F_GLOBAL_CONSTANT F_global_varWith one addition: FNodeList - STL typedefs should indicate what they contain, and should end in the name of the STL structure that they use.
Keep all lines safely under 80 columns. I think 70 is a safe number for line-length.