phetsims / neuron

"Neuron" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
1 stars 3 forks source link

JSDoc should include types and descriptions in @param annotations #14

Closed samreid closed 8 years ago

samreid commented 9 years ago

The JSDoc is valuable to indicate the purpose and intended usage of each function. Some of the functions and constructors in neuron are missing type annotations and description of the function/constructor and the parameters. For instance, in ZoomControl.js the constructor is declared as such:

  /**
   * @param  neuronModel
   * @param  zoomProperty
   * @param  minZoom
   * @param  maxZoom
   * @constructor
   */

  function ZoomControl( neuronModel, zoomProperty, minZoom, maxZoom ) {

Please add the parameter types and a description for each. I'll fix this case shortly as a demonstration, but if there are other cases in the code that need improved JSDoc, they should be addressed. Discovered during #1.

samreid commented 9 years ago

I fixed the example case above. Here is the new JSDoc:

  /**
   * @param {NeuronModel} neuronModel - the main model for the simulation
   * @param {Property.<number>} zoomProperty - property that indicates how far zoomed in the simulation is, between
   *                                         - minZoom and maxZoom
   * @param {number} minZoom - the furthest out the sim can be zoomed (1)
   * @param {number} maxZoom - the furthest in the sim can be zoomed
   * @constructor
   */
  function ZoomControl( neuronModel, zoomProperty, minZoom, maxZoom ) {

Reassigning to @AshrafSharf to handle other cases, if any.

AshrafSharf commented 9 years ago

Added jsDoc annotations for missed classes

samreid commented 9 years ago

Thanks for adding this documentation, @AshrafSharf, it is looking much better. I am still seeing several places where method parameter types are not annotated. For example:

AxonMembrane.js

      /**
       * Evaluate the curve in order to locate a point given a distance along the curve.  This uses the DeCasteljau
       * algorithm.
       *
       * @param curve - The Curve Shape that is being evaluated.
       * @param t - proportional distance along the curve from the first control point, must be from 0 to 1.
       * @return point corresponding to the location of the curve at the specified distance.
       *
       * This method was converted from static to instance to prevent circular dependency between Traveling
       * Potential and AxonMembrane (Ashraf)
       */

DelayBuffer.js

  DelayBuffer.prototype = {

    addValue: function( value, deltaTime ) {

And there are a few other places with missing @param type annotations. Can you take a look?

jbphet commented 8 years ago

Done on master and on the 1.0 branch, closing.