Skip to content

etorres/online-store-kata-vavr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Online Store Kata

The objective of this kata is to practice with functional programming in Java with vavr and Resilience4j.

You have been hired to develop an application for Acme Corporation. Since they have a large history of unsuccessful projects, you are required to design a robust solution for their main business (online sales of heavily over-engineered products for road runner hunting). As a developer, you are supposed to develop a solution that move the orders from the online store to the site of the company. Orders can have duplicate items that you should remove before recording a file in the ERP and inserting a record into the database.

You communicate with the ERP via a shared directory where you have to write the order. Every order produces a log message in the logging system, and summary log is written at the end of each execution.

You are warned to beware of the frequent tendency of the Internet link to disconnect from the online store. Every time the Internet connection went down, the subsequent messages sent to the online store causes additional overhead in the link, delaying its recovery.

It's a completely different story when the application fails to write a file in the filesystem shared with the ERP. In such a case, retrying the same operation after a few seconds will do the job.

Example 1

Rules for the kata

OrderProcessor class provides an skeleton of the application with a few annotations to guide your work.

Additionally, you're provided with an acceptance test: OrderProcessorTest. Write any other test of any kind that you consider necessary for the kata.

A 5-minute introduction to vavr

Try is a data type used in vavr to represent side-effects.

You can compose functions with andThen or compose: vavr.

Match is a pattern matching with support for object decomposition and that can be used as a statement or expression: vavr

In you have one minute left, please read the links above.

Feedback after session in Mango

  1. Most people with Windows laptops have problems with Docker. Using an in-memory database like H2 may help to avoid these issues.
  2. Removing duplicate orders from the list is made via a database batch update operation. This is an optimization, not suitable for a kata.
  3. Steps: Acceptance tests, List operations, Order operations, failure recovery.

About

Online store kata based on VAVR & Resilience4j

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published