Milk Ledger — Design Patterns

Keep a dairy post's books with no eraser: event sourcing, CQRS, memento, proxy and boundaries. 16 levels, played right in the browser with nothing to install.

What the levels ask

  1. The 1st at Pos Susu Lembu Rukun. The old balance book kept one number per farmer, rubbed out and rewritten, until last month Mr. Tono and Mrs. Tini argued over a number nobody could explain. Ms. Ambar now writes every event in the ledger, and a balance is worked out from those lines. Pick how the lines are folded so a deposit adds and feed subtracts.
  2. The 6th. The villagers start to trust the new book because it answers what the old one could not: what was my balance on such a day? Pick the line filter so that saldoPada folds every line of that member up to the end of the day asked about.
  3. Mr. Bayu, the co-op's supervisor, finds line 5: Mrs. Tini's delivery on the 2nd is written as 63 where it should be 36. Mrs. Tini still holds the slip of every line, and her advance of 70 on the 3rd was approved against the balance of that day. Pick how betulkan puts it right so the balance now is correct and the book, replayed, still matches the slips in the villagers' hands.
  4. The 11th. The book is getting thick, and folding every line each time someone asks takes longer and longer. On Sunday night the 7th Ms. Ambar closed the book: each member's balance is written on a closing line, with the number of the last line it counts. Pick where the fold starts and with which starting value, so the balance is right and no more than 10 lines are read per question.
  5. The 11th, the post is busy. The ledger is the write side: the setor command adds a line there. The chalk board on the wall is the read side: Rara copies new lines to the board every ten minutes, so the board can lag. Mr. Tono pays in and reads his receipt at once. Pick what the setor command answers so his receipt shows the balance after that deposit, and the board is still right after Rara copies.
  6. Grandma Marni asks for a 100k advance for the clinic. Five minutes later, before Rara copies anything, she asks for 100k more for her grandson. Her balance is only 129. Pick the check in the kasbon command so a request that would take the balance below zero is refused with Saldo kurang (balance too low), and Mr. Tono's advance, which his balance covers, is still approved.
  7. The morning of the 12th. Before it becomes a line in the book, a delivery is written on a slip first, and a slip can be undone. Each time the slip changes, Riwayat keeps the slip's previous state (a memento), and Undo puts it back. Pick what is kept so Undo really brings the slip back to how it was before Ms. Ambar's finger slipped, its notes and its time too.
  8. The neighbourhood head chairs the members' meeting: from this month nobody phones the tanker's driver, the vet or the treasurer directly. Everyone reports to the committee (pengurus), and the committee knows who is on duty. Fill in the duty holder's lapor. Today the vet changes.
  9. The post's notice board has topics: the milk price and the vaccination day. Villagers subscribe to the topics they need, and whoever pins a notice need not know who reads it. Mr. Tono only needs the price once, then unsubscribes from inside his own listener. Pick the body of terbitkan so every subscriber of that topic hears it, no more and no fewer.
  10. The post's cash box holds the cash balance. Mrs. Harti wants every read written down in the box's notebook, and nobody may write a number straight into the box: money leaves only through the tarik command. Fill the two traps of the Proxy in front of the box. A direct write must fail with an error, not quietly.
  11. From the 12th the post's book is kept at the KUD office in the district and reached by phone. At night Ms. Ambar tests her program on the bench, with the phone line unplugged and the book in memory. The Layanan core knows only its port: something with tambah and milik. Fill the two parts of layanan.js so the test bench never touches the KUD adapter, and the real post stores to the KUD.
  12. The 13th. Taking in milk means using three fussy tools: a scale that must be zeroed, a lab that tests freshness, and a cooling tank that takes everything. New staff often get the order wrong. Fill in terimaSusu, one door that puts the tools in the right order, so Mrs. Tini's sour milk is refused without spoiling the tank and is not paid for.

And more, 16 levels in all.