1 00:00:00,160 --> 00:00:02,960 Hello. This course is a bit unusual. 2 00:00:03,120 --> 00:00:06,680 I will present questions to prepare exercises for next week. 3 00:00:06,840 --> 00:00:09,840 This session is the first session 4 00:00:10,000 --> 00:00:13,000 about the way we want you to think about OOC. 5 00:00:13,160 --> 00:00:15,960 Do the exercises. They're quite interesting. 6 00:00:16,120 --> 00:00:18,400 What are they? There are three of them. 7 00:00:19,120 --> 00:00:22,440 We'll ask you to implement not, to implement or, 8 00:00:22,600 --> 00:00:26,480 and, most importantly, to wonder why these exercises. 9 00:00:26,640 --> 00:00:28,480 Let's take a look at them. 10 00:00:28,640 --> 00:00:31,960 First, you have the Booleans true and false. 11 00:00:32,120 --> 00:00:35,080 You have messages and objects. How to implement not? 12 00:00:35,240 --> 00:00:36,680 It's quite easy. 13 00:00:36,840 --> 00:00:41,720 If you have false and send the message not, it returns true. 14 00:00:41,880 --> 00:00:46,400 If you have true and send the message not, it returns false. 15 00:00:46,560 --> 00:00:49,840 It's not so hard. But how to implement this? 16 00:00:50,720 --> 00:00:52,960 The second question is about or. 17 00:00:53,120 --> 00:00:57,240 Or in Pharo is |. We took examples from the Pharo implementation. 18 00:00:57,400 --> 00:01:00,840 Don't cheat. Do it without checking how it's implemented. 19 00:01:01,000 --> 00:01:03,920 Once again, you have Booleans: true and false. 20 00:01:04,080 --> 00:01:05,880 You have objects and messages. 21 00:01:06,040 --> 00:01:09,160 You have true | true returns true. 22 00:01:09,320 --> 00:01:12,480 true | false returns true. true | anything returns true. 23 00:01:12,640 --> 00:01:14,920 It's the same with false. 24 00:01:15,080 --> 00:01:18,280 How to implement this? That's the two questions. 25 00:01:18,440 --> 00:01:22,720 Take a piece of paper and try to answer. 26 00:01:23,840 --> 00:01:27,560 The third question: "Why are you guys asking me this?" 27 00:01:27,720 --> 00:01:31,600 You must be thinking: "I'll never implement Booleans in my life." 28 00:01:31,760 --> 00:01:33,760 You're right. 29 00:01:33,920 --> 00:01:36,640 Except if you have to use three-valued logic: 30 00:01:36,800 --> 00:01:39,680 true, false, and unknown. 31 00:01:39,840 --> 00:01:41,200 How do you do this? 32 00:01:41,360 --> 00:01:46,160 You must wonder why we're wasting film to ask you this question. 33 00:01:46,320 --> 00:01:50,520 It's the crucial question we ask whenever we teach advanced programming. 34 00:01:50,680 --> 00:01:55,360 There must be a reason. We'll explain next week what that reason is. 35 00:01:55,520 --> 00:01:56,720 Enjoy.