Skip to content

Latest commit

 

History

History

deck-of-cards-kata

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

What is the Deck of Cards Code Kata?

The Deck of Cards Kata is an advanced kata which can help developers become familiar with multiple Java Collections Frameworks and multiple programming languages. The Kata is based on the Collections.compare(JDK; Apache; Eclipse; Guava...) talk from the Devoxx US 2017 conference.

The domain for the kata is Deck of Playing Cards. There are three classes that are shared by all of the exercises. These are Rank, Suit and Card.

Diagram

There are two sets of implementations for the DeckOfCards with stubs provided for each of the Java Collections frameworks. The implementations that can be worked on are building a DeckOfCards using an ImmutableSortedList or using an ImmutableSortedSet.

Six Java Collections frameworks are currently available to learn in the kata. They are:

There are two classes which are fully implemented and which have passing tests. They are:

The JDK imperative deck of cards is used as the control subject in the tests for each of the other frameworks. There are TODOs in each class that must be completed in order for a test to pass.

How to get started

  • Refactor the imperative code in Card that calculates the cartesian product of Rank and Suit.
    • Replace the code with Java Streams - Look to use flatMap and map.
  • Choose whether you could like to solve the kata using an ImmutableSortedList or an ImmutableSortedSet.
  • Choose the framework(s) you would like to complete the kata with.
  • Fix the failing tests for each framework.
  • Follow the TODOs and hints in each of the frameworks DeckOfCards domain class and test.
  • Repeat as necessary.