Giter Club home page Giter Club logo

fraction's People

Contributors

angellaa avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

jbrains

fraction's Issues

Missing test for Fraction equals?

I saw the test checking that 3/4 equals itself when they are the same reference, but I did not see a test checking that 3/4 equals 3/4 when they are not the same reference. I think that the rest of the tests check this behavior indirectly, but I would prefer to write that test explicitly.

Maybe don't test-drive ToString()?

If I use ToString() purely for debugging purposes, then I probably would not test-drive it. It seems Too Simple to Break and the cost of failure is too low to justify the investment.

HOWEVER, if I'm learning to write tests, such as in an unfamiliar language or with unfamiliar tools, then I would happily invest the time and effort in practising writing tests. I would encourage Novices practising TDD to write these tests.

Structural name + abbreviation: MathUtil

I notice that you've named the class MathUtil, which is a structural name ("Util") and an abbreviation (instead of "Utilities"). I would prefer to rename this class. After several iterations, I chose NumberTheory.

Yes, I know that "Util" is a common abbreviation, and I sometimes use common abbreviations, but only when everyone around me insists on it. If I wanted this class to remain named "Something Something Utilities", and if the people around me insisted on calling it SomethingSomethingUtil, I would fight them for maybe 15-30 seconds. I would ask, "Why is Util so much better than Utilities and what's the problem with Utilities?"

For the bigger issue, I prefer to replace the structural name (this object has utility functions related to math) with a more intention-revealing or domain-oriented name (this namespace has behavior related to number theory). That's why I choose NumberTheory (and not NumberTheoryUtilities). I suppose, if Java didn't already have a namespace called Math, I might use the name Math, but I like the more specific name NumberTheory. (I would rename Math to Arithmetic for functions like power() and abs() or to Statistics for min() and max() and average().)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.