A Tale of Two Katas

Donald Raab
3 min readMar 2, 2018

--

Learn a modern Java Collections Library with more features and less waste.

Demonstrating the Pet Kata at the Eclipse Foundation booth at JavaOne

Have you tried a Code Kata?

It really is the best way to learn a new framework or library. We have two katas for Eclipse Collections hosted on GitHub. They are free hands-on training for what I would describe is the most feature rich and memory friendly Java Collections framework available today.

What is a Code Kata?

From the website.

A kata is an exercise in martial arts. A code kata is an exercise in programming which helps hone your skills through practice and repetition. The Eclipse Collections Kata is a fun way to help you learn idiomatic Eclipse Collections usage. This particular kata is set up as a series of unit tests which fail. Your task is to make them pass, using Eclipse Collections.

We learn best by doing. Try one of the Eclipse Collections Code Katas and learn an amazing framework at your own pace in your IDE with hands-on coding exercises.

The Company Kata

The Company Kata was the first kata developed for Eclipse Collections. It has been used to teach thousands of developers how to use Eclipse Collections over the past ten years. It is a comprehensive set of exercises in the form of unit tests, built around a domain model focused on simple concepts like Company, Supplier, Customer, Order and LineItem.

The Company Kata Domain Diagram from the web based slides

Here are the web based slides that teach the concepts required to complete the Company Kata. The slides can also be read more quickly in convenient markdown format.

The Pet Kata

The Pet Kata was developed three or four years ago in order to create a TL;DR kata for developers who didn’t want to spend eight hours in a class learning the Company Kata or three to four hours completing it on their own. The domain of the Pet Kata is simpler. There are classes for Person, Pet and PetType. A Person can have many Pets and a Pet has one PetType.

The Pet Kata domain diagram from the web based slides

Here are the web based slides that teach the concepts required to complete the Company Kata. The slides can also be read more quickly in convenient markdown format.

Getting started

  1. Clone the repo here— https://github.com/eclipse/eclipse-collections-kata
  2. Import the pom.xml file located in the root as a Maven Project in your favorite IDE
  3. Pick one of the Kata folders (company-kata or pet-kata) and go to the tests directory
  4. Start with Exercise 1
  5. Run the unit tests — They should fail!
  6. Get the tests to pass one by one
  7. When you complete the last exercise— Congratulations!
  8. Repeat as desired or complete the other kata to learn more iteration patterns and hone your skills using Eclipse Collections
  9. Star the repo if you enjoyed the kata

Additional References

  1. Introduction to Eclipse Collections (Baeldung Article)
  2. The Java Evolution of Eclipse Collections (InfoQ Article)
  3. The Eclipse Collections Reference Guide
  4. The API Design of Eclipse Collections — (markdown format)
  5. Conference Talks and Meetups
  6. Eclipse Collections Website — (available in English, Chinese, Japanese, Russian, Brazilian Portuguese, French and German)

Eclipse Collections is open for contributions. If you like the library, you can let us know by starring it on GitHub.

--

--

Donald Raab
Donald Raab

Written by Donald Raab

Java Champion. Creator of the Eclipse Collections OSS Java library (https://github.com/eclipse/eclipse-collections). Inspired by Smalltalk. Opinions are my own.

No responses yet