1 00:00:04,560 --> 00:00:08,680 -Hi. In this video, we are going to look at the automated tools Pharo provides 2 00:00:09,000 --> 00:00:14,040 to critique your code and give you some direct feedback or automated feedback. 3 00:00:14,360 --> 00:00:19,640 For example, I loaded the MyCounter we developed in the redo of week 2. 4 00:00:19,960 --> 00:00:23,600 If you go to Counter and, for example, the increment method, 5 00:00:23,920 --> 00:00:28,160 if we write some debugging code, if we leave some debugging code 6 00:00:28,480 --> 00:00:32,600 such as "self halt", so a breakpoint. If we save this, 7 00:00:33,160 --> 00:00:34,920 we will see a warning there saying 8 00:00:36,160 --> 00:00:38,600 that there is some debugging code left in the method, 9 00:00:38,920 --> 00:00:41,960 and you can look on the question mark, click on this, 10 00:00:42,280 --> 00:00:46,560 it will explain what this really is. So: "Breakpoints, logging statements, etc. 11 00:00:46,880 --> 00:00:49,160 should not be left in production code". 12 00:00:49,480 --> 00:00:54,360 You can click on the tools to get a direct resolve of issues. 13 00:00:54,680 --> 00:00:55,440 Let's click on it. 14 00:00:55,760 --> 00:00:58,120 You can see that this tool modified the increment method 15 00:00:58,440 --> 00:01:01,840 and basically remove the call to "self halt". So, Ok. 16 00:01:02,160 --> 00:01:03,360 It goes back to normal. 17 00:01:03,680 --> 00:01:06,440 Now, if we call a method that has not been defined. 18 00:01:06,760 --> 00:01:11,760 For example, "self undefMethod". 19 00:01:14,280 --> 00:01:17,360 If we save this piece of code, we will see a new warning: 20 00:01:19,000 --> 00:01:21,320 "Super and Self Messages sent but not implemented" 21 00:01:21,640 --> 00:01:23,400 and "Messages sent but not implemented". 22 00:01:23,720 --> 00:01:26,920 Basically, it really does not understand what this undefMethod is. 23 00:01:27,240 --> 00:01:31,120 You can look at what those warnings are by clicking on the question mark. 24 00:01:31,760 --> 00:01:35,320 "Checks if messages sent to self or super exist in the hierarchy" 25 00:01:35,640 --> 00:01:38,080 and this "Checks for messages that are sent, 26 00:01:38,400 --> 00:01:40,960 but no class in the system implements such a message". 27 00:01:41,280 --> 00:01:43,880 Basically, it does not recognize the undefMethod. 28 00:01:44,200 --> 00:01:48,160 What you can do now... Let's just leave this in the method to see. 29 00:01:48,480 --> 00:01:52,400 What you can do now in your package is right-click and go to Browse critiques. 30 00:01:52,720 --> 00:01:55,680 If you click on that, you will have a Critic Browser that will open 31 00:01:56,000 --> 00:02:01,160 that basically lists all the rules that Pharo defines 32 00:02:01,480 --> 00:02:06,040 and runs them against your package. There are lots of them. 33 00:02:06,360 --> 00:02:10,080 For example, if we go to Bugs, you have a lot of them. 34 00:02:10,680 --> 00:02:14,280 You can read them and see what they are or what they mean. 35 00:02:15,200 --> 00:02:17,560 A thing that is really nice is 36 00:02:17,880 --> 00:02:21,000 that if you know that this is a rule that is wrong for your package, 37 00:02:21,320 --> 00:02:25,240 you can simply mark it as wrong. So, that is basically a false positive. 38 00:02:25,560 --> 00:02:30,120 You can mark them as wrong and then you can save these critiques. 39 00:02:30,440 --> 00:02:31,640 If you save them: 40 00:02:32,440 --> 00:02:34,880 "Do you want to save all false positive and toDo?". Yes. 41 00:02:36,280 --> 00:02:38,480 This will create a new class in your package 42 00:02:38,800 --> 00:02:40,440 which is called "ManifestMyCounter", 43 00:02:40,760 --> 00:02:43,080 that basically holds all the false positive 44 00:02:43,400 --> 00:02:45,400 and things that you just stated in the critiques, 45 00:02:45,720 --> 00:02:47,840 and that you can later on version 46 00:02:48,160 --> 00:02:51,280 and integrate in your continuous development cycle. 47 00:02:52,760 --> 00:02:56,960 In this video, we learned how we can use the automated feedback 48 00:02:57,280 --> 00:02:59,360 on the window under your code 49 00:02:59,680 --> 00:03:02,920 and how we can use the Critique Browser to version 50 00:03:03,240 --> 00:03:06,680 and integrate in a wider continuous development process 51 00:03:07,000 --> 00:03:10,800 in order to certify that your code still does not break the rules 52 00:03:11,120 --> 00:03:12,000 when you push it.