gandalfcode / gandalf

GANDALF (Graphical Astrophysics code for N-body Dynamics And Lagrangian Fluids)
GNU General Public License v2.0
44 stars 12 forks source link

Better variable names #32

Open dhubber opened 8 years ago

dhubber commented 8 years ago

1) Decide/agree on a consistent usage of common variables (e.g. i/j for particle/neighbour loops, dr, drsqd, etc..) and put them in the documentation for reference. 2) Agree on some system for intermediate variable lengths, that partly describe the variable in a clear way (as in self-documenting code) but without having excessively long variable names (e.g. 'Npart' instead of either 'N' or 'num_of_particles') 3) For variables declared at the top of the function, add short comment describing variable purpose

rbooth200 commented 8 years ago

One option for counter names is something like: iPart, iCell, iNeib instead of i, j, k. Where this results in absurdly long lines in the loops perhaps it is best to shorten them using references? Perhaps the best other option is 'standard practice' for i,j,k,n etc plus a few lines documenting them each time.

The second option might require less work now, but the iPart, iCell type naming would probably be the most readable in the long run, especially considering it would help reduce the amount of documentation to write/maintain