phetsims / unit-rates

"Unit Rates" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 2 forks source link

Removing functions used for debugging. #188

Closed Denz1994 closed 7 years ago

Denz1994 commented 7 years ago

@pixelzoom Should functions used for debugging and not explicitly called be removed from the published sim or will these functions help with maintenance?

For example : common/model/rate.js

 /**
     * String representation. For debugging and logging only. Do not rely on the format of this!
     * @returns {string}
     * @public
     */
    toString: function() {
      return this.numeratorProperty.value + '/' + this.denominatorProperty.value;
    }
Denz1994 commented 7 years ago

rate.equals() follows the same format

// @public
    equals: function( object ) {
      return ( object instanceof Rate ) &&
             ( object.numeratorProperty.value === this.numeratorProperty.value) &&
             ( object.denominatorProperty.value === this.denominatorProperty.value);
    }
pixelzoom commented 7 years ago

I've used Rate.toString repeatedly to inspect Rate instances in the console. And I feel that it will be useful for future maintenance, so it stays.

I've removed Rate.equals. Was used in some early debugging, but unlikely to be useful in the future.

Btw... In general, toString and equals are common things to implement for types, whether they are used or not, and especially for debugging.

Back to @Denz1994 to verify.

Denz1994 commented 7 years ago

Makes sense. There are no references to Rate.equals. Closing.

Denz1994 commented 7 years ago

159