WEBVTT 00:00:04.001 --> 00:00:07.507 Ready? Is Sound On? 00:00:08.922 --> 00:00:10.753 Cool. Alright. So. 00:00:22.778 --> 00:00:25.208 Do you see that red dot? 00:00:30.020 --> 00:00:31.743 Why is it red? 00:00:35.418 --> 00:00:36.934 It's dangerous. 00:00:37.798 --> 00:00:41.339 I like that answer. Watch out! Take me to the Cuba. 00:00:43.073 --> 00:00:51.915 Yeah, I've had the security people restricted me from going in the airports, because I'm carrying lasers with me. 00:00:51.988 --> 00:00:55.109 They have, you know, sign on and it says dangerous. 00:00:56.990 --> 00:00:59.148 But, why is that red? 00:01:01.035 --> 00:01:02.399 I have a green laser. 00:01:02.469 --> 00:01:05.432 Hey, you know, you gotta have lasers. 00:01:06.280 --> 00:01:09.323 Alright? I carry three of them with me. 00:01:11.184 --> 00:01:15.861 One of them is red. I always keep them in my back pack with the batteries (??). 00:01:15.901 --> 00:01:17.887 Or turned around actually. 00:01:18.277 --> 00:01:22.806 So this is my red laser. You can get a red laser for twelve dollars. 00:01:24.341 --> 00:01:25.436 There it is. Red laser. 00:01:25.460 --> 00:01:28.763 Nice. And I got a green laser. 00:01:30.029 --> 00:01:31.272 This one is nice one. 00:01:33.062 --> 00:01:34.684 A pretty bright one too. 00:01:34.752 --> 00:01:39.001 Not bright enough to do anything interesting, but bright. 00:01:39.075 --> 00:01:41.025 There is little adjustment in here. 00:01:41.025 --> 00:01:44.585 You can cut a component out and put a different register in here. 00:01:44.595 --> 00:01:47.797 Then you can get almost of quarter of Watt out of it. 00:01:47.847 --> 00:01:50.857 The battery drains pretty fast. You can pop a balloon with it. 00:01:51.668 --> 00:01:54.919 I mean that's cool. Boom. 00:01:57.124 --> 00:02:00.599 But this is my favorite laser. 00:02:02.496 --> 00:02:05.139 And I like this one because 00:02:06.698 --> 00:02:12.734 Well, can you see that? 00:02:14.716 --> 00:02:19.295 Little tiny violet dot. Do you see that up there? 00:02:20.906 --> 00:02:24.869 See if I can show it to you here. Oh! That’s nice and bright. 00:02:25.269 --> 00:02:27.833 On my thing here. That's nice and bright. 00:02:28.344 --> 00:02:31.192 But over there, you can hardly see it. 00:02:31.445 --> 00:02:33.524 Can you see this thing? No. 00:02:33.559 --> 00:02:35.886 Can you see it here? No, not too much. 00:02:36.492 --> 00:02:39.445 No, can't see it there much. 00:02:39.477 --> 00:02:48.820 But, I found this once. 00:02:51.325 --> 00:02:57.433 Just a marker. Litter laser doesn't do too much to the marker. 00:02:57.465 --> 00:02:59.458 But the lid! 00:03:02.153 --> 00:03:05.457 And look! It's yellow! 00:03:05.529 --> 00:03:07.331 It's not blue! 00:03:08.210 --> 00:03:11.093 And then see that little orange thing there? 00:03:11.093 --> 00:03:13.747 Watch this! I gotta aim it carefully. 00:03:14.353 --> 00:03:17.780 Wow! It's orange. 00:03:17.838 --> 00:03:19.988 What kind of laser is this? 00:03:22.060 --> 00:03:26.491 This is a laser of some other color. 00:03:33.884 --> 00:03:41.141 My glasses are the kind that turn dark in the sun light. 00:03:44.719 --> 00:03:47.650 I don't know if you can tell. But now there are all dark. 00:03:47.688 --> 00:03:50.853 Alright? And I can't see any of you. 00:03:50.917 --> 00:03:53.470 This is an ultra violet laser. 00:03:53.560 --> 00:03:57.504 They don't bill it as such. You can buy them on amazon. 17$. 00:03:57.504 --> 00:04:01.100 They say it's a violet laser. They lie. 00:04:01.368 --> 00:04:06.948 It's much cooler than violet laser. It's an ultra violet laser. 00:04:06.948 --> 00:04:09.637 Everybody has to have an ultraviolet laser. 00:04:09.703 --> 00:04:12.649 It's completely useless as a laser pointer. 00:04:12.701 --> 00:04:16.997 But you can draw nice little pictures on you glasses with it. 00:04:18.598 --> 00:04:21.843 Oh~ I got my name. 00:04:24.672 --> 00:04:26.507 Alright. Whatever. 00:04:29.240 --> 00:04:31.126 Look at the code on the screen. 00:04:32.639 --> 00:04:34.428 Anybody recognize that code? 00:04:35.765 --> 00:04:38.325 I can't see it because my glasses are all dark. 00:04:38.771 --> 00:04:40.798 Anybody recognize that code? 00:04:42.267 --> 00:04:44.242 That's PDP-8 code. 00:04:44.945 --> 00:04:48.863 That what code looked like in 1970s. 00:04:48.928 --> 00:04:54.753 That's kind of code I was writing when I was slightly older teenager. 00:04:55.825 --> 00:04:58.618 And then on into my twenties as well. 00:05:00.074 --> 00:05:03.543 This statement right there. 00:05:03.979 --> 00:05:06.305 Anybody know what that means? 00:05:07.940 --> 00:05:13.611 That's the memory address which this program would be loaded. 00:05:15.334 --> 00:05:20.159 We used to write the address our program into our program. 00:05:21.160 --> 00:05:23.551 This program would be loaded at address 200. 00:05:24.245 --> 00:05:26.996 And we put the data at address 300. 00:05:27.042 --> 00:05:28.052 How about that? 00:05:28.669 --> 00:05:32.636 And it makes perfect sense. Of course you would know where programs getting get loaded. 00:05:32.668 --> 00:05:34.836 I mean who else is gonna decide that for you? 00:05:34.905 --> 00:05:37.708 You are the programmer. You have control over memory. 00:05:39.471 --> 00:05:41.323 Now, this works fine. 00:05:43.026 --> 00:05:45.572 I'll show you a sequence of pictures here. 00:05:46.268 --> 00:05:50.080 Let's see. Yeah, that's a nice one. 00:05:50.151 --> 00:05:55.087 Hello. No, that's not the one what I wanted. 00:05:56.140 --> 00:06:01.655 That's because nowadays when you open up documents 00:06:02.386 --> 00:06:09.623 It opens up every document that's been opened by that application. 00:06:10.509 --> 00:06:12.138 Don't save that. 00:06:12.177 --> 00:06:14.630 That's the one I wanted, right there. 00:06:17.049 --> 00:06:20.356 Imagine you are programmer who's writing this kind of code. 00:06:20.899 --> 00:06:23.826 And you've got a program like this one. 00:06:24.626 --> 00:06:28.010 My program lives here. It starts at address 200. 00:06:28.900 --> 00:06:32.107 And there's a subroutine library that somebody else has written. 00:06:32.524 --> 00:06:35.145 By the way subroutine libraries were not real common. 00:06:35.229 --> 00:06:37.768 You usually wrote your own subroutine back in those days. 00:06:37.818 --> 00:06:45.607 But after a while a few guys write some useful subroutines. You think "You know, I should have those in my program too." 00:06:45.637 --> 00:06:50.378 And you think, "Well, just compile them in with my code" 00:06:50.411 --> 00:06:51.663 That's what we used to do. 00:06:51.695 --> 00:06:53.496 You just take the source code and jam it together. 00:06:53.531 --> 00:06:55.465 What was the problem with that? 00:06:58.735 --> 00:07:02.218 We were talking about the 1970s here. Right? 00:07:02.314 --> 00:07:05.566 Those programs were contained on paper tape. 00:07:06.124 --> 00:07:10.498 Paper tapes is being 50 characters per second, if you were lucky. 00:07:10.534 --> 00:07:19.939 And so increasing the size of your source code lengthened the size of your compile by minutes. 00:07:20.346 --> 00:07:26.642 So after a while these subroutine libraries got too long to continue to add your source code. 00:07:26.642 --> 00:07:35.124 So what we did is we would compiled the subroutine library and we would loaded at location 1200. 00:07:35.847 --> 00:07:42.367 Then what we could do is we could have a binary file which got loaded at 1200. 00:07:42.417 --> 00:07:45.363 And we could have our program at 200. 00:07:45.396 --> 00:07:49.044 And we did have a little file that all the symbols in it. 00:07:49.122 --> 00:07:55.016 So the symbols would tell us which subroutine was loaded where. 00:07:55.016 --> 00:08:03.131 So we knew the Get subroutine was at 205 and the Put subroutine was at 210 and so on. 00:08:03.518 --> 00:08:06.998 And our symbols would get compiled in with the program 00:08:07.032 --> 00:08:09.907 The subroutine would be loaded separately. And everything worked fine. 00:08:12.236 --> 00:08:14.215 What's the problem with this? 00:08:15.705 --> 00:08:19.428 When is the last time you saw a program that stayed small? 00:08:20.839 --> 00:08:22.122 They grow! 00:08:22.634 --> 00:08:26.489 And after a while, well let's see. 00:08:28.017 --> 00:08:29.632 I got another picture here. 00:08:34.783 --> 00:08:36.475 Yeah, that's that one. 00:08:40.664 --> 00:08:43.767 Oh yeah, a program that got too big. 00:08:43.767 --> 00:08:47.278 It overwrites the subroutines. This doesn't work. 00:08:49.171 --> 00:08:56.041 When your program overwrites the subroutines, your program still thinks that the subroutines are there. 00:08:56.073 --> 00:09:02.337 So when it calls the location 1205 it actually jumps into some arbitrary part of you code. 00:09:02.577 --> 00:09:04.491 You didn't know this happened of course. 00:09:04.510 --> 00:09:08.095 Until finally you debugged it and realized. "Oh, my programs got too big!" 00:09:08.914 --> 00:09:11.360 What's the solution to this? 00:09:13.744 --> 00:09:17.567 You are programmers, you can come up with the solution to this. 00:09:20.598 --> 00:09:23.282 Jump around the subroutine library. 00:09:23.954 --> 00:09:27.486 Right? You put it Jump right there to jump over here. 00:09:28.322 --> 00:09:31.370 Of course the subroutine library gets bigger too. 00:09:32.140 --> 00:09:39.809 And so after a while. Let's see if I've got that picture right. 00:09:39.842 --> 00:09:42.093 How about that one? Yeah, that's the one. 00:09:42.505 --> 00:09:45.243 After a while you get that problem. 00:09:48.209 --> 00:09:50.504 We actually faced to this problems. 00:09:51.014 --> 00:09:53.910 We actually had to deal with this stuff. 00:09:53.946 --> 00:09:55.702 And you know how we solved it? 00:09:59.595 --> 00:10:04.698 We came up with relocatable code. 00:10:04.730 --> 00:10:10.495 We said "You know what? This idea of putting absolute address in the program is killing us." 00:10:10.528 --> 00:10:17.440 "What we really like to do is compile our programs without telling them where they're going to be loaded." 00:10:17.813 --> 00:10:20.630 "And then we'll tell the loader where to load them" 00:10:21.435 --> 00:10:23.141 Now there's problem with that. 00:10:23.632 --> 00:10:29.658 Because that means that your binary files cannot really be binary. 00:10:29.705 --> 00:10:38.706 They have to have codes in them to tell you that certain address are not actually addresses. They are offsets. 00:10:39.030 --> 00:10:47.994 And the loader has to find every address that's marked as an offset and add the start address to it. 00:10:49.321 --> 00:10:51.940 But that works. We had relocatable loaders. 00:10:51.988 --> 00:10:54.619 We made this relocatable binaries and loaders. 00:10:54.619 --> 00:10:57.034 But now you've got another problem. 00:10:57.234 --> 00:11:00.415 Because how do you know where the subroutines are. 00:11:00.447 --> 00:11:05.737 If the subroutines are moving all over the place, how do you know where the subroutines are? 00:11:06.007 --> 00:11:11.043 So now you have to add more information to the binary file. 00:11:11.264 --> 00:11:19.687 This binary file you thought just binary of your program is now becoming very bizarre files. 00:11:19.726 --> 00:11:21.301 It's got all kinds of gunky in it. 00:11:21.372 --> 00:11:28.293 Now you have to put the names of the subroutine library into the binary file of the subroutines. 00:11:28.357 --> 00:11:32.468 And you have to show what address they will get loaded at 00:11:32.523 --> 00:11:37.614 And relocatable loader has to remember where it put those addresses 00:11:37.682 --> 00:11:42.622 And then in the program you have to have another thing in there. 00:11:42.694 --> 00:11:47.250 That says "Hey, I need to know where this programs gonna be loaded" 00:11:47.250 --> 00:11:53.432 "And the loader has to link the subroutine library of the program." 00:11:57.322 --> 00:12:00.831 Computers were slow in those days. 00:12:00.899 --> 00:12:02.548 Disk drivers were very slow. 00:12:02.626 --> 00:12:04.539 And there wasn't a lot of disk memory. 00:12:04.621 --> 00:12:08.102 You were lucky if you had megabytes of disk. 00:12:08.173 --> 00:12:14.636 And the seek arm took a long time and the rotational latency was high. 00:12:14.673 --> 00:12:18.136 So link times took a long time. 00:12:18.201 --> 00:12:22.206 Especially as we got more and more libraries. 00:12:22.257 --> 00:12:23.743 More and bigger program. 00:12:23.784 --> 00:12:26.032 Link time could take an hour. 00:12:26.082 --> 00:12:28.448 Anybody have a link that took an hour? 00:12:28.480 --> 00:12:30.845 Anybody here working in the 80s? 00:12:30.880 --> 00:12:32.694 Oh no! You got one now! 00:12:32.776 --> 00:12:35.263 You must be C++ programmer. 00:12:36.524 --> 00:12:38.661 That says so, right on your shirt. 00:12:38.701 --> 00:12:40.747 OSLO C++ Users Group. 00:12:41.137 --> 00:12:42.647 Long link times. 00:12:45.358 --> 00:12:50.458 Even in the 70s we had that problem. Although it was much smaller programs. 00:12:50.500 --> 00:12:57.964 So the solution to that was to separate the link pace from the load pace. 00:12:57.964 --> 00:13:02.302 We would link as a second compile step. 00:13:02.302 --> 00:13:07.435 And that would produce a final relocatable file that had all the linkage were resolved. 00:13:07.468 --> 00:13:10.141 And then we could load it at run time. 00:13:10.141 --> 00:13:12.488 Ant that was relatively fast enough. 00:13:13.287 --> 00:13:17.964 And for years and years and years. We lived with this 2 step process. 00:13:18.015 --> 00:13:24.358 Compile down to binary files then link all the binary files into an executable. 00:13:24.401 --> 00:13:26.497 And then you can load the executable. 00:13:26.531 --> 00:13:29.877 And that solved problem until the 90s. 00:13:29.942 --> 00:13:33.540 In the 90s something happened. 00:13:33.588 --> 00:13:36.238 It was called Moore's Law. 00:13:36.772 --> 00:13:38.009 What's Moore's law? 00:13:39.302 --> 00:13:43.558 The speed of processors will double every 18 month. 00:13:43.671 --> 00:13:52.960 Now apply that from about 1970 when the speed of our processors were half a million instructions per second. 00:13:53.640 --> 00:13:56.959 And keep that going forward until the 1990s. 00:13:57.025 --> 00:13:59.999 Well that's 20 years, how many 18 cycles is that? 00:14:00.048 --> 00:14:02.176 Well, 18 month cycle is that? 00:14:02.176 --> 00:14:03.981 That's about 15 cycles. 00:14:03.981 --> 00:14:07.257 So we have 2^15 increase in speed. 00:14:08.369 --> 00:14:09.286 Think about that. 00:14:09.338 --> 00:14:11.523 2^15 increase in speed. What is that? 00:14:11.602 --> 00:14:13.700 That's increase about 32000! 00:14:13.700 --> 00:14:15.171 That's about right too. 00:14:15.223 --> 00:14:18.751 Cause we went from about a half MHz to 2.8 GHz. 00:14:18.786 --> 00:14:21.746 Well, maybe 1 GHz by the late 90s. 00:14:21.787 --> 00:14:24.907 By that time disks were going faster too. 00:14:24.941 --> 00:14:27.232 We spun up a lot faster in the road. 00:14:27.300 --> 00:14:31.782 The heads weren't moving as far, we were getting a lot more bits around rim too. 00:14:31.830 --> 00:14:38.692 We could get hundreds of MBs on a disk. Oh! 00:14:40.512 --> 00:14:44.219 And somebody made a bright thought. 00:14:44.270 --> 00:14:46.157 Somebody had a bright thought that 00:14:47.454 --> 00:14:50.440 "We don't have to do the link separately anymore." 00:14:51.042 --> 00:14:54.378 "We can do the link at the same time we load." 00:14:54.424 --> 00:14:56.582 Anybody remember the ActiveX? 00:14:56.621 --> 00:14:58.946 Anybody remember OLE? 00:14:59.546 --> 00:15:01.917 What does DLL stands for? 00:15:04.119 --> 00:15:08.215 Dynamically linked library. 00:15:08.258 --> 00:15:11.120 Which means it's linked at load time. 00:15:11.153 --> 00:15:14.817 The link step got moved back into the loader. 00:15:15.699 --> 00:15:19.203 And we have the situation we have today. 00:15:20.762 --> 00:15:22.616 Who's .NET programmer, here? 00:15:23.668 --> 00:15:25.037 Look at that. A lot of people. 00:15:25.070 --> 00:15:28.122 Java programmer! Raise your hands. 00:15:28.189 --> 00:15:29.952 Not so many. How come? 00:15:31.001 --> 00:15:35.314 How come it's all .NET? Oh maybe because it's a .NET kind of conference? Huh? 00:15:36.034 --> 00:15:41.840 So, in .NET you got DLLs. 00:15:41.872 --> 00:15:43.732 Dynamically Linked Libraries. 00:15:43.765 --> 00:15:45.922 In Java, you got Jar files. 00:15:45.969 --> 00:15:50.940 But they are still dynamically linked libraries. Same idea. Same purpose. 00:15:51.780 --> 00:15:56.055 In C++, if you do in the Microsoft thing you still got DLLs. 00:15:56.088 --> 00:15:58.850 If you don in UNIX thing you've got shared libraries. 00:15:58.850 --> 00:16:01.031 They are still dynamically linked libraries. 00:16:01.080 --> 00:16:05.131 Our mode of operation now a days is too dynamic linked libraries. 00:16:05.165 --> 00:16:07.867 That's how we got here. 00:16:11.980 --> 00:16:13.626 How many DLLs do you have? 00:16:15.342 --> 00:16:18.575 Guys with the solutions, Visual Studio solutions. 00:16:18.608 --> 00:16:20.415 How many projects? 00:16:21.315 --> 00:16:23.550 60? That's not bad. 00:16:23.550 --> 00:16:25.017 Who's got more than 60? 00:16:25.060 --> 00:16:26.597 Oh, look at that. 00:16:26.635 --> 00:16:28.094 Who's got more than 200? 00:16:30.942 --> 00:16:33.132 And do you know why? 00:16:33.215 --> 00:16:38.055 You separate your code into different DLLs? 00:16:38.886 --> 00:16:40.692 Let me ask that question differently. 00:16:41.272 --> 00:16:43.624 When you deploy your application, 00:16:44.590 --> 00:16:50.366 Do you gather up all the DLLs and just ship the wad? 00:16:52.521 --> 00:16:57.677 If you do then why are you dynamically linking them? 00:16:57.728 --> 00:16:59.395 Statically link them. 00:17:00.269 --> 00:17:04.820 Why would you bother with dynamic linking? If you just gonna take all those DLLs. 00:17:04.887 --> 00:17:07.260 Gather them up into one gigantic wad. 00:17:07.313 --> 00:17:10.359 Throw the big wad into directory. And says, "It's my system." 00:17:11.996 --> 00:17:16.857 Why dynamically link if you not going to dynamically deploy? 00:17:17.540 --> 00:17:21.675 Why did we come up with dynamically linked library? 00:17:21.743 --> 00:17:28.603 We came up with dynamically linked library so that we could dynamically deploy our applications. 00:17:29.093 --> 00:17:30.155 Why? 00:17:32.571 --> 00:17:35.630 Well, we gonna get to network speed. Hang on in a minute. 00:17:35.676 --> 00:17:38.946 Cause network speed has huge impact on this all thing. 00:17:38.996 --> 00:17:43.985 Mid 90s I've got a client. He's got a 250MB executable. 00:17:43.985 --> 00:17:46.594 In the mid-90s that was big program. Now it' not. 00:17:47.267 --> 00:17:51.733 But then 250MB was big deal, you could not fit it on a CD. 00:17:52.250 --> 00:17:57.127 This was CAD system. He shipped it to the company like Ford. 00:17:57.127 --> 00:18:01.548 Ford would use it to design gears and levers. Stuff like that. 00:18:02.876 --> 00:18:04.331 He statically linked it. 00:18:05.035 --> 00:18:11.207 He would deploy the executable to his clients by burning it on several CDs. 00:18:11.844 --> 00:18:15.109 If he changed one line of code, 00:18:16.782 --> 00:18:26.422 He had to recompile, re-link, re-burn all the CDs and deploy all the CDs to all his clients. 00:18:27.237 --> 00:18:29.756 And you can imagine how it cost him a fair bit of money. 00:18:31.981 --> 00:18:34.189 I went there in the mid-90s. 00:18:34.246 --> 00:18:36.615 And encountered them at a time 00:18:36.665 --> 00:18:44.005 when they were trying to chop up their executable into this new Idea, DLLs. 00:18:44.262 --> 00:18:48.902 Because they realized that if they had dynamically linked libraries 00:18:48.902 --> 00:18:52.166 Then they could change a line of code 00:18:52.205 --> 00:18:56.740 And ideally you would only have to ship that DLL. 00:18:57.545 --> 00:19:01.125 You could e-mail it!. Back in those days that was a big deal. 00:19:01.168 --> 00:19:03.370 You couldn't e-mail 250MB in those days. 00:19:03.439 --> 00:19:07.631 Now a days you can as long as the guy you're talking to got a reasonable e-mail server. 00:19:07.703 --> 00:19:17.166 But back in those days e-mailing 250MB was impossible, so they could e-mail the 100KB of DLL. 00:19:17.219 --> 00:19:20.060 And so that was very very desirable for them. 00:19:20.060 --> 00:19:22.163 They worked for month and month and month. 00:19:22.188 --> 00:19:24.972 Chopping their application up in the little tiny bits, 00:19:25.010 --> 00:19:26.933 turning them all into bunch of DLLs 00:19:27.021 --> 00:19:29.465 And that when they realized their critical mistake. 00:19:30.557 --> 00:19:35.474 The critical mistake was that chopping your system up into bunch of arbitrary DLLs 00:19:35.474 --> 00:19:39.293 doesn’t do you a damn bit of good if they all depend on each other. 00:19:40.189 --> 00:19:42.742 If they are all depend on each other then you can... 00:19:51.828 --> 00:19:56.005 Was anybody just in Scott Meyer's talk here? 00:19:56.091 --> 00:19:58.434 The last talk he just gave an hour ago? 00:19:58.466 --> 00:20:01.075 He was talking about the problem of keyholes. 00:20:01.126 --> 00:20:07.846 Problem of keyholes is that we arbitrarily constrain someone for no good reason. 00:20:07.894 --> 00:20:09.813 Just arbitrary constrain them. 00:20:09.849 --> 00:20:14.522 So for example, have you ever seen a text box on a GUI? 00:20:14.572 --> 00:20:16.453 That was just too short? 00:20:16.521 --> 00:20:21.868 And you had typed bunch of stuffs in it and it wouldn't let you resize the window? 00:20:21.868 --> 00:20:25.885 It wouldn't let you scroll and you just had to type blind? 00:20:25.930 --> 00:20:29.602 Or maybe the text with scroll but you wouldn't be able to see the beginning of it? 00:20:29.656 --> 00:20:34.728 He was mentioning the keyhole problem. 00:20:34.795 --> 00:20:38.273 And I know that something just happened here. 00:20:39.093 --> 00:20:43.362 Apparently I'm not allowed not touch my computer for more than 5 minutes. 00:20:43.412 --> 00:20:48.041 I must apparently touch my computer otherwise I'll be punished. 00:20:52.043 --> 00:20:54.513 What was I talking about? Oh yeah, DLLs. 00:20:54.513 --> 00:20:58.225 So this guy, he put all his DLLs together. 00:20:58.276 --> 00:21:00.500 He forgot that DLLs depend upon each other. 00:21:00.534 --> 00:21:04.391 His goal was to be able to touch a line of code 00:21:04.423 --> 00:21:07.752 And just ship that DLL that was affected. 00:21:07.821 --> 00:21:12.386 But he found that all the '#includes', C++ guys know what I'm talking about 00:21:12.450 --> 00:21:15.307 All the '#includes' form the horrible network. 00:21:15.358 --> 00:21:18.146 And he had to recompile and redeploy everything anyway. 00:21:18.218 --> 00:21:19.680 They went out of business. 00:21:22.666 --> 00:21:27.814 The purpose of my talk today, now that I'm getting around to it 00:21:29.349 --> 00:21:31.336 is to talk about components. 00:21:31.381 --> 00:21:33.408 The problem of component design. 00:21:33.480 --> 00:21:36.167 And the first thing we gonna do is to define a component. 00:21:36.213 --> 00:21:38.665 What's a component? Component is DLL. 00:21:39.475 --> 00:21:42.531 When I talk about the word component what I mean is DLL. 00:21:42.565 --> 00:21:47.002 Very particular kind of DLL. A dynamically deployable DLL. 00:21:49.185 --> 00:21:52.573 A dynamically deployable DLL. 00:21:53.473 --> 00:21:55.929 Why would we want dynamically deploy? 00:21:56.816 --> 00:21:59.877 Well, because we would like to be able to change one line of code 00:21:59.926 --> 00:22:03.113 Just ship the one DLL that changed and ignore all the others. 00:22:03.163 --> 00:22:05.399 What's DLL hell? 00:22:05.448 --> 00:22:09.273 A term invented, I believe, by Microsoft 00:22:10.135 --> 00:22:12.442 to describe their own situation. 00:22:12.509 --> 00:22:17.506 And was to be completely cured by .NET. 00:22:17.540 --> 00:22:22.185 Anybody remember that line? "Dear .NET cures DLL hell." 00:22:22.185 --> 00:22:27.531 Hu Hu Hu. No, it doesn’t cure DLL hell. 00:22:27.541 --> 00:22:32.285 DLL hell is the problem that we've got all these little components with different version numbers 00:22:32.285 --> 00:22:35.084 And nobody hell knows which one go should together 00:22:35.150 --> 00:22:38.669 So we invented this module maintenance tools like Maven. 00:22:38.742 --> 00:22:40.642 What are you guys using in .NET? 00:22:41.176 --> 00:22:45.925 What's the tool that lets you keep all of your DLLs are in line. 00:22:45.974 --> 00:22:50.143 So you know that download version 1 of that one and version 3 of that one. 00:22:50.176 --> 00:22:52.714 Do you have tool for that? What? 00:22:53.961 --> 00:22:54.957 NuGet? 00:22:54.957 --> 00:22:56.854 Like the soft chewy (??) 00:22:58.944 --> 00:23:00.720 Never mind, I'm not going there. 00:23:09.766 --> 00:23:17.987 The graph you see on the screen is a graph of x^2. 00:23:18.477 --> 00:23:20.371 That's just an x^2 graph. 00:23:21.242 --> 00:23:23.102 But it's also something else. 00:23:23.134 --> 00:23:29.186 It's the number of dependencies in a system. 00:23:29.276 --> 00:23:33.748 Theoretical maximum number of dependencies, given a certain number of modules. 00:23:33.798 --> 00:23:38.206 And you can see that the number of modules increases linearly 00:23:38.256 --> 00:23:40.969 And the number of dependency increases with square. 00:23:44.473 --> 00:23:48.699 The theoretical maximum number of coupling, which I show here 00:23:50.586 --> 00:23:54.750 is proportional to the square of the number of modules. 00:23:54.786 --> 00:24:01.275 Now of course we would never create a system that has every possible dependency in it. 00:24:02.578 --> 00:24:03.733 Or would we? 00:24:06.355 --> 00:24:08.209 Look at this curve. 00:24:09.181 --> 00:24:19.898 This curve is the productivity of a team in comparison to the number of modules. 00:24:19.898 --> 00:24:24.953 By the way this is completely arbitrary I just generated one of x squared curve here. 00:24:25.389 --> 00:24:28.168 This is not me collecting actual data. 00:24:28.935 --> 00:24:34.197 This is just me recollecting my experience with development teams. 00:24:34.197 --> 00:24:38.003 They go slower and slower and slower over time. 00:24:38.035 --> 00:24:39.495 Who's had this happened to them? 00:24:39.532 --> 00:24:42.367 You start outgoing really fast. You can conquer the world. 00:24:42.416 --> 00:24:45.923 A year later you slogging through some kind of horrible wet lands. 00:24:46.366 --> 00:24:48.664 And you don't know what the heck has gone wrong. 00:24:48.721 --> 00:24:52.936 But estimates that used to be on the order of one week are now three month long. 00:24:53.378 --> 00:24:58.136 And by the way you blow all those estimates anyway and introduces more bugs than you fix. 00:24:58.212 --> 00:25:04.435 That's the kind of problem that we have as we proceed a long development path. 00:25:04.480 --> 00:25:09.831 And one of the reasons for that is accumulation of dependencies. 00:25:10.571 --> 00:25:11.522 Why? 00:25:11.842 --> 00:25:20.778 Well, that's the theoretical maximum dependency between modules. 00:25:20.823 --> 00:25:22.847 This is the theoretical minimum. 00:25:23.172 --> 00:25:28.910 If you're going to have an interconnected set of modules, there has to be some dependencies. 00:25:28.966 --> 00:25:32.231 And the minimum set of dependencies is a tree structure. 00:25:32.231 --> 00:25:35.620 Oh you can do some better with dynamically linking if you want to. 00:25:35.620 --> 00:25:39.531 But for the most part, you gonna have a small number of dependencies. 00:25:39.573 --> 00:25:42.272 How many do we have? 1. 2. 3. 4. 5. 6. 00:25:42.272 --> 00:25:44.587 6 out of 7 modules. 00:25:44.627 --> 00:25:46.659 Whereas here you've got 00:25:46.659 --> 00:25:50.570 Well, I think that's half of 49. 00:25:50.570 --> 00:25:54.202 It can't be half of 49 because that would be happy half dependency. 00:25:54.257 --> 00:25:58.264 Maybe it's just a plain 49. I don't know what it is. It's a large number. 00:25:58.349 --> 00:26:01.067 It's some relative of N squared. 00:26:01.133 --> 00:26:03.280 Maybe it's one half n squared plus one half n. 00:26:03.362 --> 00:26:04.893 Something like that. 00:26:04.923 --> 00:26:07.859 It's a very large number of dependencies. 00:26:07.892 --> 00:26:10.906 We don't want this. We do want that. 00:26:10.974 --> 00:26:13.134 We strive very hard to get here. 00:26:13.168 --> 00:26:21.088 But then, some shmuck does that. 00:26:24.111 --> 00:26:26.011 Visual Studio doesn't allow this. 00:26:27.014 --> 00:26:28.507 Uh! Inside solution. 00:26:29.029 --> 00:26:34.189 Inside solution. The DLLs cannot have cycles between their graphs. 00:26:34.243 --> 00:26:35.019 That's good. 00:26:35.086 --> 00:26:36.004 Don't want cycles. 00:26:36.473 --> 00:26:38.744 Between separate solutions there's no guarantee. 00:26:38.778 --> 00:26:40.359 So you have multiple solutions. 00:26:40.407 --> 00:26:45.270 If you're linking with things that come out of different solutions, you can still have cycles in the graph. 00:26:45.304 --> 00:26:50.766 If you get cycles in the graph, it looks like it adds only one extra dependency. 00:26:51.385 --> 00:26:52.776 But actually it adds more. 00:26:52.817 --> 00:26:57.299 Because 6 now depends upon 2. Because 1 depends upon 2. 00:26:57.371 --> 00:26:59.139 And dependency is transitive. 00:26:59.230 --> 00:27:04.568 So 6 also depends upon 4 and 5. And 6 depends upon 3 and 7. 00:27:04.771 --> 00:27:06.851 In fact, 6 depends upon all of them. 00:27:07.561 --> 00:27:13.921 So number of dependencies multiplies dramatically as soon as you have a cycle. 00:27:21.943 --> 00:27:23.726 This is the n squared graph again. 00:27:25.092 --> 00:27:28.693 This is also a graph of C++ compile time. 00:27:28.759 --> 00:27:31.253 As you add modules. 00:27:31.352 --> 00:27:34.100 Compile time and the link time if you're doing static linking 00:27:34.100 --> 00:27:35.737 But even if you're not static linking, 00:27:35.793 --> 00:27:39.881 just compile time grows with the square of the number of modules, 00:27:39.935 --> 00:27:44.671 if you have a fully connected network of modules. 00:27:44.736 --> 00:27:52.241 What that mean is that your '#include' or your import statements or your using statements can be traced in a cycle. 00:27:53.119 --> 00:27:58.560 And if you have that, then you gonna wind up with this big increase in compile time. 00:27:58.594 --> 00:28:00.859 C++ in particular would do this. 00:28:00.949 --> 00:28:02.659 Java and .NET don't. 00:28:03.917 --> 00:28:06.240 Their compile time is based on a different metric. 00:28:06.240 --> 00:28:12.053 They don't go reading source files. The way C++ does. 00:28:12.105 --> 00:28:15.349 Java and .NET read binary files to get their declarations. 00:28:15.385 --> 00:28:18.574 C++ reads source files to get his declarations. 00:28:18.615 --> 00:28:23.778 And so if you had a cycle in C++, you got punished. 00:28:25.281 --> 00:28:27.059 By a big compile time. 00:28:27.125 --> 00:28:28.832 And a massive one. 00:28:28.900 --> 00:28:30.244 It would go up with square. 00:28:30.292 --> 00:28:33.036 So you would had couple of modules your compile time will double. 00:28:33.036 --> 00:28:35.560 And that made us do something about it. 00:28:36.190 --> 00:28:38.804 Who knows who Ward Cunningham is? 00:28:39.549 --> 00:28:40.459 Oh, a few of you do. 00:28:40.494 --> 00:28:41.964 Good. And the rest of you. 00:28:42.014 --> 00:28:43.392 He's the guy who invented Wikis. 00:28:43.462 --> 00:28:46.579 Ward Cunningham invented Wikis. 00:28:46.623 --> 00:28:51.552 He's the guy who helped Kent Beck invent pair programming, test-driven development, 00:28:51.637 --> 00:28:53.158 And most of the agile stuff. 00:28:53.207 --> 00:28:57.016 Get to know who Ward Cunningham. He is very interesting fellow. 00:28:57.049 --> 00:28:58.832 Smalltalk Programmer from a long ago. 00:28:58.877 --> 00:29:00.634 And I asked Ward once. 00:29:00.686 --> 00:29:03.304 "Why did Smalltalk died, Ward?" 00:29:03.367 --> 00:29:10.085 And he said, "Smalltalk died because it was so easy to make a mess." 00:29:10.834 --> 00:29:12.810 "You, C++ programmer,” 00:29:12.846 --> 00:29:14.382 I was a C++ programmer at that time. 00:29:14.458 --> 00:29:16.678 "You, C++ programmers are lucky." 00:29:16.729 --> 00:29:19.467 "Your language punishes you if make a mess." 00:29:19.960 --> 00:29:21.830 "Smalltalk didn't punish you." 00:29:23.425 --> 00:29:26.515 Well, neither does Java. Neither does C#. 00:29:26.965 --> 00:29:28.502 They don't punish you anymore. 00:29:28.570 --> 00:29:30.997 It's very easy to make a very large mess. 00:29:31.368 --> 00:29:34.879 And get a very tangled structure and not know you're doing it. 00:29:34.910 --> 00:29:38.958 Fortunately Visual Studio keeps some of the cycles out of your graph. 00:29:44.173 --> 00:29:49.045 We would like that level of productivity, which is n Log N. 00:29:49.109 --> 00:29:52.376 Rather than this level of productivity. That's an n squared. 00:29:52.776 --> 00:29:59.683 And one of the ways to help with that is to manage the dependencies between our components. 00:30:01.753 --> 00:30:06.973 Then something happened to us in the late 90s and into the 2000s. 00:30:06.973 --> 00:30:10.136 Network speed started increasing dramatically. 00:30:10.635 --> 00:30:15.790 Now a days, it's not hard at all to download a GB in a couple of seconds, 00:30:15.870 --> 00:30:17.661 And to upload a GB in 10 seconds. 00:30:17.726 --> 00:30:19.335 That's pretty easy now a days. 00:30:19.386 --> 00:30:21.706 Back in the early days it was much harder. 00:30:22.031 --> 00:30:28.315 So, back in the early days we thought shipping individual DLL was going to be a benefit. 00:30:28.535 --> 00:30:31.939 Now a days we just kind of gather them all together and ship the one big wad. 00:30:32.237 --> 00:30:35.835 Why? Well because network speed is fast enough. We can do it. 00:30:35.835 --> 00:30:40.311 We can treat our batch of DLLs just like it was statically linked. 00:30:41.661 --> 00:30:43.208 But there's another issue. 00:30:44.215 --> 00:30:45.744 How many of you work in teams? 00:30:47.252 --> 00:30:49.511 Oh look at that. Everybody works in teams. 00:30:50.551 --> 00:30:54.415 So, you come in at 8 in the morning. 00:30:55.883 --> 00:30:59.277 You got a test to perform. 00:30:59.346 --> 00:31:02.371 You work all day to get all your stuff working. 00:31:02.488 --> 00:31:03.728 All works by end of the day. 00:31:03.766 --> 00:31:04.907 You check it in and go home. 00:31:04.961 --> 00:31:07.271 Come back the next day all your stuff is broken. 00:31:07.328 --> 00:31:08.086 Why? 00:31:09.766 --> 00:31:12.402 Somebody stayed later than you. 00:31:13.452 --> 00:31:15.836 And changed something you depend upon. 00:31:16.626 --> 00:31:21.774 And so you work all day long to fix whatever the problem was. 00:31:21.774 --> 00:31:24.409 You go home and come back the next day and your stuff is broken again. 00:31:24.523 --> 00:31:26.390 How many times can you go around that loop? 00:31:27.398 --> 00:31:30.942 Lots of time. This is a problem of large teams. 00:31:31.048 --> 00:31:34.662 Large teams will start to step on each other. 00:31:34.745 --> 00:31:36.862 And of course we've invented tools to help us. 00:31:36.862 --> 00:31:38.921 We've got source code control systems. 00:31:38.921 --> 00:31:41.559 And we've got all kinds of good stuff to help us with this. 00:31:41.799 --> 00:31:47.395 But we still can step all over each other, unless we manage our projects well. 00:31:47.814 --> 00:31:52.414 So, how can we manage our projects well? 00:31:55.951 --> 00:31:57.741 There is a principle. 00:32:06.670 --> 00:32:10.849 A principle called Acyclic Dependencies Principle. 00:32:13.189 --> 00:32:18.585 The Acyclic dependencies principle says, "If you have a set of components" 00:32:18.618 --> 00:32:22.764 "You would like to be able to arrange without any cycles in the dependency graph." 00:32:22.849 --> 00:32:25.957 Now, for whole bunch of reasons we've already talked about one of them. 00:32:26.023 --> 00:32:30.402 Which is compile time. We've talked about another which is just dependency load. 00:32:30.402 --> 00:32:31.599 Here is another. 00:32:33.727 --> 00:32:38.577 Alarm would like to release its version of alarm. 00:32:38.986 --> 00:32:43.013 The team that's working on the Alarm would like to make release 1.0. 00:32:43.144 --> 00:32:48.812 They've got nobody that they depend upon. 00:32:48.812 --> 00:32:52.349 So they are completely free to make any release they want. 00:32:52.401 --> 00:32:56.011 So they release their version of 1.0. Alarm 1.0. 00:32:56.011 --> 00:32:58.006 They start working on alarm 1.1. 00:32:58.896 --> 00:33:02.169 But now Alarm 1.0 has been released. 00:33:02.220 --> 00:33:05.977 Which means that Elevator and Conveyor can make their release. 00:33:06.916 --> 00:33:12.386 And once Elevator and Conveyor made their releases they can start to work on 1.1. 00:33:12.419 --> 00:33:15.740 But now Transport can make its release. 00:33:15.776 --> 00:33:17.759 You can see what's happening here. Right? 00:33:17.806 --> 00:33:21.079 The version numbers bubble up from the bottom. 00:33:21.148 --> 00:33:27.448 1.0 gets created here. Then there. Then there. Here. Here. And finally there. 00:33:27.497 --> 00:33:30.021 The version numbers bubble up from the bottom. 00:33:30.053 --> 00:33:32.633 If you look at it closely, you'll realize that 00:33:32.633 --> 00:33:37.550 the version numbers follows exact same path as the build. The compile. 00:33:37.615 --> 00:33:42.422 Dependencies are running in that direction. 00:33:43.318 --> 00:33:50.357 And now, some poor shmuck does this. 00:33:50.454 --> 00:33:52.601 Who's this? 00:33:52.703 --> 00:33:54.192 Well that was me. I did that. 00:33:54.303 --> 00:33:58.542 I had an alarm subsystem I was working on. 00:33:58.542 --> 00:34:02.255 And I needed it to put a message on the display and the control panel. 00:34:02.329 --> 00:34:06.963 There happened to be a class up here that had a function called Display. 00:34:06.963 --> 00:34:10.025 And I thought, "Oh! I should just call it." So I called it. 00:34:10.025 --> 00:34:13.315 This was not in a language that restrict me from cycles. 00:34:13.315 --> 00:34:17.092 And so it compiled and everything was fine and all worked okay. 00:34:18.482 --> 00:34:23.495 And then the next day I had a group of angry developers come to my cubicles with club 00:34:23.542 --> 00:34:25.243 And tell me "What the hell did you do?" 00:34:25.652 --> 00:34:32.592 I said, "Well, I just called the control panel and display class that has display function in it." 00:34:32.628 --> 00:34:34.553 "I needed to put this message on the screen." 00:34:34.587 --> 00:34:35.763 And they said, "You can't do that." 00:34:36.351 --> 00:34:37.908 Why can't we do that? 00:34:39.777 --> 00:34:41.172 First of all, 00:34:43.752 --> 00:34:47.603 what order should we build those modules in? 00:34:49.893 --> 00:34:52.737 You'd like to build them bottom up. 00:34:53.853 --> 00:34:55.666 But now there's no bottom. 00:34:55.717 --> 00:34:58.090 So there's no correct build order. 00:34:58.341 --> 00:35:01.242 If you have cycles in the component graph, 00:35:01.608 --> 00:35:06.485 there is no correct build order for the modules in that system. 00:35:06.524 --> 00:35:11.136 And therefore the execution of that system is undefined. 00:35:11.676 --> 00:35:14.992 What does undefined mean? What's the definition of undefined? 00:35:16.210 --> 00:35:17.867 Works in the lab. 00:35:19.656 --> 00:35:24.308 Anything undefined will work until you actually deploy it somewhere. Then it will fail. 00:35:25.442 --> 00:35:29.006 You can get systems to fail rather badly by having this cycles. 00:35:29.043 --> 00:35:30.945 This is pretty common in Java. 00:35:31.044 --> 00:35:35.951 If you have a system of Java that has cycles in it. 00:35:35.951 --> 00:35:37.061 You can build it. 00:35:37.093 --> 00:35:39.021 Although there is no correct build order. 00:35:39.129 --> 00:35:41.327 Then you run your test. And test will fail. 00:35:41.540 --> 00:35:44.626 Then you build it again. That will choose different build order. 00:35:44.661 --> 00:35:45.804 And maybe the test will pass. 00:35:45.855 --> 00:35:49.166 I know of companies that put their build in a loop until test pass. 00:35:54.627 --> 00:35:56.380 But the problem is worse than that. 00:35:56.923 --> 00:36:03.659 Because conveyor would like to make their release. 00:36:03.690 --> 00:36:05.879 They want to release 1.1. 00:36:05.911 --> 00:36:11.089 Now for them to release 1.1, they have to test with alarm 1.1. 00:36:11.885 --> 00:36:17.858 But alarm 1.1 is waiting for control panel 1.1, which is waiting for transport 1.1 00:36:17.904 --> 00:36:21.646 which is waiting for conveyor 1.1, which is the one trying to release. 00:36:21.646 --> 00:36:27.729 So there's no way to make the release without checking all of that source code out into one place. 00:36:27.818 --> 00:36:31.004 Integrating. Anybody remember integration. 00:36:31.037 --> 00:36:32.305 The joys of integration. 00:36:32.354 --> 00:36:37.126 Integrate the whole system and then make it work. 00:36:37.945 --> 00:36:41.044 And while you're doing that you gonna be stepping all over each other. 00:36:41.354 --> 00:36:49.582 So, if this cycle will bring back the problem of coming in 8 in the morning and find everything doesn't work. 00:36:50.164 --> 00:36:52.095 But it's worse than that. 00:36:52.717 --> 00:36:58.439 Because in order to test conveyor I need alarm. 00:36:58.472 --> 00:37:02.409 Which needs control panel which needs revenue, which need the database. 00:37:02.499 --> 00:37:06.248 The database takes 45 minutes to load and then it crashes. 00:37:06.528 --> 00:37:08.966 I can't run my tests. 00:37:09.026 --> 00:37:13.999 Ant the guys in conveyor saying, "Why the heck do I need the database?" 00:37:14.150 --> 00:37:17.344 "Well, you need the database because of this strange dependency structure." 00:37:17.504 --> 00:37:21.891 Anybody ever look at the number of DLLs that got loaded and scratch head and say, 00:37:21.891 --> 00:37:23.811 "How come I need those?" 00:37:23.849 --> 00:37:26.895 Anybody in C++ world have ever link line? 00:37:26.999 --> 00:37:28.962 And wonder "what's all this stuff in the link line?" 00:37:29.005 --> 00:37:30.530 "How come I need all that stuff?" 00:37:30.564 --> 00:37:32.993 Right? You got cycles in the dependency graphs. 00:37:33.026 --> 00:37:34.532 It's bringing in all kinds of gunk. 00:37:34.599 --> 00:37:42.656 So the first principle of components is no cycles in the components. 00:37:42.695 --> 00:37:45.059 What if you want to do this? 00:37:45.835 --> 00:37:51.747 What if you really want to call some function from down here that lives up there? 00:37:51.747 --> 00:37:53.107 How you gonna do it? 00:37:55.377 --> 00:37:57.370 Well, you can put out another component. 00:37:58.446 --> 00:37:59.868 That's one way to do it. 00:37:59.939 --> 00:38:03.339 Here I took that class out of the control panel. 00:38:03.373 --> 00:38:05.327 I put it in the display component. 00:38:05.327 --> 00:38:07.961 Then the alarm component can talk to the display component. 00:38:07.961 --> 00:38:10.255 The control panel can talk to the display component. 00:38:10.516 --> 00:38:12.199 I can keep the cycles out. 00:38:12.263 --> 00:38:14.242 That's common enough technique. 00:38:14.287 --> 00:38:16.061 Remember, these are all DLLs. 00:38:16.114 --> 00:38:23.034 So number of DLLs in your system will start to grow as people want to add cycles to the dependency graph. 00:38:23.086 --> 00:38:24.603 Maybe. 00:38:25.019 --> 00:38:28.364 Although there's another way to resolve the cycle. 00:38:30.440 --> 00:38:33.076 You can use dependency inversion. 00:38:33.124 --> 00:38:40.010 I could put an interface. A display interface. 00:38:40.064 --> 00:38:42.278 In the alarm subsystem. 00:38:42.330 --> 00:38:44.778 And have the control panel implemented it. 00:38:45.764 --> 00:38:48.321 That turns the dependency around. 00:38:49.643 --> 00:38:52.663 And changes a cycle into a straight tree. 00:38:59.790 --> 00:39:01.324 What's OO? 00:39:04.009 --> 00:39:06.269 What is Object Orientation? 00:39:08.802 --> 00:39:10.474 Why do we like it? 00:39:10.538 --> 00:39:14.936 How come all of our languages are object oriented languages? 00:39:14.936 --> 00:39:16.884 We've been doing this for 30 years. We gotta know. 00:39:16.952 --> 00:39:18.560 (Someone says) "Models the real world." 00:39:18.560 --> 00:39:20.193 Models the real world! Thank you! 00:39:20.193 --> 00:39:22.727 I planted him here so that he would say that. 00:39:22.727 --> 00:39:24.924 So then I could rip him to shred. 00:39:24.974 --> 00:39:26.852 No, that's absurd. 00:39:26.852 --> 00:39:31.641 And that whole idea that OO has better way to model real world is plain non-sense. 00:39:31.712 --> 00:39:35.366 It's something. Some guy concocted long time ago 00:39:35.450 --> 00:39:39.479 To convince his manager to spend 12,000$ on C++ compiler. 00:39:39.512 --> 00:39:42.092 Cause he couldn't figure out any other ways to get his manager to do it. 00:39:42.144 --> 00:39:46.391 12,000$. Early C++ compiler costed a lot of money. 00:39:46.391 --> 00:39:48.092 "12,000$. I'm not spending that for a compiler." 00:39:48.092 --> 00:39:49.961 "Well, it will help me model the real world!" 00:39:49.961 --> 00:39:53.086 "Oh. Okay then." 00:39:53.125 --> 00:39:57.739 This whole notion of modeling the real world is downright silly. 00:39:57.771 --> 00:40:04.560 What in the world is OO other than a bunch of functions using a bunch of data structure? Right? 00:40:04.560 --> 00:40:06.822 Encapsulated. Okay fine. Encapsulated. 00:40:06.822 --> 00:40:09.407 But bunch of functions using bunch of data structures. 00:40:09.407 --> 00:40:11.590 How is that different from Non OO? 00:40:13.393 --> 00:40:15.497 The answer to that is not easy to describe. 00:40:16.282 --> 00:40:18.067 How that's different? 00:40:18.129 --> 00:40:21.940 Well, okay. We kind of put the data structures in the functions together. 00:40:21.994 --> 00:40:23.659 But we always used to do that. 00:40:24.161 --> 00:40:26.806 Old C programmers used to that all the time. 00:40:27.058 --> 00:40:29.959 Data structures in programs always went together. 00:40:29.959 --> 00:40:33.588 There is a famous book called 'Algorithms plus data structures equals programs.' 00:40:34.290 --> 00:40:36.530 Data structures now (??) working together. 00:40:36.583 --> 00:40:39.288 So nothing really fancy about OO there. 00:40:39.288 --> 00:40:43.754 There is one thing that OO gave us that we did not have before. 00:40:43.754 --> 00:40:45.537 Because it wasn't safe. 00:40:45.597 --> 00:40:47.267 And that's polymorphism. 00:40:47.304 --> 00:40:50.987 Very very convenient polymorphism. 00:40:51.024 --> 00:40:53.266 We used to have it in C. 00:40:53.924 --> 00:40:57.898 Device independence in any operating system is an example of polymorphism. 00:40:57.947 --> 00:41:02.791 If you can write a program, you don't need to know what device that program is gonna use. 00:41:02.862 --> 00:41:04.842 It's a clearly polymorphic interface. 00:41:05.568 --> 00:41:08.694 But that's dangerous in most languages. 00:41:08.762 --> 00:41:10.472 Or it was back in those days. 00:41:10.472 --> 00:41:12.262 Because you have to fiddle with pointers to functions. 00:41:12.262 --> 00:41:13.533 And that was always dangerous. 00:41:14.638 --> 00:41:18.563 What OO gave us was very very convenient polymorphism. 00:41:18.639 --> 00:41:20.773 Polymorphism without thinking about it. 00:41:20.773 --> 00:41:23.674 Java in particular all the methods are polymorphic. 00:41:23.674 --> 00:41:25.108 There's no choice. 00:41:25.175 --> 00:41:29.289 C#, you have choice. You can use that funny virtual keyword. 00:41:29.322 --> 00:41:35.234 C++ programmers you've got a choice. You better use that virtual keyword. Especially on your destructors. 00:41:35.871 --> 00:41:38.933 But most of us we don't even pay attention anymore. 00:41:38.933 --> 00:41:42.007 All our functions are polymorphic. We don't even think about it. 00:41:42.055 --> 00:41:42.936 Why? 00:41:44.166 --> 00:41:49.384 Because when a function is polymorphic something amazing happens. 00:41:49.964 --> 00:41:55.192 The flow of control goes down towards to derivatives. 00:41:55.242 --> 00:41:59.150 But the source code dependency goes back towards base. 00:41:59.828 --> 00:42:07.917 We can take a source code dependency and turn it around without changing the run time dependency. 00:42:07.917 --> 00:42:10.110 How do you get DLLs? 00:42:10.110 --> 00:42:11.872 How do you get components? 00:42:11.872 --> 00:42:13.614 You isolate them. 00:42:13.614 --> 00:42:16.954 But you have to maintain the run time dependency. 00:42:21.441 --> 00:42:22.710 Visual Studio people 00:42:24.865 --> 00:42:27.552 Are you using ReSharper? 00:42:28.532 --> 00:42:30.060 Who is? ReSharper? 00:42:30.091 --> 00:42:31.576 Look at that. Everybody. 00:42:32.816 --> 00:42:35.606 Does Visual Studio know about ReSharper? 00:42:38.009 --> 00:42:38.645 No. 00:42:38.718 --> 00:42:42.338 Does Visual Studio call ReSharper? 00:42:43.465 --> 00:42:44.725 Yes. 00:42:44.790 --> 00:42:49.106 The flow of control goes from Visual Studio into ReSharper. 00:42:49.106 --> 00:42:54.477 There are function calls in Visual Studio that their way into ReSharper. 00:42:54.477 --> 00:43:00.686 But there is no source code dependency that moves from Visual Studio into ReSharper. 00:43:00.686 --> 00:43:03.086 Because they've been inverted the dependencies. 00:43:04.025 --> 00:43:09.912 You can create DLLs that your application will call. 00:43:09.945 --> 00:43:12.495 But your application doesn't know it exist. 00:43:12.527 --> 00:43:15.585 And you do that by inverting dependencies. 00:43:15.864 --> 00:43:17.072 Turn them around. 00:43:17.156 --> 00:43:19.280 So this is one nice way to do that. 00:43:19.652 --> 00:43:28.943 Now the control panel is a plug-in to the alarm system. 00:43:29.025 --> 00:43:31.590 The alarm system doesn't know the control panel exists. 00:43:31.590 --> 00:43:35.765 The control panel is a plug-in. 00:43:35.813 --> 00:43:38.609 And the alarm system would accept any kind of plug-in. 00:43:38.609 --> 00:43:42.568 A lot of different things to do implement this display function here. 00:43:42.568 --> 00:43:45.262 So we could have a lot of different things that we alarmed. 00:43:52.942 --> 00:43:55.184 What would rather depend upon? 00:44:01.501 --> 00:44:04.620 A component that was stable? 00:44:07.014 --> 00:44:08.996 Or a component that was unstable? 00:44:10.785 --> 00:44:12.145 Trick questions. 00:44:12.195 --> 00:44:17.812 Right? Everybody knows that you want to depend on something that's stable. 00:44:22.582 --> 00:44:25.278 But now let me define stability. 00:44:28.542 --> 00:44:30.590 Is my laser stable? 00:44:34.332 --> 00:44:36.273 It's not changing. 00:44:38.883 --> 00:44:40.569 But is it stable? 00:44:40.614 --> 00:44:43.667 Stability is not a Boolean. 00:44:43.732 --> 00:44:46.330 Stability is a continuous variable. 00:44:46.379 --> 00:44:50.612 And it is defined as the amount of work required to make a change. 00:44:50.657 --> 00:44:53.396 If it takes a lot of work to make a change, it's stable. 00:44:53.433 --> 00:44:56.250 If it takes very little work to make a change, it's unstable. 00:44:56.301 --> 00:45:00.212 That is unstable. 00:45:00.283 --> 00:45:03.767 Cause it doesn't take much work to make a change to its state. 00:45:03.825 --> 00:45:08.630 This. Well I won't say that it's stable. 00:45:08.736 --> 00:45:11.505 Cause it would take much work to upset it. 00:45:11.542 --> 00:45:14.952 And this whole stage doesn't feel very stable to me. 00:45:15.780 --> 00:45:18.945 So I may have to be careful about the way I move. 00:45:18.976 --> 00:45:21.597 So let me ask the question again. 00:45:21.632 --> 00:45:24.712 What would you rather depend upon? 00:45:24.766 --> 00:45:26.956 Something easy to change? 00:45:26.997 --> 00:45:28.735 Or something hard to change? 00:45:28.774 --> 00:45:33.115 Modify the source code. 00:45:33.725 --> 00:45:35.199 What would you rather depend upon? 00:45:35.199 --> 00:45:39.812 A module whose source code was hard to change or a module whose source code was easy to change? 00:45:42.290 --> 00:45:43.366 Same answer. 00:45:43.439 --> 00:45:45.699 You wanna depend upon thing that hard to change. 00:45:45.731 --> 00:45:48.997 And the reason behind that is very simple. 00:45:48.997 --> 00:45:51.956 Do you mind depending on string? 00:45:51.988 --> 00:45:52.725 No. 00:45:52.725 --> 00:45:54.946 Why don't you mind depending on string? 00:45:54.946 --> 00:45:58.409 Cause if those guys ever change string, they'll be held to pay. 00:45:59.679 --> 00:46:01.405 They would suffer more than you. 00:46:01.619 --> 00:46:04.157 That's the equation that we're talking about here. 00:46:04.157 --> 00:46:06.488 You are happy to do depend upon something, 00:46:06.528 --> 00:46:11.525 if it will hurt the authors of that thing more to change it than hurts you. 00:46:11.564 --> 00:46:13.814 That's the equation. 00:46:13.854 --> 00:46:15.598 You are happy to depend upon things 00:46:15.598 --> 00:46:19.202 as long as you're not likely to change or at least the bastards gonna pay if they change. 00:46:19.202 --> 00:46:25.356 So alright, we don't want to depend on things that are easy to change. 00:46:27.384 --> 00:46:28.906 Think about that very carefully. 00:46:28.906 --> 00:46:32.846 I don't want to depend on something easy to change. 00:46:34.594 --> 00:46:40.272 Do we design parts of our system so that they will be easy to change? 00:46:42.648 --> 00:46:43.785 Yes. 00:46:44.137 --> 00:46:49.977 What parts of our system do we most want to be easy to change? 00:46:53.137 --> 00:46:54.321 The GUI. 00:46:56.888 --> 00:46:58.286 GUIs are volatile. 00:46:58.286 --> 00:47:01.589 They change for no good reason at all. 00:47:01.622 --> 00:47:05.068 People will change GUI just because they feel like it. 00:47:05.105 --> 00:47:07.851 There will be some committee (??) to say, 00:47:07.851 --> 00:47:09.743 "You know, our system look so old." 00:47:09.780 --> 00:47:11.500 What the hell does that mean? 00:47:11.500 --> 00:47:14.542 "Our system look so old, we need to give it a face lift." 00:47:14.902 --> 00:47:19.376 "Marketing people have decided, we’ve gotta have whole new look and feel." 00:47:19.410 --> 00:47:21.035 "Not gonna change any behavior." 00:47:21.090 --> 00:47:22.895 "Just look and feel of the GUI." 00:47:22.927 --> 00:47:25.044 GUI has to be easy to change. 00:47:25.044 --> 00:47:28.509 The modules that hold that source code have to be easy to change 00:47:28.549 --> 00:47:33.005 And that means that none of you modules should depend on the GUI. 00:47:33.627 --> 00:47:36.668 No source code dependency should land on the GUI. 00:47:37.533 --> 00:47:41.976 Your components should not have dependencies that land on the GUI. 00:47:42.029 --> 00:47:45.183 GUI components have to depend upon the application. 00:47:45.226 --> 00:47:48.528 Application component cannot depend upon the GUI. 00:47:49.110 --> 00:47:53.207 Otherwise you wind up with the systems that wear the GUIs hard to change. 00:47:53.254 --> 00:47:56.567 How many of you test your systems? 00:47:56.617 --> 00:47:57.882 Automated test. 00:47:58.844 --> 00:47:59.910 Through the GUI. 00:48:02.644 --> 00:48:03.858 Got a couple of people. 00:48:04.807 --> 00:48:06.618 You write test code through the GUI. 00:48:07.383 --> 00:48:11.009 You are depending upon something that supposed to be easy to change. 00:48:11.058 --> 00:48:13.231 You'll make it hard to change. 00:48:13.296 --> 00:48:15.598 If you test your system through the GUI. 00:48:15.667 --> 00:48:19.399 I have a client who have 15,000 tests all go through the GUI. 00:48:19.432 --> 00:48:20.850 Same client, by the way. 00:48:20.934 --> 00:48:22.070 Same one went out of the business. 00:48:22.102 --> 00:48:25.786 15,000 tests through the GUI. 00:48:25.838 --> 00:48:29.291 He had so many tests he didn't know what they were anymore. 00:48:29.324 --> 00:48:30.828 He just knew they all had to pass. 00:48:30.863 --> 00:48:32.783 If somebody touch the GUI 00:48:32.819 --> 00:48:35.233 a thousand of those test would break. 00:48:35.283 --> 00:48:37.060 He couldn't find the time to fix them. 00:48:37.108 --> 00:48:39.223 So he came up with real simple rule. 00:48:39.265 --> 00:48:40.797 What do you think that rule was? 00:48:40.851 --> 00:48:43.575 No body touches the GUI. 00:48:43.611 --> 00:48:47.117 They made the GUI hard to change. 00:48:47.532 --> 00:48:51.696 The other thing of course could happened there is that you could lose your tests. 00:48:52.566 --> 00:48:58.428 You spend a man year putting together nice automated test suite that go through the GUI. 00:48:58.468 --> 00:49:01.944 And then somebody decides, "We need a face lift on our site." 00:49:01.984 --> 00:49:04.359 "Pull all out the old GUI and put a brand new GUI" 00:49:04.404 --> 00:49:05.969 And all those tests are gone. 00:49:06.000 --> 00:49:09.706 And you get to rewrite them again, but you've got other systems you gotta test. 00:49:09.748 --> 00:49:11.771 Don't test through the GUI. 00:49:11.809 --> 00:49:13.777 Don't do anything through the GUI. 00:49:13.777 --> 00:49:19.387 All dependencies point away from the GUI. 00:49:19.450 --> 00:49:22.799 What other things do we want to be easy to change? 00:49:22.881 --> 00:49:26.047 The database. 00:49:26.047 --> 00:49:28.340 We want the database to be easy to change. 00:49:28.340 --> 00:49:32.347 We want to be able to make changes to database without rippling through the whole applications. 00:49:33.814 --> 00:49:37.646 All dependencies you should point away from the database. 00:49:37.646 --> 00:49:40.613 Put the database in a component with all the dependencies pointing outwards. 00:49:40.681 --> 00:49:44.228 Put the GUI into a component with all the dependencies pointing outwards. 00:49:46.310 --> 00:49:54.150 I don't want to depend on anything that is unstable. 00:49:54.701 --> 00:49:58.444 How can we measure instability? 00:50:02.013 --> 00:50:03.818 See this guy up here? 00:50:04.997 --> 00:50:06.322 That component up there? 00:50:06.750 --> 00:50:08.926 Is he Stable? Or Unstable? 00:50:09.001 --> 00:50:13.261 He's got lots of incoming dependencies. 00:50:13.329 --> 00:50:15.624 No outgoing dependencies. 00:50:15.687 --> 00:50:17.099 He's hard to change. 00:50:17.152 --> 00:50:20.353 If I make a change to him, it impacts all those guys. 00:50:20.404 --> 00:50:24.940 So this component here is responsible to those guys. 00:50:25.010 --> 00:50:28.996 Oh and this component here is independent. 00:50:29.077 --> 00:50:30.892 It doesn't depend on anybody. 00:50:30.892 --> 00:50:32.803 It's responsible and independent. 00:50:32.803 --> 00:50:33.852 I's an adult. 00:50:36.724 --> 00:50:39.079 Stable. Adult. 00:50:40.048 --> 00:50:41.089 This guy. 00:50:41.619 --> 00:50:44.444 He depends on lots of other components. 00:50:44.953 --> 00:50:46.787 No body depends upon him. 00:50:46.840 --> 00:50:48.367 Is he responsible? 00:50:48.434 --> 00:50:49.643 And dependent? 00:50:49.682 --> 00:50:51.274 He's teenager. 00:50:52.014 --> 00:50:53.581 And he's unstable. 00:50:54.058 --> 00:50:57.624 These are the two extreme kinds of components. 00:50:57.683 --> 00:51:00.395 At the two sides of component spectrum. 00:51:00.429 --> 00:51:02.870 You've got the adults that highly stable. 00:51:02.937 --> 00:51:06.786 And you’ve got the teenager who are highly unstable. 00:51:06.878 --> 00:51:09.071 The unstable ones are easy to change. 00:51:09.154 --> 00:51:11.685 That's what we wanna put all of our little code. 00:51:12.391 --> 00:51:15.128 The stable ones are hard to change. 00:51:16.378 --> 00:51:22.870 We can measure that stability by creating a metric. 00:51:22.902 --> 00:51:25.828 That metric is a metric that I call "I" 00:51:26.816 --> 00:51:33.597 'I' is equal to the fan-out. Number of outgoing dependencies. 00:51:33.669 --> 00:51:37.095 Divided by the fan-in plus the fan-out. 00:51:37.183 --> 00:51:40.231 And if you think about that for very long. 00:51:40.263 --> 00:51:43.563 You'll realize that 'I' is a metric that goes from 0 to 1. 00:51:43.647 --> 00:51:46.835 0 being stable. 1 being unstable. 00:51:46.869 --> 00:51:50.026 0 being an adult. 1 being a teenager. 00:51:50.092 --> 00:51:53.337 It’s all about the dependencies. 00:51:53.370 --> 00:51:59.273 And now we can re-phrase the principle to say this. 00:52:05.664 --> 00:52:13.948 Every dependency in a component graph should point at something more stable than it is. 00:52:14.348 --> 00:52:21.748 Or, if use the metric, these arrow should point in the direction of decreasing 'I'. 00:52:21.827 --> 00:52:25.394 Decreasing instability. Increasing stability. 00:52:25.426 --> 00:52:30.656 And you can do the math on just the fan-ins and fan-outs and verify that's correct. 00:52:31.576 --> 00:52:36.733 Why was the cycle bad idea? 00:52:37.981 --> 00:52:41.441 Something stable depended on something unstable. 00:52:44.864 --> 00:52:48.128 But that leaves us with a problem. 00:52:48.167 --> 00:52:49.920 And the problem is this. 00:52:54.953 --> 00:52:56.228 What's that guy? 00:52:57.662 --> 00:52:59.327 Stable? Or unstable? 00:53:01.337 --> 00:53:02.724 He's really stable. 00:53:02.774 --> 00:53:05.103 He's sitting down here the bottom of the graph. 00:53:05.175 --> 00:53:07.800 Everything over here depends on him. 00:53:08.595 --> 00:53:10.422 He's very hard to change. 00:53:10.764 --> 00:53:14.927 If I touch that component, all these other components will be affected by. 00:53:14.927 --> 00:53:18.348 For no other reason than the release number changes. 00:53:23.941 --> 00:53:29.017 That means the stuffs down here at the bottom of graph is very difficult to work with. 00:53:30.887 --> 00:53:33.373 But there's an escape to that. 00:53:33.725 --> 00:53:35.338 Back to polymorphism. 00:53:36.750 --> 00:53:42.927 How can you make something easy to extend? 00:53:43.791 --> 00:53:46.479 Even though it's hard to modify. 00:53:48.710 --> 00:53:50.260 You make it abstract. 00:53:51.098 --> 00:53:54.422 Abstract classes can be extended trivially. 00:53:55.209 --> 00:53:57.365 Without having it modified. 00:53:57.456 --> 00:54:00.423 You can add new features to a system 00:54:00.472 --> 00:54:05.741 if those new features live inside the derivatives of base classes. 00:54:06.201 --> 00:54:08.904 So the final principle is this. 00:54:09.760 --> 00:54:16.153 We would like abstractness to increase as we go down the zeros. (??) 00:54:16.185 --> 00:54:18.480 Stuff up here concrete. 00:54:18.513 --> 00:54:20.310 Unstable and concrete. 00:54:20.310 --> 00:54:23.135 Stuff down here abstract and stable. 00:54:23.135 --> 00:54:30.237 Abstractness becomes more and more prevalent as we go down this tree. 00:54:32.090 --> 00:54:39.393 In fact, we could say that abstractness is a number 00:54:39.425 --> 00:54:46.424 which is the number of abstract classes divided by the total number of classes in a component. 00:54:46.895 --> 00:54:50.355 And if you did that, you get this number 'A' which goes 0 to 1. 00:54:50.355 --> 00:54:51.672 0 being concrete. 00:54:51.708 --> 00:54:54.826 1 being entirely abstract. Composed of nothing but interfaces. 00:54:54.878 --> 00:54:58.622 And then we can do this very interesting thing. 00:54:58.698 --> 00:55:09.120 We can say that for any particular component 'A' plus 'I' should equal 1. 00:55:09.152 --> 00:55:13.091 Either it's abstract where 'A' is 1. 00:55:13.129 --> 00:55:15.504 And stable where 'I' is 0. 00:55:15.541 --> 00:55:19.557 Or it is instable where 'I' is 1. 00:55:19.606 --> 00:55:21.130 And concrete where 'A' is 0. 00:55:21.130 --> 00:55:23.375 'A' plus 'I' equals 1. 00:55:23.423 --> 00:55:26.733 The magic formula of components. 'A' plus 'I' equals 1. 00:55:26.733 --> 00:55:30.863 Now you've got the adults up here which are abstract 00:55:30.897 --> 00:55:33.340 And everybody depends upon them. So they are stable. 00:55:33.378 --> 00:55:35.859 You've got the teenagers down here. 00:55:37.254 --> 00:55:41.781 Everybody that's got no incoming dependencies but they're very concrete. 00:55:41.815 --> 00:55:43.602 What do you got here? 00:55:43.635 --> 00:55:47.142 This is the line 'A' plus 'I' equals 1. 00:55:48.472 --> 00:55:53.458 This is where we would like our components to sit if they can sit. One of those two end points. 00:55:53.499 --> 00:55:54.376 Why? 00:55:55.583 --> 00:55:59.496 Well, what's up here? 00:56:00.981 --> 00:56:03.951 Highly abstract. Nobody depends upon on it. 00:56:05.366 --> 00:56:08.097 An interface that nobody implements. Useless. 00:56:08.729 --> 00:56:11.022 This is the zone of uselessness. 00:56:11.067 --> 00:56:14.316 We don't want our components going that way. 00:56:14.388 --> 00:56:15.600 What's down here? 00:56:17.040 --> 00:56:19.658 Very concrete. Everybody depends upon on it. 00:56:20.230 --> 00:56:21.560 Database schemas. 00:56:23.292 --> 00:56:25.212 Concrete. Everybody depends upon them. 00:56:25.262 --> 00:56:26.519 Fun to change. 00:56:27.371 --> 00:56:29.629 Right? We don't want things down here. 00:56:29.669 --> 00:56:31.019 This is the zone of pain. 00:56:31.713 --> 00:56:36.199 We would like our components to be as far from those 2 points as possible. 00:56:36.199 --> 00:56:39.298 Ideally if we could get them here and here that would be best. 00:56:39.333 --> 00:56:42.253 But it turns out the components are persnickety that way. 00:56:42.304 --> 00:56:45.450 So at least we'd like them to be sitting along this line. 00:56:45.962 --> 00:56:48.414 Or close to the line. 00:56:48.914 --> 00:56:51.407 Which leaves us the one last metric. 00:56:52.574 --> 00:56:53.566 'D' 00:56:54.316 --> 00:56:56.975 How far away is a component from the line? 00:56:57.594 --> 00:57:02.086 Well, 'D' could be the absolute value of 'A' plus 'I' minus 1. 00:57:02.086 --> 00:57:04.714 You can do the math on this. It's not very difficult. 00:57:04.714 --> 00:57:07.210 'D' is the metric that goes from 0 to 1. 00:57:07.460 --> 00:57:09.574 0 means that right on the line. 00:57:09.607 --> 00:57:11.638 1 means that one of the two bad end points. 00:57:12.111 --> 00:57:14.831 If you wanna know which end point you can take the absolute value signs off. 00:57:14.831 --> 00:57:16.361 But I don't care. 00:57:16.481 --> 00:57:22.408 You can measure 'D' by looking at the fan-in and the fan-out of the component. 00:57:22.437 --> 00:57:23.996 Measuring its abstractness. 00:57:24.075 --> 00:57:27.696 Doing the math is not very difficult math to do. 00:57:27.733 --> 00:57:33.595 And find out whether your component sits nicely on that line. 00:57:34.044 --> 00:57:40.423 If it does then it is abstract as it is depended upon. 00:57:41.387 --> 00:57:46.815 If it doesn't that means either it's very abstract and not depended on 00:57:46.885 --> 00:57:49.023 or very concrete and heavily depended upon. 00:57:49.023 --> 00:57:50.361 Both of which are very bad ideas. 00:57:51.455 --> 00:57:55.190 There are lots of tools that automatically calculate these metrics for you. 00:57:55.261 --> 00:57:58.665 If you ever used NDepend. That will calculate the metrics for you. 00:57:58.698 --> 00:58:02.580 If you ever used any of the other static analysis tools, 00:58:02.658 --> 00:58:06.184 they can generate all these metrics. I. D. All of them for you. 00:58:06.255 --> 00:58:09.529 So that you can look at your components and see if they fit. 00:58:09.568 --> 00:58:14.219 And then think about what should be easy to change. 00:58:14.825 --> 00:58:17.924 Things that are easy to change should be in teenagers. 00:58:19.047 --> 00:58:23.650 Things that are hard to change should be in adults that are abstract. 00:58:23.650 --> 00:58:27.629 Concrete teenagers hold the stuff that's easy to change. 00:58:28.283 --> 00:58:31.796 Abstract adults hold the stuff that's hard to change. 00:58:32.967 --> 00:58:34.178 Any questions? 00:58:36.316 --> 00:58:40.364 We started with PDP-8 assembly code and got here. 00:58:42.809 --> 00:58:44.617 Any questions? No? 00:58:45.151 --> 00:58:45.653 Good. 00:58:46.559 --> 00:58:47.809 Oh, damn. 00:58:49.760 --> 00:58:51.276 It's alright. It's okay. 00:58:51.393 --> 00:58:56.854 (Someone is questioning.) 00:58:56.854 --> 00:58:57.486 Yep. 00:58:57.486 --> 00:59:03.080 (Someone is questioning) 00:59:03.080 --> 00:59:04.955 2 versions. 00:59:04.955 --> 00:59:07.015 (Someone is questioning) 00:59:07.015 --> 00:59:10.351 Yeah, 2 versions. Same component. You kill the programmers. 00:59:10.540 --> 00:59:11.189 Yeah. 00:59:11.599 --> 00:59:15.284 Don't have multiple versions of same component in you system please. 00:59:15.320 --> 00:59:16.923 That's DLL Hell. 00:59:17.847 --> 00:59:19.909 Anybody else? Yeah. 00:59:21.349 --> 00:59:24.025 Where do you place...? Very very good question. 00:59:24.025 --> 00:59:26.186 String class sits right there. 00:59:26.952 --> 00:59:31.841 It's in the worst possible place but nobody ever changes it. So we don't care. 00:59:32.118 --> 00:59:35.767 This is all about the stuff we are actively developing. 00:59:35.809 --> 00:59:37.831 The stuff that is being changed. 00:59:38.061 --> 00:59:42.786 So we pay very close attention to the stuff that's in our libraries that are changing. 00:59:42.786 --> 00:59:45.880 The stuff that we get from other libraries that's not changing. 00:59:45.918 --> 00:59:49.029 Or the stuff that's in our old libraries that's not changing. 00:59:49.066 --> 00:59:50.470 We not gonna pay attention to that here. 00:59:50.513 --> 00:59:52.332 A lot of that stuff may live here. 00:59:52.332 --> 00:59:53.456 And that's okay. 00:59:53.456 --> 00:59:54.923 None of it's gonna live here. 00:59:55.733 --> 00:59:57.620 Well, some of it might. 00:59:57.620 --> 00:59:59.589 Anybody pull out any dead code? 00:59:59.624 --> 01:00:01.948 Abstract classes that nobody implements? 01:00:02.007 --> 01:00:04.869 Yeah, okay. So maybe you see some stuffs there. 01:00:04.901 --> 01:00:11.720 But String, Vector, a lot of libraries live down here we don't care because they're not volatile. 01:00:11.756 --> 01:00:16.272 Think of another axis is coming out from this graph, right, towards you. 01:00:16.306 --> 01:00:18.368 That's the axis of volatility. 01:00:18.368 --> 01:00:21.573 This is a slice where volatility is close to 1. 01:00:22.123 --> 01:00:24.836 The stuff where volatility is 0, we don't care about it. 01:00:26.136 --> 01:00:27.084 Anybody else? 01:00:27.963 --> 01:00:29.200 Yo! In the back.