angellaa / fraction Goto Github PK
View Code? Open in Web Editor NEW.NET library that implements math fractions (TDD practice).
License: MIT License
.NET library that implements math fractions (TDD practice).
License: MIT License
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.
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.
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()
.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.