1 00:00:01,150 --> 00:00:03,440 In this video, I'd like to explain a little bit 2 00:00:03,607 --> 00:00:06,480 Pharo's different packaging ways, in order for 3 00:00:06,647 --> 00:00:08,640 not to get lost in the future. 4 00:00:09,000 --> 00:00:11,400 When you install Pharo, you will normally click on a link 5 00:00:11,950 --> 00:00:14,370 given, but if you go on Pharo, 6 00:00:14,537 --> 00:00:17,280 the release at the moment of this video 7 00:00:17,447 --> 00:00:21,060 is version 4, but version 5 will be exactly the same. 8 00:00:21,410 --> 00:00:24,370 When I downloaded Mac OSX version, I get this zip. 9 00:00:24,750 --> 00:00:29,090 If I unzip this zip, I get what I call Pharo4 app. 10 00:00:29,480 --> 00:00:32,460 When I launch Pharo 4 app, I get Pharo. 11 00:00:32,627 --> 00:00:36,410 Let's imagine we write 12 00:00:42,690 --> 00:00:47,380 "Hello". When I save, it will save the environment. 13 00:00:48,730 --> 00:00:50,430 I click on Save. 14 00:00:51,490 --> 00:00:55,920 If I click on Quit now, I will launch it again, 15 00:00:56,360 --> 00:01:00,100 and I will have exactly "Hello", because saving the Pharo 16 00:01:00,267 --> 00:01:03,810 image is making a memory copy with all the 17 00:01:04,000 --> 00:01:07,780 objects included Bytecode objects and compiled methods. 18 00:01:07,947 --> 00:01:11,920 What is there in 19 00:01:13,340 --> 00:01:14,400 this application? 20 00:01:14,567 --> 00:01:16,750 On Mac, we can what is inside. 21 00:01:16,930 --> 00:01:20,620 If I click on Show Contents, what will I see? 22 00:01:20,930 --> 00:01:24,380 I'm going ti find a Pharo virtual machine and resources. 23 00:01:24,810 --> 00:01:27,530 And here, I will find a changes file and an 24 00:01:31,280 --> 00:01:31,913 image file. 25 00:01:32,400 --> 00:01:35,880 The image file is the one that really contains 26 00:01:36,047 --> 00:01:39,840 the objects representing the memory, and the changes file 27 00:01:40,070 --> 00:01:42,760 is a file comprising all the incremental changes 28 00:01:42,927 --> 00:01:46,680 done. If I double-click 29 00:01:48,580 --> 00:01:49,800 on the image file, 30 00:01:55,800 --> 00:02:00,000 normally, depending on the OS, I will launch it on 31 00:02:00,470 --> 00:02:03,960 a Pharo virtual machine that I have installed, it 32 00:02:04,127 --> 00:02:05,900 will launch again my image file. 33 00:02:07,020 --> 00:02:08,450 This image file, what happens with it? 34 00:02:08,617 --> 00:02:10,000 Let's imagine I define a classe. 35 00:02:10,157 --> 00:02:12,050 I'm going to define a package, 36 00:02:18,100 --> 00:02:18,733 "Add package" "ATest". 37 00:02:18,900 --> 00:02:20,060 In this package, 38 00:02:23,470 --> 00:02:24,300 I'm going to define "MyStrangeClass". 39 00:02:28,600 --> 00:02:33,170 I define it and here, I put "foooo" which returns 40 00:02:33,430 --> 00:02:34,063 42. 41 00:02:38,650 --> 00:02:42,750 If I save this image with another name, I'm going 42 00:02:42,917 --> 00:02:44,270 to save it with the name 43 00:02:44,437 --> 00:02:45,070 Pharo40Stef. 44 00:02:52,060 --> 00:02:53,930 What did it do? 45 00:02:54,097 --> 00:02:58,580 I quit. It created another pair 46 00:02:58,747 --> 00:03:01,570 image and change. In this changes file, we won't open it 47 00:03:01,737 --> 00:03:04,620 because it is not readable by a human, there is 48 00:03:04,787 --> 00:03:07,110 the methods code I have just created. 49 00:03:07,277 --> 00:03:11,840 And if I launch again Pharo 4, I'm gonna 50 00:03:12,007 --> 00:03:16,300 launch it using the virtual machine, I get 51 00:03:17,940 --> 00:03:22,110 once more the snapshot, what we call the system 52 00:03:22,277 --> 00:03:27,200 copy that I had done at a certain moment 53 00:03:27,440 --> 00:03:28,073 before. 54 00:03:28,240 --> 00:03:32,790 Now, if I execute again PharoStef image, what will it 55 00:03:32,957 --> 00:03:33,590 do? 56 00:03:33,757 --> 00:03:37,180 It will show me the system with my new class. 57 00:03:39,740 --> 00:03:42,920 The Pharo 4 application, it is what we call a Mac 58 00:03:43,087 --> 00:03:47,460 bundle which contains the Pharo VM plus an image plus a change. 59 00:03:47,627 --> 00:03:50,500 If I double-click on it, I don't have any choice, it 60 00:03:50,667 --> 00:03:52,950 will always choose Pharo image because it is a script 61 00:03:53,330 --> 00:03:55,660 that has coded: "Here it is, this is THAT image." 62 00:03:55,827 --> 00:03:59,430 In general, it is useful at the beginning of the use of 63 00:03:59,597 --> 00:04:02,600 Pharo, but we do not use it. 64 00:04:02,767 --> 00:04:05,840 In general, either we use an instruction of the command 65 00:04:06,007 --> 00:04:09,200 line which is something like 66 00:04:10,290 --> 00:04:14,470 Pharo-ui with MyPharoImage.image 67 00:04:14,637 --> 00:04:19,250 and this will 68 00:04:19,417 --> 00:04:21,710 send the thing. Or if we use command line and we 69 00:04:21,877 --> 00:04:24,010 don't want to have the ui, we will do that kind of things. 70 00:04:24,520 --> 00:04:26,450 It means that Pharo is installed somewhere in 71 00:04:26,617 --> 00:04:30,130 your system as a standard Unix application. 72 00:04:31,070 --> 00:04:34,400 Now, you see on this page 73 00:04:36,150 --> 00:04:38,930 that you can download a Pharo 74 00:04:39,097 --> 00:04:40,940 pair, you can download a virtual machine. 75 00:04:41,110 --> 00:04:43,560 We are gonna download the virtual machine and 76 00:04:43,727 --> 00:04:48,220 download an image pair and also source. 77 00:04:48,690 --> 00:04:50,830 I'm gonna explain what it is, this way we will have the 78 00:04:51,000 --> 00:04:54,460 3 at hand, we will play together. 79 00:05:02,630 --> 00:05:05,760 Now if I unzip the file corresponding to 80 00:05:06,570 --> 00:05:09,240 Pharo Image and Changes, I get this one. 81 00:05:09,710 --> 00:05:12,260 When I unzip, what do I get in Pharo in this file? 82 00:05:12,427 --> 00:05:13,680 I get an image. 83 00:05:13,870 --> 00:05:15,950 We will do it in a mode where you can 84 00:05:19,140 --> 00:05:20,070 see what is inside. 85 00:05:21,290 --> 00:05:24,010 It means that this file, it is again an image pair 86 00:05:24,177 --> 00:05:27,660 corresponding to a certain state of the snapshot or of the 87 00:05:27,827 --> 00:05:32,630 Pharo image, of the virtualised system. Here, I can execute it 88 00:05:32,797 --> 00:05:36,280 on the Pharo image. 89 00:05:38,140 --> 00:05:42,120 I get a message, what is this message? 90 00:05:44,700 --> 00:05:49,270 The system can work since I can execute anything. 91 00:05:49,890 --> 00:05:50,770 I can run it. 92 00:05:50,937 --> 00:05:53,330 Now, I can do exactly what I did before. 93 00:05:53,497 --> 00:05:58,360 I can define MyPackage, and in MyPackage 94 00:05:58,770 --> 00:05:59,900 I will say MyStrangeClass. 95 00:06:00,740 --> 00:06:02,220 So we start to be used to it. 96 00:06:04,180 --> 00:06:07,580 I define a method: 97 00:06:09,010 --> 00:06:12,520 fooo 42. It asks for my login. 98 00:06:14,460 --> 00:06:17,510 I can do as usual "MyStrangeClass new foo" 99 00:06:19,370 --> 00:06:23,050 and I get 42. 100 00:06:23,420 --> 00:06:24,600 So, very good. I can save. 101 00:06:25,620 --> 00:06:27,360 I save it for example with another name, 102 00:06:27,527 --> 00:06:32,240 Stef, I name it PharoStrange. 103 00:06:32,407 --> 00:06:33,040 OK. 104 00:06:39,410 --> 00:06:40,200 What does it say? 105 00:06:40,367 --> 00:06:44,530 It says “I can’t find the source file 106 00:06:45,310 --> 00:06:49,200 Pharo 4. 0." Why does it say this? 107 00:06:50,240 --> 00:06:53,730 When I open the browser, if I can see for instance the 108 00:06:53,897 --> 00:06:58,670 AST code, this is not your code, so we go at the top. 109 00:06:58,837 --> 00:07:03,000 The reason why the system 110 00:07:03,167 --> 00:07:04,000 doesn’t find the comments 111 00:07:08,120 --> 00:07:09,180 is that it is decompiling. 112 00:07:09,750 --> 00:07:11,730 So, we don’t see it because the methods are 113 00:07:11,897 --> 00:07:13,420 too simple, but it decompiles the code. 114 00:07:13,587 --> 00:07:15,000 Let’s go on something more concrete. 115 00:07:15,147 --> 00:07:19,820 Here it decompiled the code, the Bytecode represents an 116 00:07:20,000 --> 00:07:21,620 an argument and it knows very well that this is an argument. 117 00:07:22,040 --> 00:07:23,440 But we lost the source. 118 00:07:24,050 --> 00:07:28,870 In general, the sytem source, when Pharo 119 00:07:29,037 --> 00:07:33,530 is implemented, is stored in a file called Pharo 4 source 120 00:07:33,697 --> 00:07:36,290 that you can find here. 121 00:07:36,457 --> 00:07:38,920 In general Pharo 4 122 00:07:39,087 --> 00:07:41,420 source will be installed once on the system because 123 00:07:41,587 --> 00:07:44,040 this file is on read only, and all your 124 00:07:44,860 --> 00:07:46,030 applications can use it. 125 00:07:46,210 --> 00:07:47,180 I have it here, I’m gonna unzipp it. 126 00:07:47,347 --> 00:07:50,670 Here I have Pharo4.source. 127 00:07:51,270 --> 00:07:52,840 If I quit without saving 128 00:07:56,690 --> 00:07:59,060 and I relaunch the application, here anyway you see 129 00:07:59,227 --> 00:08:02,280 that it does exactly the same as previously, it is to say 130 00:08:02,470 --> 00:08:05,190 that when I save a snapshot giving it 131 00:08:05,357 --> 00:08:10,160 another name, I have once more a system with 2 things: 132 00:08:10,420 --> 00:08:11,620 the image and its changes. 133 00:08:12,520 --> 00:08:16,650 Here if I take my old image, there 134 00:08:17,670 --> 00:08:20,780 is no more error because it has found the code and it 135 00:08:20,947 --> 00:08:24,710 knows that it corresponds to the state there was 136 00:08:24,880 --> 00:08:27,130 when we launched the first image. 137 00:08:27,297 --> 00:08:28,640 Now if I use the second one, 138 00:08:34,500 --> 00:08:38,960 if I consider the file AST-Core, first 139 00:08:39,127 --> 00:08:41,830 my classes have comments. 140 00:08:47,100 --> 00:08:51,000 Here these are really the names people gave. 141 00:08:51,830 --> 00:08:53,870 If we look at this architecture, what do we have? 142 00:08:54,950 --> 00:08:57,230 We have the source file containing the system sources, 143 00:08:57,397 --> 00:09:02,000 in general, once the system is compiled, the compiler 144 00:09:02,167 --> 00:09:04,610 doesn’t need the sources, 145 00:09:04,777 --> 00:09:08,330 the virtual machine and image and change pairs. 146 00:09:09,390 --> 00:09:12,180 Image contains all the objects that have been defined plus 147 00:09:12,347 --> 00:09:14,790 the system objects, with the changes files which 148 00:09:14,957 --> 00:09:18,520 contains the deltas of what you’ve done compared to the changes file. 149 00:09:18,690 --> 00:09:22,430 Each time you save you system, it is 150 00:09:22,597 --> 00:09:25,260 as if you save a virtualised image of your OS. 151 00:09:25,427 --> 00:09:26,730 This is exactly the same principle. 152 00:09:27,480 --> 00:09:31,910 If you look inside the Pharo 4 application, 153 00:09:33,200 --> 00:09:35,200 you will find those ressources. 154 00:09:36,430 --> 00:09:40,730 I have the Pharo 4 sources, I have the image file, 155 00:09:40,897 --> 00:09:43,130 the changes file and somewhere here the virtual 156 00:09:43,297 --> 00:09:44,540 machine with its plugins.