Lesson 19. Capstone 3

 

To round off this unit, you’ll dive back into the bank accounts problem you worked on in capstone 2, but this time you’ll enhance it with a few new features that will test some of your knowledge of collections, as well as further reinforcing the lessons you picked up earlier in this book. You’ll look at

  • Creating and working with sequences
  • Performing aggregations
  • Composing functions together
  • Organizing code in modules

19.1. Defining the problem

In this exercise, you’ll start from a variant of the code that you ended up with at the end of capstone 2 and enhance it step by step. You designed a basic application that allows you to create an in-memory bank account, and perform withdrawals and deposits into the account. Now you’re going to continue that good work with a few enhancements:

  • Updating your main command-handling routine to eliminate mutable variables
  • Storing a serialized transaction log to disk for each customer
  • Rehydrating historical transactions and building an up-to-date account by using sequence operations

19.1.1. Solution overview

In the src/lesson-19 folder, you’ll see a prebuilt Capstone3.sln solution for you to open. There’s also a sample solution in the sample-solution subfolder. As always, use it if you get stuck, but don’t use it as a starting point. The whole idea is for you to try to solve this yourself!

19.2. Removing mutability

19.3. Writing transactions to disk

19.4. Rehydrating an account from disk

Summary