From: Nicholas M. <n.m...@gm...> - 2012-09-05 14:10:02
|
Hello, I am thinking of writing a small package for directional statistics in Octave. These are the statistics of angles and vectors/directions. My question is, can anyone point me to an example of a well-written package that could serve as a good template? The questions I have are about best practices (see questions below). I've read the "Contributing Code" guide and the GNU Octave core coding guidelines, but my questions are: (a) Do users prefer function inputs with the (..."keyword", value) style, or the traditional ordered list of values? (b) Should all functions validate user-supplied inputs? For example, if two vectors need to be the same length, should the package code check that, or just try adding them and let the user see the Octave error? (c) In the cases of other errors, e.g. a function can't find a minimum value it needs, should the function print an error message with printf() or error(), throw exceptions, or do something else? (d) For functions that generate plots, is there an example of a function that does this well? My question, how much should a package alter "look and feel" parameters like titles, axis labels, minor ticks, pointsize, etc.? Should I try to let users pass plot arguments through my function, or let them modify plots later? The reason I'm asking my question this way is that pointing to a package and saying "This is an example of best practices" might be a quicker response that discussing the four questions above. Thanks and I'm looking forward to contributing! Nick Musolino |