Giter Site home page Giter Site logo

c-guntur / paneer-tikka-masala Goto Github PK

View Code? Open in Web Editor NEW
24.0 2.0 6.0 1.5 MB

A Code Kata using a cooking recipe to make an Indian curry, Paneer Tikka Masala (grilled and marinated cottage cheese in a tomato and cream gravy).

License: MIT License

Java 100.00%
codekata completablefuture completablefuture-api java15

paneer-tikka-masala's Introduction

Java CompletableFuture : A Cooking Recipe Kata

badge
Figure 1. build
Duke with Paneer Tikka Masala

java.util.concurrent.CompletableFuture is a versatile utility in Java (since Java 8). It provides a means of task execution, both synchronous and asynchronous.

A CompletableFuture implements java.util.concurrent.Future (available since Java 5) and java.util.concurrent.CompletionStage (available since Java 8) and adds additional methods for operating on tasks.

Some additional documentation about the three in this kata:

What is a Code-Kata

A code-kata is a coding exercise that builds muscle memory by a practice of programming to arrive at a known solution.

How does one go about with this code kata?

The essence of the exercise (presentation material and code kata) is to demonstrate the usage patterns for CompletableFuture.

This set of code katas rely on fixing broken code. There may be multiple ways to solve the broken code, the intent is to learn and experiment. There is a driving main class and there are recipe parts, which need to be fixed.

The project contains several java classes that fail to cook our recipe. A recipe mindmap to prepare Paneer Tikka Masala is included below.

Recipe

Here are simple steps to use this kata

  1. Checkout the code from a terminal/command prompt.

  2. Setup the project in your IDE.

    • IntelliJ: Launch your IDE and point to the pom.xml to be opened as a project.

    • Eclipse: Import Existing Maven Projects.

    • Netbeans: Open Project, then run mvn verify.

    • Any other IDE: Ensure that the src/main/java, src/kata/java and src/solution/java are on the source path.

  3. Run the main class PaneerTikkaMasala.

  4. None of the cooking recipe parts will print out on your console.

  5. Fix the broken/empty sections of code using the TODO and HINT comments.

  6. Repeat above steps until all recipe parts are printed.

  7. Check the solutions to see if there are other ways to solve. (Remember, the solution may be less performant than yours)

  8. Rinse and repeat (delete and checkout again, then back to Step 1) to build muscle memory.

Order of solving

Start in the following oder to fix the broken code or add code where empty. Follow the TODOs and HINTs. Your IDE should list out all TODOs.

  1. Part1CheckIngredients - Checks for the ingredients for the recipe.

  2. Part2aMakePaneerTikka - How to make the Paneer Tikka (cottage cheese roast).

  3. Part2bMakeMasala - How to make the Masala (pureed/spiced gravy).

  4. Part3Cooking - How to cook the Paneer Tikka and the Masala, then garnish.

  5. PaneerTikkaMasala - Plays the role of a chef and orchestrates the entire cooking.

Mission

Your mission, should you choose to accept it, will be to fix the recipe. This message will self-destruct in* NaN minutes

Requirements

How to prepare for coding along

This kata is developed as a Java maven project. Ensure that you have:

  1. Apache Maven 3.6.x or above. Tested with Apache Maven 3.6.3. Link: https://maven.apache.org/download.cgi

  2. JDK 11 or above. Tested with OpenJDK 15. Link: http://jdk.java.net/15/

  3. Your favorite Java IDE. IntelliJ IDEA Ultimate was used to develop this kata.

Project Structure

|____IDE                    <----- Contains Run Configurations and Live Templates for IntelliJ
|____pom.xml                <----- The POM for running maven commands
|____README.adoc            <----- This file
|____assets                 <----- Images and docs linked above
|____src
| |____main
| | |____resources
| | |____java
| | | |____none
| | | | |____cgutils
| | | | | |____recipe
| | | | | | |____paneer
| | | | | | | |____tikka    <----- Common classes shared by Kata and Solution portions
| |____kata
| | |____java
| | | |____none
| | | | |____cgutils
| | | | | |____recipe
| | | | | | |____paneer
| | | | | | | |____tikka    <----- The broken recipe code, that needs to be fixed
| |____solution
| | |____java
| | | |____none
| | | | |____cgutils
| | | | | |____recipe
| | | | | | |____paneer
| | | | | | | |____tikka    <----- Solutions
| |____test
| | |____java
| | | |____none
| | | | |____cgutils
| | | | | |____recipe
| | | | | | |____paneer
| | | | | | | |____tikka    <----- Some tests for utilities used in this project

Take Away

The key take-away from this kata is a solid understanding of the Java CompletableFuture API.

paneer-tikka-masala's People

Contributors

c-guntur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.