nicdom23 / cribbage-assignment Goto Github PK
View Code? Open in Web Editor NEWThis project forked from dario-campagna/cribbage-assignment
Cribbage Score Calculator assignment for the Software Development Method course.
This project forked from dario-campagna/cribbage-assignment
Cribbage Score Calculator assignment for the Software Development Method course.
Test names like this (and fifteen_two_Points3
, parseOneCard1
) are not that helpful. When a test fails, the first thing you see is its name. The more information we get from the name, the better.
The call to Character.compare is redundant and you could use the asChar
method of Suite
(that is unused). The if
condition can be rewritten as refSuite.asChar() == cardAsText.charAt(1)
.
If you implement the equals
(and hashCode
) method for Hand
and Card
classes you can simplify the assertion in this test and in the other two tests.
This class has too many lines of code. One of the reason this class is large is that it mixes two things, computing the points and looking for card combinations. For example, in this class we have both the logic to compute the points for a given number of fifteen-twos, and the logic to determine the how many fifteen-twos there are in a hand.
The methods in this class are not easy to read and understand. Some method names could be more intention revealing. Some methods are a bit too long (due to nested for-loops and if-statement).
Here and in other methods in this class we ask a card to the hand to then get the card rank or suit. These data are then used to search for card combinations in the hand. This smell can give us some idea about how to reduce the lines of code in this class.
You do not need assertAll when in the test you only have one assertion.
Is a test for parsing the complete hand missing?
This class is a good example of the Data Class code smell. It contains only fields and methods for accessing them.
The card Rank is more than just a character. In the getRankInt
method you have the numerical aspect of the rank. In PointCalculator
you have the rank order encoded in a String.
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.