---
tags: Setup-Summer21
---
# Lecture 15 Setup/Prep
Last class, we talked about the importance of putting methods into the classes that held the data needed by the methods. Getting methods into the right classes supports making data private and is part of good OO design.
This lecture, we will look at two topics: breaking a larger class into several smaller classes, and handling errors across multiple classes. We'll continue working with the Banking example from last class, but with a clean set of starter code.
## Prep
Here is the [starter code](https://cs18-summer-2021.github.io/static/classes/15/lec15init.zip), which extends on the code from the last lecture. In the new code:
- the common for-loop code in the `withdraw` and `getBalance` methods in the `BankingService` class have been abstracted into a helper function (called `findAccount` which is private and also in the `BankingService` class)
- there's a similar helper for `findCustomer`
- there is a `loginScreen` method for having a user enter their username and password
When deciding what classes to create for a larger program, there are two guidelines:
- create a class for each distinct entity or artifact with fields (e.g., `Account`, `Customer`)
- make separate classes for parts that you might want to swap out for a different class that provides similar functionality but in a different way (e.g., replace a terminal input/output mechanism with a website).
We will start by looking at the `BankingService` and asking which separate classes we might break it into. Come to class familiar with which methods are in the `BankingService` (what tasks they do, not the details of their code).