Where do the responsibilities of a class come from?
- the longest words in the story
- the order nouns first appear
- the verbs attached to its noun in the story
A library story mentions books, members and lending. Which are the candidate classes?
- Book, Member and Loan
- borrow, lend and return
- the library building
If a class job needs the word and to describe, it is probably two classes.
Circle one: True False
A class Library holds book lists and also computes late fines with member discounts. Half its methods touch books, half touch money. What does this symptom say?
- the class is perfectly sized
- the class has taken on two unrelated jobs and should split
- the methods need longer names
A designer must place the due date. Book rarely touches it while Loan reads it daily. Where does it belong?
- in Loan, which uses it most
- in Book, since books are lent
- in both, copied each time
After splitting a two-job class, how should the two new classes relate?
- they share nothing and duplicate the data
- one absorbs the other entirely
- each owns its group and they connect through a clean link
A single class manages member signups and book repairs, and its name fits neither half. What is the repair?
- rename it to something vaguer
- split signup data and methods from repair data and methods into two classes
- move everything into the constructor
A designer is tempted to store the member address list inside Book because checkout prints it. How do you argue the boundary?
- printing decides ownership, so Book keeps it
- Member uses addresses constantly while Book only borrows one for a moment, so Member owns it
- both classes must store full copies