1 00:00:00,720 --> 00:00:02,040 How was that challenge? 2 00:00:02,040 --> 00:00:04,101 We're getting pretty far into our library app. 3 00:00:04,101 --> 00:00:08,535 You just finished adding the check out and return book methods to the patron class. 4 00:00:08,535 --> 00:00:12,050 You calculated and set the due date inside the check out method. 5 00:00:12,050 --> 00:00:15,320 But there's another way this could be accomplished that I prefer. 6 00:00:15,320 --> 00:00:17,020 Consider this. 7 00:00:17,020 --> 00:00:19,440 There's a property on the book class called out, and 8 00:00:19,440 --> 00:00:22,130 it holds a Boolean value, true or false. 9 00:00:22,130 --> 00:00:25,130 The book either is or isn't checked out. 10 00:00:25,130 --> 00:00:26,980 The book has a due date property. 11 00:00:26,980 --> 00:00:32,110 These two properties are set manually in the checkout method on the patron class. 12 00:00:32,110 --> 00:00:35,230 But wouldn't it be great if when a book object is marked out, 13 00:00:35,230 --> 00:00:38,870 that it would trigger the due date to be calculated and set as well. 14 00:00:38,870 --> 00:00:41,170 And of course, when the book is marked back in, 15 00:00:41,170 --> 00:00:44,250 it would trigger the dueDate property to be changed back to null. 16 00:00:45,590 --> 00:00:47,640 That is the beauty of setter methods. 17 00:00:47,640 --> 00:00:52,350 Marking a book as out or in and calculating and setting a due date inside 18 00:00:52,350 --> 00:00:58,090 both the checkOut and return book methods is a bulky way to go about these tasks. 19 00:00:58,090 --> 00:01:02,030 If we had a setter method for the out property, we could also figure out the due 20 00:01:02,030 --> 00:01:06,450 date, and set or unset the due date property at the same time. 21 00:01:06,450 --> 00:01:10,500 Meaning our check out and return book methods would become a lot more concise. 22 00:01:11,550 --> 00:01:13,990 Let's refactor our code a little bit to try this new approach. 23 00:01:15,090 --> 00:01:17,920 Open up the attached workspace for an updated readme or 24 00:01:17,920 --> 00:01:20,530 check out the teacher's notes for the new instructions. 25 00:01:20,530 --> 00:01:24,550 The following step provides a text based explanation of what we've discussed in 26 00:01:24,550 --> 00:01:28,750 this video and might offer some more insight if you're feeling confused. 27 00:01:28,750 --> 00:01:32,100 Give the coding a try and then check out the solution before joining me again.