Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
In actual tests,
exceptionHandling()
there are tests that try to augment two matrices of differentField
types. This is definitely not expected.The numerator and denominator of
Q
arelong
which means it'll break after either of them have exceededlong
range.This is happening in the square test, where the input is a matrix with values like
1303471066566290185/3597965028172970961
.(It should be
BigInteger
, notlong
)Testing for methods that return
T
(e.gdeterminant
) does not perform type check on the method signature, while some methods that returnMatrix<T>
does, and some doesn't (e.gadd
andsubtract
). Type checking should be consistently mandated by the tests for all methods.C
is not a proper field because the components aredouble
s, anddouble
s are not fields. They will be affected by floating point errors in arithmetic operations.Matrix
andField
have very different structures: allField
methods return values of typeField
but not the implementing class, whileMatrix
requires returningMatrix<T>
but notMatrix<Field>
. It is unreasonable to requireMatrix
doing whatField
doesn't do, and besides, this makes working with fields unreasonably clunky.The standard workaround for this is to use
public interface Field<T extends Field<T>>
: see https://stackoverflow.com/a/8407944(This will also make
ZERO
andONE
capable of becoming static, which is a good thing.)The description is too long to read effectively, but 70% of the description are about the implementation of
Field
class which are not relevant to the task in the kata itself. It should be wrapped in collapsible sections to reduce the effective size.See: https://gist.github.com/pierrejoubert73/902cc94d79424356a8d20be2b382e1ab
It is unclear whether methods that return a
Matrix<T>
should return a new instance, or modify the original instance and return itself. (The latter is the standard in most early Java types likeDate
,Point
,Rectangle
... It is considered a mistake, but, well, it is what it is.) This should be clarified (and perhaps tested).Similarly, does the operations on
Field
modify and return itself, or do they return a new instance instead?For a kata of this size with this many methods to implement, the required constructor/methods should be added into initial code as stubs (probably with
throw UnsupportedOperationException("TODO: {method name}")
inside the methods so it fails exactly inside the method when invoked). Otherwise it is very difficult to get code that could compile to the sample tests, and no testing are possible until the method are implemented/stubbed.What happens if a 2d array that contains arrays of different lengths are passed in? Will this happen in the tests? If this happens, how should we handle it?
Constructor
andget(int i, int j)
bullet points are missing a proper line break between the method signature and its description.The
ONE
andZERO
methods should probably be static.