I noticed this because naN
looked really weird to my eyes. It's almost always seen as NaN
. So I looked around a bit and found this.
static readonly Rational one = new Rational(1); static readonly Rational zero = new Rational(0); static readonly Rational naN = new Rational(0, 0, true); static readonly Rational positiveInfinity = new Rational(1, 0, true); static readonly Rational negativeInfinity = new Rational(-1, 0, true);
These are all implicitly private
, which explains the camelCasing
, but should they be? These are the kinds of static members that usually get exposed to the outside world, particularly when creating structs. Client code is going to need these.
Never mind. After much digging through the code, I see that you are exposing them to the outside world through getters...
public static Rational PositiveInfinity { get { return positiveInfinity; } }
public static Rational NaN { get { return naN; } }
public static Rational NegativeInfinity { get { return negativeInfinity; } }
public static Rational Zero { get { return zero; } }
This is overkill in my opinion. The likelihood of ever needing to change the implementation is next to nil so having properties for these doesn't make much sense. It just clutters and confuses the code. Minimally, the public getters need to be declared much much closer to the private fields.
I noticed this because naN
looked really weird to my eyes. It's almost always seen as NaN
. So I looked around a bit and found this.
static readonly Rational one = new Rational(1); static readonly Rational zero = new Rational(0); static readonly Rational naN = new Rational(0, 0, true); static readonly Rational positiveInfinity = new Rational(1, 0, true); static readonly Rational negativeInfinity = new Rational(-1, 0, true);
These are all implicitly private
, which explains the camelCasing
, but should they be? These are the kinds of static members that usually get exposed to the outside world, particularly when creating structs. Client code is going to need these.
Never mind. After much digging through the code, I see that you are exposing them to the outside world through getters...
public static Rational PositiveInfinity { get { return positiveInfinity; } }
public static Rational NaN { get { return naN; } }
public static Rational NegativeInfinity { get { return negativeInfinity; } }
public static Rational Zero { get { return zero; } }
This is overkill in my opinion. The likelihood of ever needing to change the implementation is next to nil so having properties for these doesn't make much sense. It just clutters and confuses the code. Minimally, the public getters need to be declared much much closer to the private fields.
I noticed this because naN
looked really weird to my eyes. It's almost always seen as NaN
. So I looked around a bit and found this.
static readonly Rational one = new Rational(1); static readonly Rational zero = new Rational(0); static readonly Rational naN = new Rational(0, 0, true); static readonly Rational positiveInfinity = new Rational(1, 0, true); static readonly Rational negativeInfinity = new Rational(-1, 0, true);
These are all implicitly private
, which explains the camelCasing
, but should they be? These are the kinds of static members that usually get exposed to the outside world, particularly when creating structs. Client code is going to need these.
Never mind. After much digging through the code, I see that you are exposing them to the outside world through getters...
public static Rational PositiveInfinity { get { return positiveInfinity; } } public static Rational NaN { get { return naN; } } public static Rational NegativeInfinity { get { return negativeInfinity; } } public static Rational Zero { get { return zero; } }
This is overkill in my opinion. The likelihood of ever needing to change the implementation is next to nil so having properties for these doesn't make much sense. It just clutters and confuses the code. Minimally, the public getters need to be declared much much closer to the private fields.
I noticed this because naN
looked really weird to my eyes. It's almost always seen as NaN
. So I looked around a bit and found this.
static readonly Rational one = new Rational(1); static readonly Rational zero = new Rational(0); static readonly Rational naN = new Rational(0, 0, true); static readonly Rational positiveInfinity = new Rational(1, 0, true); static readonly Rational negativeInfinity = new Rational(-1, 0, true);
These are all implicitly private
, which explains the camelCasing
, but should they be? These are the kinds of static members that usually get exposed to the outside world, particularly when creating structs. Client code is going to need these.
Never mind. After much digging through the code, I see that you are exposing them to the outside world through getters...
public static Rational PositiveInfinity { get { return positiveInfinity; } }
public static Rational NaN { get { return naN; } }
public static Rational NegativeInfinity { get { return negativeInfinity; } }
public static Rational Zero { get { return zero; } }
This is overkill in my opinion. The likelihood of ever needing to change the implementation is next to nil so having properties for these doesn't make much sense. It just clutters and confuses the code. Minimally, the public getters need to be declared much much closer to the private fields.