[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:04.00,0:00:07.51,Default,,0000,0000,0000,,Ready? Is Sound On? Dialogue: 0,0:00:08.92,0:00:10.75,Default,,0000,0000,0000,,Cool. Alright. So. Dialogue: 0,0:00:22.78,0:00:25.21,Default,,0000,0000,0000,,Do you see that red dot? Dialogue: 0,0:00:30.02,0:00:31.74,Default,,0000,0000,0000,,Why is it red? Dialogue: 0,0:00:35.42,0:00:36.93,Default,,0000,0000,0000,,It's dangerous. Dialogue: 0,0:00:37.80,0:00:41.34,Default,,0000,0000,0000,,I like that answer. Watch out! Take me to the Cuba. Dialogue: 0,0:00:43.07,0:00:51.92,Default,,0000,0000,0000,,Yeah, I've had the security people restricted me from going in the airports, because I'm carrying lasers with me. Dialogue: 0,0:00:51.99,0:00:55.11,Default,,0000,0000,0000,,They have, you know, sign on and it says dangerous. Dialogue: 0,0:00:56.99,0:00:59.15,Default,,0000,0000,0000,,But, why is that red? Dialogue: 0,0:01:01.04,0:01:02.40,Default,,0000,0000,0000,,I have a green laser. Dialogue: 0,0:01:02.47,0:01:05.43,Default,,0000,0000,0000,,Hey, you know, you gotta have lasers. Dialogue: 0,0:01:06.28,0:01:09.32,Default,,0000,0000,0000,,Alright? I carry three of them with me. Dialogue: 0,0:01:11.18,0:01:15.86,Default,,0000,0000,0000,,One of them is red. I always keep them in my back pack with the batteries (??). Dialogue: 0,0:01:15.90,0:01:17.89,Default,,0000,0000,0000,,Or turned around actually. Dialogue: 0,0:01:18.28,0:01:22.81,Default,,0000,0000,0000,,So this is my red laser. You can get a red laser for twelve dollars. Dialogue: 0,0:01:24.34,0:01:25.44,Default,,0000,0000,0000,,There it is. Red laser. Dialogue: 0,0:01:25.46,0:01:28.76,Default,,0000,0000,0000,,Nice. And I got a green laser. Dialogue: 0,0:01:30.03,0:01:31.27,Default,,0000,0000,0000,,This one is nice one. Dialogue: 0,0:01:33.06,0:01:34.68,Default,,0000,0000,0000,,A pretty bright one too. Dialogue: 0,0:01:34.75,0:01:39.00,Default,,0000,0000,0000,,Not bright enough to do anything interesting, but bright. Dialogue: 0,0:01:39.08,0:01:41.02,Default,,0000,0000,0000,,There is little adjustment in here. Dialogue: 0,0:01:41.02,0:01:44.58,Default,,0000,0000,0000,,You can cut a component out and put a different register in here. Dialogue: 0,0:01:44.60,0:01:47.80,Default,,0000,0000,0000,,Then you can get almost of quarter of Watt out of it. Dialogue: 0,0:01:47.85,0:01:50.86,Default,,0000,0000,0000,,The battery drains pretty fast. You can pop a balloon with it. Dialogue: 0,0:01:51.67,0:01:54.92,Default,,0000,0000,0000,,I mean that's cool. Boom. Dialogue: 0,0:01:57.12,0:02:00.60,Default,,0000,0000,0000,,But this is my favorite laser. Dialogue: 0,0:02:02.50,0:02:05.14,Default,,0000,0000,0000,,And I like this one because Dialogue: 0,0:02:06.70,0:02:12.73,Default,,0000,0000,0000,,Well, can you see that? Dialogue: 0,0:02:14.72,0:02:19.30,Default,,0000,0000,0000,,Little tiny violet dot. Do you see that up there? Dialogue: 0,0:02:20.91,0:02:24.87,Default,,0000,0000,0000,,See if I can show it to you here. Oh! That’s nice and bright. Dialogue: 0,0:02:25.27,0:02:27.83,Default,,0000,0000,0000,,On my thing here. That's nice and bright. Dialogue: 0,0:02:28.34,0:02:31.19,Default,,0000,0000,0000,,But over there, you can hardly see it. Dialogue: 0,0:02:31.44,0:02:33.52,Default,,0000,0000,0000,,Can you see this thing? No. Dialogue: 0,0:02:33.56,0:02:35.89,Default,,0000,0000,0000,,Can you see it here? No, not too much. Dialogue: 0,0:02:36.49,0:02:39.44,Default,,0000,0000,0000,,No, can't see it there much. Dialogue: 0,0:02:39.48,0:02:48.82,Default,,0000,0000,0000,,But, I found this once. Dialogue: 0,0:02:51.32,0:02:57.43,Default,,0000,0000,0000,,Just a marker. Litter laser doesn't do too much to the marker. Dialogue: 0,0:02:57.46,0:02:59.46,Default,,0000,0000,0000,,But the lid! Dialogue: 0,0:03:02.15,0:03:05.46,Default,,0000,0000,0000,,And look! It's yellow! Dialogue: 0,0:03:05.53,0:03:07.33,Default,,0000,0000,0000,,It's not blue! Dialogue: 0,0:03:08.21,0:03:11.09,Default,,0000,0000,0000,,And then see that little orange thing there? Dialogue: 0,0:03:11.09,0:03:13.75,Default,,0000,0000,0000,,Watch this! I gotta aim it carefully. Dialogue: 0,0:03:14.35,0:03:17.78,Default,,0000,0000,0000,,Wow! It's orange. Dialogue: 0,0:03:17.84,0:03:19.99,Default,,0000,0000,0000,,What kind of laser is this? Dialogue: 0,0:03:22.06,0:03:26.49,Default,,0000,0000,0000,,This is a laser of some other color. Dialogue: 0,0:03:33.88,0:03:41.14,Default,,0000,0000,0000,,My glasses are the kind that turn dark in the sun light. Dialogue: 0,0:03:44.72,0:03:47.65,Default,,0000,0000,0000,,I don't know if you can tell. But now there are all dark. Dialogue: 0,0:03:47.69,0:03:50.85,Default,,0000,0000,0000,,Alright? And I can't see any of you. Dialogue: 0,0:03:50.92,0:03:53.47,Default,,0000,0000,0000,,This is an ultra violet laser. Dialogue: 0,0:03:53.56,0:03:57.50,Default,,0000,0000,0000,,They don't bill it as such. You can buy them on amazon. 17$. Dialogue: 0,0:03:57.50,0:04:01.10,Default,,0000,0000,0000,,They say it's a violet laser. They lie. Dialogue: 0,0:04:01.37,0:04:06.95,Default,,0000,0000,0000,,It's much cooler than violet laser. It's an ultra violet laser. Dialogue: 0,0:04:06.95,0:04:09.64,Default,,0000,0000,0000,,Everybody has to have an ultraviolet laser. Dialogue: 0,0:04:09.70,0:04:12.65,Default,,0000,0000,0000,,It's completely useless as a laser pointer. Dialogue: 0,0:04:12.70,0:04:16.100,Default,,0000,0000,0000,,But you can draw nice little pictures on you glasses with it. Dialogue: 0,0:04:18.60,0:04:21.84,Default,,0000,0000,0000,,Oh~ I got my name. Dialogue: 0,0:04:24.67,0:04:26.51,Default,,0000,0000,0000,,Alright. Whatever. Dialogue: 0,0:04:29.24,0:04:31.13,Default,,0000,0000,0000,,Look at the code on the screen. Dialogue: 0,0:04:32.64,0:04:34.43,Default,,0000,0000,0000,,Anybody recognize that code? Dialogue: 0,0:04:35.76,0:04:38.32,Default,,0000,0000,0000,,I can't see it because my glasses are all dark. Dialogue: 0,0:04:38.77,0:04:40.80,Default,,0000,0000,0000,,Anybody recognize that code? Dialogue: 0,0:04:42.27,0:04:44.24,Default,,0000,0000,0000,,That's PDP-8 code. Dialogue: 0,0:04:44.94,0:04:48.86,Default,,0000,0000,0000,,That what code looked like in 1970s. Dialogue: 0,0:04:48.93,0:04:54.75,Default,,0000,0000,0000,,That's kind of code I was writing when I was slightly older teenager. Dialogue: 0,0:04:55.82,0:04:58.62,Default,,0000,0000,0000,,And then on into my twenties as well. Dialogue: 0,0:05:00.07,0:05:03.54,Default,,0000,0000,0000,,This statement right there. Dialogue: 0,0:05:03.98,0:05:06.30,Default,,0000,0000,0000,,Anybody know what that means? Dialogue: 0,0:05:07.94,0:05:13.61,Default,,0000,0000,0000,,That's the memory address which this program would be loaded. Dialogue: 0,0:05:15.33,0:05:20.16,Default,,0000,0000,0000,,We used to write the address our program into our program. Dialogue: 0,0:05:21.16,0:05:23.55,Default,,0000,0000,0000,,This program would be loaded at address 200. Dialogue: 0,0:05:24.24,0:05:26.100,Default,,0000,0000,0000,,And we put the data at address 300. Dialogue: 0,0:05:27.04,0:05:28.05,Default,,0000,0000,0000,,How about that? Dialogue: 0,0:05:28.67,0:05:32.64,Default,,0000,0000,0000,,And it makes perfect sense. Of course you would know where programs getting get loaded. Dialogue: 0,0:05:32.67,0:05:34.84,Default,,0000,0000,0000,,I mean who else is gonna decide that for you? Dialogue: 0,0:05:34.90,0:05:37.71,Default,,0000,0000,0000,,You are the programmer. You have control over memory. Dialogue: 0,0:05:39.47,0:05:41.32,Default,,0000,0000,0000,,Now, this works fine. Dialogue: 0,0:05:43.03,0:05:45.57,Default,,0000,0000,0000,,I'll show you a sequence of pictures here. Dialogue: 0,0:05:46.27,0:05:50.08,Default,,0000,0000,0000,,Let's see. Yeah, that's a nice one. Dialogue: 0,0:05:50.15,0:05:55.09,Default,,0000,0000,0000,,Hello. No, that's not the one what I wanted. Dialogue: 0,0:05:56.14,0:06:01.66,Default,,0000,0000,0000,,That's because nowadays when you open up documents Dialogue: 0,0:06:02.39,0:06:09.62,Default,,0000,0000,0000,,It opens up every document that's been opened by that application. Dialogue: 0,0:06:10.51,0:06:12.14,Default,,0000,0000,0000,,Don't save that. Dialogue: 0,0:06:12.18,0:06:14.63,Default,,0000,0000,0000,,That's the one I wanted, right there. Dialogue: 0,0:06:17.05,0:06:20.36,Default,,0000,0000,0000,,Imagine you are programmer who's writing this kind of code. Dialogue: 0,0:06:20.90,0:06:23.83,Default,,0000,0000,0000,,And you've got a program like this one. Dialogue: 0,0:06:24.63,0:06:28.01,Default,,0000,0000,0000,,My program lives here. It starts at address 200. Dialogue: 0,0:06:28.90,0:06:32.11,Default,,0000,0000,0000,,And there's a subroutine library that somebody else has written. Dialogue: 0,0:06:32.52,0:06:35.14,Default,,0000,0000,0000,,By the way subroutine libraries were not real common. Dialogue: 0,0:06:35.23,0:06:37.77,Default,,0000,0000,0000,,You usually wrote your own subroutine back in those days. Dialogue: 0,0:06:37.82,0:06:45.61,Default,,0000,0000,0000,,But after a while a few guys write some useful subroutines. You think "You know, I should have those in my program too." Dialogue: 0,0:06:45.64,0:06:50.38,Default,,0000,0000,0000,,And you think, "Well, just compile them in with my code" Dialogue: 0,0:06:50.41,0:06:51.66,Default,,0000,0000,0000,,That's what we used to do. Dialogue: 0,0:06:51.70,0:06:53.50,Default,,0000,0000,0000,,You just take the source code and jam it together. Dialogue: 0,0:06:53.53,0:06:55.46,Default,,0000,0000,0000,,What was the problem with that? Dialogue: 0,0:06:58.74,0:07:02.22,Default,,0000,0000,0000,,We were talking about the 1970s here. Right? Dialogue: 0,0:07:02.31,0:07:05.57,Default,,0000,0000,0000,,Those programs were contained on paper tape. Dialogue: 0,0:07:06.12,0:07:10.50,Default,,0000,0000,0000,,Paper tapes is being 50 characters per second, if you were lucky. Dialogue: 0,0:07:10.53,0:07:19.94,Default,,0000,0000,0000,,And so increasing the size of your source code lengthened the size of your compile by minutes. Dialogue: 0,0:07:20.35,0:07:26.64,Default,,0000,0000,0000,,So after a while these subroutine libraries got too long to continue to add your source code. Dialogue: 0,0:07:26.64,0:07:35.12,Default,,0000,0000,0000,,So what we did is we would compiled the subroutine library and we would loaded at location 1200. Dialogue: 0,0:07:35.85,0:07:42.37,Default,,0000,0000,0000,,Then what we could do is we could have a binary file which got loaded at 1200. Dialogue: 0,0:07:42.42,0:07:45.36,Default,,0000,0000,0000,,And we could have our program at 200. Dialogue: 0,0:07:45.40,0:07:49.04,Default,,0000,0000,0000,,And we did have a little file that all the symbols in it. Dialogue: 0,0:07:49.12,0:07:55.02,Default,,0000,0000,0000,,So the symbols would tell us which subroutine was loaded where. Dialogue: 0,0:07:55.02,0:08:03.13,Default,,0000,0000,0000,,So we knew the Get subroutine was at 205 and the Put subroutine was at 210 and so on. Dialogue: 0,0:08:03.52,0:08:06.100,Default,,0000,0000,0000,,And our symbols would get compiled in with the program Dialogue: 0,0:08:07.03,0:08:09.91,Default,,0000,0000,0000,,The subroutine would be loaded separately. And everything worked fine. Dialogue: 0,0:08:12.24,0:08:14.22,Default,,0000,0000,0000,,What's the problem with this? Dialogue: 0,0:08:15.70,0:08:19.43,Default,,0000,0000,0000,,When is the last time you saw a program that stayed small? Dialogue: 0,0:08:20.84,0:08:22.12,Default,,0000,0000,0000,,They grow! Dialogue: 0,0:08:22.63,0:08:26.49,Default,,0000,0000,0000,,And after a while, well let's see. Dialogue: 0,0:08:28.02,0:08:29.63,Default,,0000,0000,0000,,I got another picture here. Dialogue: 0,0:08:34.78,0:08:36.48,Default,,0000,0000,0000,,Yeah, that's that one. Dialogue: 0,0:08:40.66,0:08:43.77,Default,,0000,0000,0000,,Oh yeah, a program that got too big. Dialogue: 0,0:08:43.77,0:08:47.28,Default,,0000,0000,0000,,It overwrites the subroutines. This doesn't work. Dialogue: 0,0:08:49.17,0:08:56.04,Default,,0000,0000,0000,,When your program overwrites the subroutines, your program still thinks that the subroutines are there. Dialogue: 0,0:08:56.07,0:09:02.34,Default,,0000,0000,0000,,So when it calls the location 1205 it actually jumps into some arbitrary part of you code. Dialogue: 0,0:09:02.58,0:09:04.49,Default,,0000,0000,0000,,You didn't know this happened of course. Dialogue: 0,0:09:04.51,0:09:08.10,Default,,0000,0000,0000,,Until finally you debugged it and realized. "Oh, my programs got too big!" Dialogue: 0,0:09:08.91,0:09:11.36,Default,,0000,0000,0000,,What's the solution to this? Dialogue: 0,0:09:13.74,0:09:17.57,Default,,0000,0000,0000,,You are programmers, you can come up with the solution to this. Dialogue: 0,0:09:20.60,0:09:23.28,Default,,0000,0000,0000,,Jump around the subroutine library. Dialogue: 0,0:09:23.95,0:09:27.49,Default,,0000,0000,0000,,Right? You put it Jump right there to jump over here. Dialogue: 0,0:09:28.32,0:09:31.37,Default,,0000,0000,0000,,Of course the subroutine library gets bigger too. Dialogue: 0,0:09:32.14,0:09:39.81,Default,,0000,0000,0000,,And so after a while. Let's see if I've got that picture right. Dialogue: 0,0:09:39.84,0:09:42.09,Default,,0000,0000,0000,,How about that one? Yeah, that's the one. Dialogue: 0,0:09:42.50,0:09:45.24,Default,,0000,0000,0000,,After a while you get that problem. Dialogue: 0,0:09:48.21,0:09:50.50,Default,,0000,0000,0000,,We actually faced to this problems. Dialogue: 0,0:09:51.01,0:09:53.91,Default,,0000,0000,0000,,We actually had to deal with this stuff. Dialogue: 0,0:09:53.95,0:09:55.70,Default,,0000,0000,0000,,And you know how we solved it? Dialogue: 0,0:09:59.60,0:10:04.70,Default,,0000,0000,0000,,We came up with relocatable code. Dialogue: 0,0:10:04.73,0:10:10.50,Default,,0000,0000,0000,,We said "You know what? This idea of putting absolute address in the program is killing us." Dialogue: 0,0:10:10.53,0:10:17.44,Default,,0000,0000,0000,,"What we really like to do is compile our programs without telling them where they're going to be loaded." Dialogue: 0,0:10:17.81,0:10:20.63,Default,,0000,0000,0000,,"And then we'll tell the loader where to load them" Dialogue: 0,0:10:21.44,0:10:23.14,Default,,0000,0000,0000,,Now there's problem with that. Dialogue: 0,0:10:23.63,0:10:29.66,Default,,0000,0000,0000,,Because that means that your binary files cannot really be binary. Dialogue: 0,0:10:29.70,0:10:38.71,Default,,0000,0000,0000,,They have to have codes in them to tell you that certain address are not actually addresses. They are offsets. Dialogue: 0,0:10:39.03,0:10:47.99,Default,,0000,0000,0000,,And the loader has to find every address that's marked as an offset and add the start address to it. Dialogue: 0,0:10:49.32,0:10:51.94,Default,,0000,0000,0000,,But that works. We had relocatable loaders. Dialogue: 0,0:10:51.99,0:10:54.62,Default,,0000,0000,0000,,We made this relocatable binaries and loaders. Dialogue: 0,0:10:54.62,0:10:57.03,Default,,0000,0000,0000,,But now you've got another problem. Dialogue: 0,0:10:57.23,0:11:00.42,Default,,0000,0000,0000,,Because how do you know where the subroutines are. Dialogue: 0,0:11:00.45,0:11:05.74,Default,,0000,0000,0000,,If the subroutines are moving all over the place, how do you know where the subroutines are? Dialogue: 0,0:11:06.01,0:11:11.04,Default,,0000,0000,0000,,So now you have to add more information to the binary file. Dialogue: 0,0:11:11.26,0:11:19.69,Default,,0000,0000,0000,,This binary file you thought just binary of your program is now becoming very bizarre files. Dialogue: 0,0:11:19.73,0:11:21.30,Default,,0000,0000,0000,,It's got all kinds of gunky in it. Dialogue: 0,0:11:21.37,0:11:28.29,Default,,0000,0000,0000,,Now you have to put the names of the subroutine library into the binary file of the subroutines. Dialogue: 0,0:11:28.36,0:11:32.47,Default,,0000,0000,0000,,And you have to show what address they will get loaded at Dialogue: 0,0:11:32.52,0:11:37.61,Default,,0000,0000,0000,,And relocatable loader has to remember where it put those addresses Dialogue: 0,0:11:37.68,0:11:42.62,Default,,0000,0000,0000,,And then in the program you have to have another thing in there. Dialogue: 0,0:11:42.69,0:11:47.25,Default,,0000,0000,0000,,That says "Hey, I need to know where this programs gonna be loaded" Dialogue: 0,0:11:47.25,0:11:53.43,Default,,0000,0000,0000,,"And the loader has to link the subroutine library of the program." Dialogue: 0,0:11:57.32,0:12:00.83,Default,,0000,0000,0000,,Computers were slow in those days. Dialogue: 0,0:12:00.90,0:12:02.55,Default,,0000,0000,0000,,Disk drivers were very slow. Dialogue: 0,0:12:02.63,0:12:04.54,Default,,0000,0000,0000,,And there wasn't a lot of disk memory. Dialogue: 0,0:12:04.62,0:12:08.10,Default,,0000,0000,0000,,You were lucky if you had megabytes of disk. Dialogue: 0,0:12:08.17,0:12:14.64,Default,,0000,0000,0000,,And the seek arm took a long time and the rotational latency was high. Dialogue: 0,0:12:14.67,0:12:18.14,Default,,0000,0000,0000,,So link times took a long time. Dialogue: 0,0:12:18.20,0:12:22.21,Default,,0000,0000,0000,,Especially as we got more and more libraries. Dialogue: 0,0:12:22.26,0:12:23.74,Default,,0000,0000,0000,,More and bigger program. Dialogue: 0,0:12:23.78,0:12:26.03,Default,,0000,0000,0000,,Link time could take an hour. Dialogue: 0,0:12:26.08,0:12:28.45,Default,,0000,0000,0000,,Anybody have a link that took an hour? Dialogue: 0,0:12:28.48,0:12:30.84,Default,,0000,0000,0000,,Anybody here working in the 80s? Dialogue: 0,0:12:30.88,0:12:32.69,Default,,0000,0000,0000,,Oh no! You got one now! Dialogue: 0,0:12:32.78,0:12:35.26,Default,,0000,0000,0000,,You must be C++ programmer. Dialogue: 0,0:12:36.52,0:12:38.66,Default,,0000,0000,0000,,That says so, right on your shirt. Dialogue: 0,0:12:38.70,0:12:40.75,Default,,0000,0000,0000,,OSLO C++ Users Group. Dialogue: 0,0:12:41.14,0:12:42.65,Default,,0000,0000,0000,,Long link times. Dialogue: 0,0:12:45.36,0:12:50.46,Default,,0000,0000,0000,,Even in the 70s we had that problem. Although it was much smaller programs. Dialogue: 0,0:12:50.50,0:12:57.96,Default,,0000,0000,0000,,So the solution to that was to separate the link pace from the load pace. Dialogue: 0,0:12:57.96,0:13:02.30,Default,,0000,0000,0000,,We would link as a second compile step. Dialogue: 0,0:13:02.30,0:13:07.44,Default,,0000,0000,0000,,And that would produce a final relocatable file that had all the linkage were resolved. Dialogue: 0,0:13:07.47,0:13:10.14,Default,,0000,0000,0000,,And then we could load it at run time. Dialogue: 0,0:13:10.14,0:13:12.49,Default,,0000,0000,0000,,Ant that was relatively fast enough. Dialogue: 0,0:13:13.29,0:13:17.96,Default,,0000,0000,0000,,And for years and years and years. We lived with this 2 step process. Dialogue: 0,0:13:18.02,0:13:24.36,Default,,0000,0000,0000,,Compile down to binary files then link all the binary files into an executable. Dialogue: 0,0:13:24.40,0:13:26.50,Default,,0000,0000,0000,,And then you can load the executable. Dialogue: 0,0:13:26.53,0:13:29.88,Default,,0000,0000,0000,,And that solved problem until the 90s. Dialogue: 0,0:13:29.94,0:13:33.54,Default,,0000,0000,0000,,In the 90s something happened. Dialogue: 0,0:13:33.59,0:13:36.24,Default,,0000,0000,0000,,It was called Moore's Law. Dialogue: 0,0:13:36.77,0:13:38.01,Default,,0000,0000,0000,,What's Moore's law? Dialogue: 0,0:13:39.30,0:13:43.56,Default,,0000,0000,0000,,The speed of processors will double every 18 month. Dialogue: 0,0:13:43.67,0:13:52.96,Default,,0000,0000,0000,,Now apply that from about 1970 when the speed of our processors were half a million instructions per second. Dialogue: 0,0:13:53.64,0:13:56.96,Default,,0000,0000,0000,,And keep that going forward until the 1990s. Dialogue: 0,0:13:57.02,0:13:59.100,Default,,0000,0000,0000,,Well that's 20 years, how many 18 cycles is that? Dialogue: 0,0:14:00.05,0:14:02.18,Default,,0000,0000,0000,,Well, 18 month cycle is that? Dialogue: 0,0:14:02.18,0:14:03.98,Default,,0000,0000,0000,,That's about 15 cycles. Dialogue: 0,0:14:03.98,0:14:07.26,Default,,0000,0000,0000,,So we have 2^15 increase in speed. Dialogue: 0,0:14:08.37,0:14:09.29,Default,,0000,0000,0000,,Think about that. Dialogue: 0,0:14:09.34,0:14:11.52,Default,,0000,0000,0000,,2^15 increase in speed. What is that? Dialogue: 0,0:14:11.60,0:14:13.70,Default,,0000,0000,0000,,That's increase about 32000! Dialogue: 0,0:14:13.70,0:14:15.17,Default,,0000,0000,0000,,That's about right too. Dialogue: 0,0:14:15.22,0:14:18.75,Default,,0000,0000,0000,,Cause we went from about a half MHz to 2.8 GHz. Dialogue: 0,0:14:18.79,0:14:21.75,Default,,0000,0000,0000,,Well, maybe 1 GHz by the late 90s. Dialogue: 0,0:14:21.79,0:14:24.91,Default,,0000,0000,0000,,By that time disks were going faster too. Dialogue: 0,0:14:24.94,0:14:27.23,Default,,0000,0000,0000,,We spun up a lot faster in the road. Dialogue: 0,0:14:27.30,0:14:31.78,Default,,0000,0000,0000,,The heads weren't moving as far, we were getting a lot more bits around rim too. Dialogue: 0,0:14:31.83,0:14:38.69,Default,,0000,0000,0000,,We could get hundreds of MBs on a disk. Oh! Dialogue: 0,0:14:40.51,0:14:44.22,Default,,0000,0000,0000,,And somebody made a bright thought. Dialogue: 0,0:14:44.27,0:14:46.16,Default,,0000,0000,0000,,Somebody had a bright thought that Dialogue: 0,0:14:47.45,0:14:50.44,Default,,0000,0000,0000,,"We don't have to do the link separately anymore." Dialogue: 0,0:14:51.04,0:14:54.38,Default,,0000,0000,0000,,"We can do the link at the same time we load." Dialogue: 0,0:14:54.42,0:14:56.58,Default,,0000,0000,0000,,Anybody remember the ActiveX? Dialogue: 0,0:14:56.62,0:14:58.95,Default,,0000,0000,0000,,Anybody remember OLE? Dialogue: 0,0:14:59.55,0:15:01.92,Default,,0000,0000,0000,,What does DLL stands for? Dialogue: 0,0:15:04.12,0:15:08.22,Default,,0000,0000,0000,,Dynamically linked library. Dialogue: 0,0:15:08.26,0:15:11.12,Default,,0000,0000,0000,,Which means it's linked at load time. Dialogue: 0,0:15:11.15,0:15:14.82,Default,,0000,0000,0000,,The link step got moved back into the loader. Dialogue: 0,0:15:15.70,0:15:19.20,Default,,0000,0000,0000,,And we have the situation we have today. Dialogue: 0,0:15:20.76,0:15:22.62,Default,,0000,0000,0000,,Who's .NET programmer, here? Dialogue: 0,0:15:23.67,0:15:25.04,Default,,0000,0000,0000,,Look at that. A lot of people. Dialogue: 0,0:15:25.07,0:15:28.12,Default,,0000,0000,0000,,Java programmer! Raise your hands. Dialogue: 0,0:15:28.19,0:15:29.95,Default,,0000,0000,0000,,Not so many. How come? Dialogue: 0,0:15:31.00,0:15:35.31,Default,,0000,0000,0000,,How come it's all .NET? Oh maybe because it's a .NET kind of conference? Huh? Dialogue: 0,0:15:36.03,0:15:41.84,Default,,0000,0000,0000,,So, in .NET you got DLLs. Dialogue: 0,0:15:41.87,0:15:43.73,Default,,0000,0000,0000,,Dynamically Linked Libraries. Dialogue: 0,0:15:43.76,0:15:45.92,Default,,0000,0000,0000,,In Java, you got Jar files. Dialogue: 0,0:15:45.97,0:15:50.94,Default,,0000,0000,0000,,But they are still dynamically linked libraries. Same idea. Same purpose. Dialogue: 0,0:15:51.78,0:15:56.06,Default,,0000,0000,0000,,In C++, if you do in the Microsoft thing you still got DLLs. Dialogue: 0,0:15:56.09,0:15:58.85,Default,,0000,0000,0000,,If you don in UNIX thing you've got shared libraries. Dialogue: 0,0:15:58.85,0:16:01.03,Default,,0000,0000,0000,,They are still dynamically linked libraries. Dialogue: 0,0:16:01.08,0:16:05.13,Default,,0000,0000,0000,,Our mode of operation now a days is too dynamic linked libraries. Dialogue: 0,0:16:05.16,0:16:07.87,Default,,0000,0000,0000,,That's how we got here. Dialogue: 0,0:16:11.98,0:16:13.63,Default,,0000,0000,0000,,How many DLLs do you have? Dialogue: 0,0:16:15.34,0:16:18.58,Default,,0000,0000,0000,,Guys with the solutions, Visual Studio solutions. Dialogue: 0,0:16:18.61,0:16:20.42,Default,,0000,0000,0000,,How many projects? Dialogue: 0,0:16:21.32,0:16:23.55,Default,,0000,0000,0000,,60? That's not bad. Dialogue: 0,0:16:23.55,0:16:25.02,Default,,0000,0000,0000,,Who's got more than 60? Dialogue: 0,0:16:25.06,0:16:26.60,Default,,0000,0000,0000,,Oh, look at that. Dialogue: 0,0:16:26.64,0:16:28.09,Default,,0000,0000,0000,,Who's got more than 200? Dialogue: 0,0:16:30.94,0:16:33.13,Default,,0000,0000,0000,,And do you know why? Dialogue: 0,0:16:33.22,0:16:38.06,Default,,0000,0000,0000,,You separate your code into different DLLs? Dialogue: 0,0:16:38.89,0:16:40.69,Default,,0000,0000,0000,,Let me ask that question differently. Dialogue: 0,0:16:41.27,0:16:43.62,Default,,0000,0000,0000,,When you deploy your application, Dialogue: 0,0:16:44.59,0:16:50.37,Default,,0000,0000,0000,,Do you gather up all the DLLs and just ship the wad? Dialogue: 0,0:16:52.52,0:16:57.68,Default,,0000,0000,0000,,If you do then why are you dynamically linking them? Dialogue: 0,0:16:57.73,0:16:59.40,Default,,0000,0000,0000,,Statically link them. Dialogue: 0,0:17:00.27,0:17:04.82,Default,,0000,0000,0000,,Why would you bother with dynamic linking? If you just gonna take all those DLLs. Dialogue: 0,0:17:04.89,0:17:07.26,Default,,0000,0000,0000,,Gather them up into one gigantic wad. Dialogue: 0,0:17:07.31,0:17:10.36,Default,,0000,0000,0000,,Throw the big wad into directory. And says, "It's my system." Dialogue: 0,0:17:11.100,0:17:16.86,Default,,0000,0000,0000,,Why dynamically link if you not going to dynamically deploy? Dialogue: 0,0:17:17.54,0:17:21.68,Default,,0000,0000,0000,,Why did we come up with dynamically linked library? Dialogue: 0,0:17:21.74,0:17:28.60,Default,,0000,0000,0000,,We came up with dynamically linked library so that we could dynamically deploy our applications. Dialogue: 0,0:17:29.09,0:17:30.16,Default,,0000,0000,0000,,Why? Dialogue: 0,0:17:32.57,0:17:35.63,Default,,0000,0000,0000,,Well, we gonna get to network speed. Hang on in a minute. Dialogue: 0,0:17:35.68,0:17:38.95,Default,,0000,0000,0000,,Cause network speed has huge impact on this all thing. Dialogue: 0,0:17:38.100,0:17:43.98,Default,,0000,0000,0000,,Mid 90s I've got a client. He's got a 250MB executable. Dialogue: 0,0:17:43.98,0:17:46.59,Default,,0000,0000,0000,,In the mid-90s that was big program. Now it' not. Dialogue: 0,0:17:47.27,0:17:51.73,Default,,0000,0000,0000,,But then 250MB was big deal, you could not fit it on a CD. Dialogue: 0,0:17:52.25,0:17:57.13,Default,,0000,0000,0000,,This was CAD system. He shipped it to the company like Ford. Dialogue: 0,0:17:57.13,0:18:01.55,Default,,0000,0000,0000,,Ford would use it to design gears and levers. Stuff like that. Dialogue: 0,0:18:02.88,0:18:04.33,Default,,0000,0000,0000,,He statically linked it. Dialogue: 0,0:18:05.04,0:18:11.21,Default,,0000,0000,0000,,He would deploy the executable to his clients by burning it on several CDs. Dialogue: 0,0:18:11.84,0:18:15.11,Default,,0000,0000,0000,,If he changed one line of code, Dialogue: 0,0:18:16.78,0:18:26.42,Default,,0000,0000,0000,,He had to recompile, re-link, re-burn all the CDs and deploy all the CDs to all his clients. Dialogue: 0,0:18:27.24,0:18:29.76,Default,,0000,0000,0000,,And you can imagine how it cost him a fair bit of money. Dialogue: 0,0:18:31.98,0:18:34.19,Default,,0000,0000,0000,,I went there in the mid-90s. Dialogue: 0,0:18:34.25,0:18:36.62,Default,,0000,0000,0000,,And encountered them at a time Dialogue: 0,0:18:36.66,0:18:44.00,Default,,0000,0000,0000,,when they were trying to chop up their executable into this new Idea, DLLs. Dialogue: 0,0:18:44.26,0:18:48.90,Default,,0000,0000,0000,,Because they realized that if they had dynamically linked libraries Dialogue: 0,0:18:48.90,0:18:52.17,Default,,0000,0000,0000,,Then they could change a line of code Dialogue: 0,0:18:52.20,0:18:56.74,Default,,0000,0000,0000,,And ideally you would only have to ship that DLL. Dialogue: 0,0:18:57.54,0:19:01.12,Default,,0000,0000,0000,,You could e-mail it!. Back in those days that was a big deal. Dialogue: 0,0:19:01.17,0:19:03.37,Default,,0000,0000,0000,,You couldn't e-mail 250MB in those days. Dialogue: 0,0:19:03.44,0:19:07.63,Default,,0000,0000,0000,,Now a days you can as long as the guy you're talking to got a reasonable e-mail server. Dialogue: 0,0:19:07.70,0:19:17.17,Default,,0000,0000,0000,,But back in those days e-mailing 250MB was impossible, so they could e-mail the 100KB of DLL. Dialogue: 0,0:19:17.22,0:19:20.06,Default,,0000,0000,0000,,And so that was very very desirable for them. Dialogue: 0,0:19:20.06,0:19:22.16,Default,,0000,0000,0000,,They worked for month and month and month. Dialogue: 0,0:19:22.19,0:19:24.97,Default,,0000,0000,0000,,Chopping their application up in the little tiny bits, Dialogue: 0,0:19:25.01,0:19:26.93,Default,,0000,0000,0000,,turning them all into bunch of DLLs Dialogue: 0,0:19:27.02,0:19:29.46,Default,,0000,0000,0000,,And that when they realized their critical mistake. Dialogue: 0,0:19:30.56,0:19:35.47,Default,,0000,0000,0000,,The critical mistake was that chopping your system up into bunch of arbitrary DLLs Dialogue: 0,0:19:35.47,0:19:39.29,Default,,0000,0000,0000,,doesn’t do you a damn bit of good if they all depend on each other. Dialogue: 0,0:19:40.19,0:19:42.74,Default,,0000,0000,0000,,If they are all depend on each other then you can... Dialogue: 0,0:19:51.83,0:19:56.00,Default,,0000,0000,0000,,Was anybody just in Scott Meyer's talk here? Dialogue: 0,0:19:56.09,0:19:58.43,Default,,0000,0000,0000,,The last talk he just gave an hour ago? Dialogue: 0,0:19:58.47,0:20:01.08,Default,,0000,0000,0000,,He was talking about the problem of keyholes. Dialogue: 0,0:20:01.13,0:20:07.85,Default,,0000,0000,0000,,Problem of keyholes is that we arbitrarily constrain someone for no good reason. Dialogue: 0,0:20:07.89,0:20:09.81,Default,,0000,0000,0000,,Just arbitrary constrain them. Dialogue: 0,0:20:09.85,0:20:14.52,Default,,0000,0000,0000,,So for example, have you ever seen a text box on a GUI? Dialogue: 0,0:20:14.57,0:20:16.45,Default,,0000,0000,0000,,That was just too short? Dialogue: 0,0:20:16.52,0:20:21.87,Default,,0000,0000,0000,,And you had typed bunch of stuffs in it and it wouldn't let you resize the window? Dialogue: 0,0:20:21.87,0:20:25.88,Default,,0000,0000,0000,,It wouldn't let you scroll and you just had to type blind? Dialogue: 0,0:20:25.93,0:20:29.60,Default,,0000,0000,0000,,Or maybe the text with scroll but you wouldn't be able to see the beginning of it? Dialogue: 0,0:20:29.66,0:20:34.73,Default,,0000,0000,0000,,He was mentioning the keyhole problem. Dialogue: 0,0:20:34.80,0:20:38.27,Default,,0000,0000,0000,,And I know that something just happened here. Dialogue: 0,0:20:39.09,0:20:43.36,Default,,0000,0000,0000,,Apparently I'm not allowed not touch my computer for more than 5 minutes. Dialogue: 0,0:20:43.41,0:20:48.04,Default,,0000,0000,0000,,I must apparently touch my computer otherwise I'll be punished. Dialogue: 0,0:20:52.04,0:20:54.51,Default,,0000,0000,0000,,What was I talking about? Oh yeah, DLLs. Dialogue: 0,0:20:54.51,0:20:58.22,Default,,0000,0000,0000,,So this guy, he put all his DLLs together. Dialogue: 0,0:20:58.28,0:21:00.50,Default,,0000,0000,0000,,He forgot that DLLs depend upon each other. Dialogue: 0,0:21:00.53,0:21:04.39,Default,,0000,0000,0000,,His goal was to be able to touch a line of code Dialogue: 0,0:21:04.42,0:21:07.75,Default,,0000,0000,0000,,And just ship that DLL that was affected. Dialogue: 0,0:21:07.82,0:21:12.39,Default,,0000,0000,0000,,But he found that all the '#includes', C++ guys know what I'm talking about Dialogue: 0,0:21:12.45,0:21:15.31,Default,,0000,0000,0000,,All the '#includes' form the horrible network. Dialogue: 0,0:21:15.36,0:21:18.15,Default,,0000,0000,0000,,And he had to recompile and redeploy everything anyway. Dialogue: 0,0:21:18.22,0:21:19.68,Default,,0000,0000,0000,,They went out of business. Dialogue: 0,0:21:22.67,0:21:27.81,Default,,0000,0000,0000,,The purpose of my talk today, now that I'm getting around to it Dialogue: 0,0:21:29.35,0:21:31.34,Default,,0000,0000,0000,,is to talk about components. Dialogue: 0,0:21:31.38,0:21:33.41,Default,,0000,0000,0000,,The problem of component design. Dialogue: 0,0:21:33.48,0:21:36.17,Default,,0000,0000,0000,,And the first thing we gonna do is to define a component. Dialogue: 0,0:21:36.21,0:21:38.66,Default,,0000,0000,0000,,What's a component? Component is DLL. Dialogue: 0,0:21:39.48,0:21:42.53,Default,,0000,0000,0000,,When I talk about the word component what I mean is DLL. Dialogue: 0,0:21:42.56,0:21:47.00,Default,,0000,0000,0000,,Very particular kind of DLL. A dynamically deployable DLL. Dialogue: 0,0:21:49.18,0:21:52.57,Default,,0000,0000,0000,,A dynamically deployable DLL. Dialogue: 0,0:21:53.47,0:21:55.93,Default,,0000,0000,0000,,Why would we want dynamically deploy? Dialogue: 0,0:21:56.82,0:21:59.88,Default,,0000,0000,0000,,Well, because we would like to be able to change one line of code Dialogue: 0,0:21:59.93,0:22:03.11,Default,,0000,0000,0000,,Just ship the one DLL that changed and ignore all the others. Dialogue: 0,0:22:03.16,0:22:05.40,Default,,0000,0000,0000,,What's DLL hell? Dialogue: 0,0:22:05.45,0:22:09.27,Default,,0000,0000,0000,,A term invented, I believe, by Microsoft Dialogue: 0,0:22:10.14,0:22:12.44,Default,,0000,0000,0000,,to describe their own situation. Dialogue: 0,0:22:12.51,0:22:17.51,Default,,0000,0000,0000,,And was to be completely cured by .NET. Dialogue: 0,0:22:17.54,0:22:22.18,Default,,0000,0000,0000,,Anybody remember that line? "Dear .NET cures DLL hell." Dialogue: 0,0:22:22.18,0:22:27.53,Default,,0000,0000,0000,,Hu Hu Hu. No, it doesn’t cure DLL hell. Dialogue: 0,0:22:27.54,0:22:32.28,Default,,0000,0000,0000,,DLL hell is the problem that we've got all these little components with different version numbers Dialogue: 0,0:22:32.28,0:22:35.08,Default,,0000,0000,0000,,And nobody hell knows which one go should together Dialogue: 0,0:22:35.15,0:22:38.67,Default,,0000,0000,0000,,So we invented this module maintenance tools like Maven. Dialogue: 0,0:22:38.74,0:22:40.64,Default,,0000,0000,0000,,What are you guys using in .NET? Dialogue: 0,0:22:41.18,0:22:45.92,Default,,0000,0000,0000,,What's the tool that lets you keep all of your DLLs are in line. Dialogue: 0,0:22:45.97,0:22:50.14,Default,,0000,0000,0000,,So you know that download version 1 of that one and version 3 of that one. Dialogue: 0,0:22:50.18,0:22:52.71,Default,,0000,0000,0000,,Do you have tool for that? What? Dialogue: 0,0:22:53.96,0:22:54.96,Default,,0000,0000,0000,,NuGet? Dialogue: 0,0:22:54.96,0:22:56.85,Default,,0000,0000,0000,,Like the soft chewy (??) Dialogue: 0,0:22:58.94,0:23:00.72,Default,,0000,0000,0000,,Never mind, I'm not going there. Dialogue: 0,0:23:09.77,0:23:17.99,Default,,0000,0000,0000,,The graph you see on the screen is a graph of x^2. Dialogue: 0,0:23:18.48,0:23:20.37,Default,,0000,0000,0000,,That's just an x^2 graph. Dialogue: 0,0:23:21.24,0:23:23.10,Default,,0000,0000,0000,,But it's also something else. Dialogue: 0,0:23:23.13,0:23:29.19,Default,,0000,0000,0000,,It's the number of dependencies in a system. Dialogue: 0,0:23:29.28,0:23:33.75,Default,,0000,0000,0000,,Theoretical maximum number of dependencies, given a certain number of modules. Dialogue: 0,0:23:33.80,0:23:38.21,Default,,0000,0000,0000,,And you can see that the number of modules increases linearly Dialogue: 0,0:23:38.26,0:23:40.97,Default,,0000,0000,0000,,And the number of dependency increases with square. Dialogue: 0,0:23:44.47,0:23:48.70,Default,,0000,0000,0000,,The theoretical maximum number of coupling, which I show here Dialogue: 0,0:23:50.59,0:23:54.75,Default,,0000,0000,0000,,is proportional to the square of the number of modules. Dialogue: 0,0:23:54.79,0:24:01.28,Default,,0000,0000,0000,,Now of course we would never create a system that has every possible dependency in it. Dialogue: 0,0:24:02.58,0:24:03.73,Default,,0000,0000,0000,,Or would we? Dialogue: 0,0:24:06.36,0:24:08.21,Default,,0000,0000,0000,,Look at this curve. Dialogue: 0,0:24:09.18,0:24:19.90,Default,,0000,0000,0000,,This curve is the productivity of a team in comparison to the number of modules. Dialogue: 0,0:24:19.90,0:24:24.95,Default,,0000,0000,0000,,By the way this is completely arbitrary I just generated one of x squared curve here. Dialogue: 0,0:24:25.39,0:24:28.17,Default,,0000,0000,0000,,This is not me collecting actual data. Dialogue: 0,0:24:28.94,0:24:34.20,Default,,0000,0000,0000,,This is just me recollecting my experience with development teams. Dialogue: 0,0:24:34.20,0:24:38.00,Default,,0000,0000,0000,,They go slower and slower and slower over time. Dialogue: 0,0:24:38.04,0:24:39.50,Default,,0000,0000,0000,,Who's had this happened to them? Dialogue: 0,0:24:39.53,0:24:42.37,Default,,0000,0000,0000,,You start outgoing really fast. You can conquer the world. Dialogue: 0,0:24:42.42,0:24:45.92,Default,,0000,0000,0000,,A year later you slogging through some kind of horrible wet lands. Dialogue: 0,0:24:46.37,0:24:48.66,Default,,0000,0000,0000,,And you don't know what the heck has gone wrong. Dialogue: 0,0:24:48.72,0:24:52.94,Default,,0000,0000,0000,,But estimates that used to be on the order of one week are now three month long. Dialogue: 0,0:24:53.38,0:24:58.14,Default,,0000,0000,0000,,And by the way you blow all those estimates anyway and introduces more bugs than you fix. Dialogue: 0,0:24:58.21,0:25:04.44,Default,,0000,0000,0000,,That's the kind of problem that we have as we proceed a long development path. Dialogue: 0,0:25:04.48,0:25:09.83,Default,,0000,0000,0000,,And one of the reasons for that is accumulation of dependencies. Dialogue: 0,0:25:10.57,0:25:11.52,Default,,0000,0000,0000,,Why? Dialogue: 0,0:25:11.84,0:25:20.78,Default,,0000,0000,0000,,Well, that's the theoretical maximum dependency between modules. Dialogue: 0,0:25:20.82,0:25:22.85,Default,,0000,0000,0000,,This is the theoretical minimum. Dialogue: 0,0:25:23.17,0:25:28.91,Default,,0000,0000,0000,,If you're going to have an interconnected set of modules, there has to be some dependencies. Dialogue: 0,0:25:28.97,0:25:32.23,Default,,0000,0000,0000,,And the minimum set of dependencies is a tree structure. Dialogue: 0,0:25:32.23,0:25:35.62,Default,,0000,0000,0000,,Oh you can do some better with dynamically linking if you want to. Dialogue: 0,0:25:35.62,0:25:39.53,Default,,0000,0000,0000,,But for the most part, you gonna have a small number of dependencies. Dialogue: 0,0:25:39.57,0:25:42.27,Default,,0000,0000,0000,,How many do we have? 1. 2. 3. 4. 5. 6. Dialogue: 0,0:25:42.27,0:25:44.59,Default,,0000,0000,0000,,6 out of 7 modules. Dialogue: 0,0:25:44.63,0:25:46.66,Default,,0000,0000,0000,,Whereas here you've got Dialogue: 0,0:25:46.66,0:25:50.57,Default,,0000,0000,0000,,Well, I think that's half of 49. Dialogue: 0,0:25:50.57,0:25:54.20,Default,,0000,0000,0000,,It can't be half of 49 because that would be happy half dependency. Dialogue: 0,0:25:54.26,0:25:58.26,Default,,0000,0000,0000,,Maybe it's just a plain 49. I don't know what it is. It's a large number. Dialogue: 0,0:25:58.35,0:26:01.07,Default,,0000,0000,0000,,It's some relative of N squared. Dialogue: 0,0:26:01.13,0:26:03.28,Default,,0000,0000,0000,,Maybe it's one half n squared plus one half n. Dialogue: 0,0:26:03.36,0:26:04.89,Default,,0000,0000,0000,,Something like that. Dialogue: 0,0:26:04.92,0:26:07.86,Default,,0000,0000,0000,,It's a very large number of dependencies. Dialogue: 0,0:26:07.89,0:26:10.91,Default,,0000,0000,0000,,We don't want this. We do want that. Dialogue: 0,0:26:10.97,0:26:13.13,Default,,0000,0000,0000,,We strive very hard to get here. Dialogue: 0,0:26:13.17,0:26:21.09,Default,,0000,0000,0000,,But then, some shmuck does that. Dialogue: 0,0:26:24.11,0:26:26.01,Default,,0000,0000,0000,,Visual Studio doesn't allow this. Dialogue: 0,0:26:27.01,0:26:28.51,Default,,0000,0000,0000,,Uh! Inside solution. Dialogue: 0,0:26:29.03,0:26:34.19,Default,,0000,0000,0000,,Inside solution. The DLLs cannot have cycles between their graphs. Dialogue: 0,0:26:34.24,0:26:35.02,Default,,0000,0000,0000,,That's good. Dialogue: 0,0:26:35.09,0:26:36.00,Default,,0000,0000,0000,,Don't want cycles. Dialogue: 0,0:26:36.47,0:26:38.74,Default,,0000,0000,0000,,Between separate solutions there's no guarantee. Dialogue: 0,0:26:38.78,0:26:40.36,Default,,0000,0000,0000,,So you have multiple solutions. Dialogue: 0,0:26:40.41,0:26:45.27,Default,,0000,0000,0000,,If you're linking with things that come out of different solutions, you can still have cycles in the graph. Dialogue: 0,0:26:45.30,0:26:50.77,Default,,0000,0000,0000,,If you get cycles in the graph, it looks like it adds only one extra dependency. Dialogue: 0,0:26:51.38,0:26:52.78,Default,,0000,0000,0000,,But actually it adds more. Dialogue: 0,0:26:52.82,0:26:57.30,Default,,0000,0000,0000,,Because 6 now depends upon 2. Because 1 depends upon 2. Dialogue: 0,0:26:57.37,0:26:59.14,Default,,0000,0000,0000,,And dependency is transitive. Dialogue: 0,0:26:59.23,0:27:04.57,Default,,0000,0000,0000,,So 6 also depends upon 4 and 5. And 6 depends upon 3 and 7. Dialogue: 0,0:27:04.77,0:27:06.85,Default,,0000,0000,0000,,In fact, 6 depends upon all of them. Dialogue: 0,0:27:07.56,0:27:13.92,Default,,0000,0000,0000,,So number of dependencies multiplies dramatically as soon as you have a cycle. Dialogue: 0,0:27:21.94,0:27:23.73,Default,,0000,0000,0000,,This is the n squared graph again. Dialogue: 0,0:27:25.09,0:27:28.69,Default,,0000,0000,0000,,This is also a graph of C++ compile time. Dialogue: 0,0:27:28.76,0:27:31.25,Default,,0000,0000,0000,,As you add modules. Dialogue: 0,0:27:31.35,0:27:34.10,Default,,0000,0000,0000,,Compile time and the link time if you're doing static linking Dialogue: 0,0:27:34.10,0:27:35.74,Default,,0000,0000,0000,,But even if you're not static linking, Dialogue: 0,0:27:35.79,0:27:39.88,Default,,0000,0000,0000,,just compile time grows with the square of the number of modules, Dialogue: 0,0:27:39.94,0:27:44.67,Default,,0000,0000,0000,,if you have a fully connected network of modules. Dialogue: 0,0:27:44.74,0:27:52.24,Default,,0000,0000,0000,,What that mean is that your '#include' or your import statements or your using statements can be traced in a cycle. Dialogue: 0,0:27:53.12,0:27:58.56,Default,,0000,0000,0000,,And if you have that, then you gonna wind up with this big increase in compile time. Dialogue: 0,0:27:58.59,0:28:00.86,Default,,0000,0000,0000,,C++ in particular would do this. Dialogue: 0,0:28:00.95,0:28:02.66,Default,,0000,0000,0000,,Java and .NET don't. Dialogue: 0,0:28:03.92,0:28:06.24,Default,,0000,0000,0000,,Their compile time is based on a different metric. Dialogue: 0,0:28:06.24,0:28:12.05,Default,,0000,0000,0000,,They don't go reading source files. The way C++ does. Dialogue: 0,0:28:12.10,0:28:15.35,Default,,0000,0000,0000,,Java and .NET read binary files to get their declarations. Dialogue: 0,0:28:15.38,0:28:18.57,Default,,0000,0000,0000,,C++ reads source files to get his declarations. Dialogue: 0,0:28:18.62,0:28:23.78,Default,,0000,0000,0000,,And so if you had a cycle in C++, you got punished. Dialogue: 0,0:28:25.28,0:28:27.06,Default,,0000,0000,0000,,By a big compile time. Dialogue: 0,0:28:27.12,0:28:28.83,Default,,0000,0000,0000,,And a massive one. Dialogue: 0,0:28:28.90,0:28:30.24,Default,,0000,0000,0000,,It would go up with square. Dialogue: 0,0:28:30.29,0:28:33.04,Default,,0000,0000,0000,,So you would had couple of modules your compile time will double. Dialogue: 0,0:28:33.04,0:28:35.56,Default,,0000,0000,0000,,And that made us do something about it. Dialogue: 0,0:28:36.19,0:28:38.80,Default,,0000,0000,0000,,Who knows who Ward Cunningham is? Dialogue: 0,0:28:39.55,0:28:40.46,Default,,0000,0000,0000,,Oh, a few of you do. Dialogue: 0,0:28:40.49,0:28:41.96,Default,,0000,0000,0000,,Good. And the rest of you. Dialogue: 0,0:28:42.01,0:28:43.39,Default,,0000,0000,0000,,He's the guy who invented Wikis. Dialogue: 0,0:28:43.46,0:28:46.58,Default,,0000,0000,0000,,Ward Cunningham invented Wikis. Dialogue: 0,0:28:46.62,0:28:51.55,Default,,0000,0000,0000,,He's the guy who helped Kent Beck invent pair programming, test-driven development, Dialogue: 0,0:28:51.64,0:28:53.16,Default,,0000,0000,0000,,And most of the agile stuff. Dialogue: 0,0:28:53.21,0:28:57.02,Default,,0000,0000,0000,,Get to know who Ward Cunningham. He is very interesting fellow. Dialogue: 0,0:28:57.05,0:28:58.83,Default,,0000,0000,0000,,Smalltalk Programmer from a long ago. Dialogue: 0,0:28:58.88,0:29:00.63,Default,,0000,0000,0000,,And I asked Ward once. Dialogue: 0,0:29:00.69,0:29:03.30,Default,,0000,0000,0000,,"Why did Smalltalk died, Ward?" Dialogue: 0,0:29:03.37,0:29:10.08,Default,,0000,0000,0000,,And he said, "Smalltalk died because it was so easy to make a mess." Dialogue: 0,0:29:10.83,0:29:12.81,Default,,0000,0000,0000,,"You, C++ programmer,” Dialogue: 0,0:29:12.85,0:29:14.38,Default,,0000,0000,0000,,I was a C++ programmer at that time. Dialogue: 0,0:29:14.46,0:29:16.68,Default,,0000,0000,0000,,"You, C++ programmers are lucky." Dialogue: 0,0:29:16.73,0:29:19.47,Default,,0000,0000,0000,,"Your language punishes you if make a mess." Dialogue: 0,0:29:19.96,0:29:21.83,Default,,0000,0000,0000,,"Smalltalk didn't punish you." Dialogue: 0,0:29:23.42,0:29:26.52,Default,,0000,0000,0000,,Well, neither does Java. Neither does C#. Dialogue: 0,0:29:26.96,0:29:28.50,Default,,0000,0000,0000,,They don't punish you anymore. Dialogue: 0,0:29:28.57,0:29:30.100,Default,,0000,0000,0000,,It's very easy to make a very large mess. Dialogue: 0,0:29:31.37,0:29:34.88,Default,,0000,0000,0000,,And get a very tangled structure and not know you're doing it. Dialogue: 0,0:29:34.91,0:29:38.96,Default,,0000,0000,0000,,Fortunately Visual Studio keeps some of the cycles out of your graph. Dialogue: 0,0:29:44.17,0:29:49.04,Default,,0000,0000,0000,,We would like that level of productivity, which is n Log N. Dialogue: 0,0:29:49.11,0:29:52.38,Default,,0000,0000,0000,,Rather than this level of productivity. That's an n squared. Dialogue: 0,0:29:52.78,0:29:59.68,Default,,0000,0000,0000,,And one of the ways to help with that is to manage the dependencies between our components. Dialogue: 0,0:30:01.75,0:30:06.97,Default,,0000,0000,0000,,Then something happened to us in the late 90s and into the 2000s. Dialogue: 0,0:30:06.97,0:30:10.14,Default,,0000,0000,0000,,Network speed started increasing dramatically. Dialogue: 0,0:30:10.64,0:30:15.79,Default,,0000,0000,0000,,Now a days, it's not hard at all to download a GB in a couple of seconds, Dialogue: 0,0:30:15.87,0:30:17.66,Default,,0000,0000,0000,,And to upload a GB in 10 seconds. Dialogue: 0,0:30:17.73,0:30:19.34,Default,,0000,0000,0000,,That's pretty easy now a days. Dialogue: 0,0:30:19.39,0:30:21.71,Default,,0000,0000,0000,,Back in the early days it was much harder. Dialogue: 0,0:30:22.03,0:30:28.32,Default,,0000,0000,0000,,So, back in the early days we thought shipping individual DLL was going to be a benefit. Dialogue: 0,0:30:28.54,0:30:31.94,Default,,0000,0000,0000,,Now a days we just kind of gather them all together and ship the one big wad. Dialogue: 0,0:30:32.24,0:30:35.84,Default,,0000,0000,0000,,Why? Well because network speed is fast enough. We can do it. Dialogue: 0,0:30:35.84,0:30:40.31,Default,,0000,0000,0000,,We can treat our batch of DLLs just like it was statically linked. Dialogue: 0,0:30:41.66,0:30:43.21,Default,,0000,0000,0000,,But there's another issue. Dialogue: 0,0:30:44.22,0:30:45.74,Default,,0000,0000,0000,,How many of you work in teams? Dialogue: 0,0:30:47.25,0:30:49.51,Default,,0000,0000,0000,,Oh look at that. Everybody works in teams. Dialogue: 0,0:30:50.55,0:30:54.42,Default,,0000,0000,0000,,So, you come in at 8 in the morning. Dialogue: 0,0:30:55.88,0:30:59.28,Default,,0000,0000,0000,,You got a test to perform. Dialogue: 0,0:30:59.35,0:31:02.37,Default,,0000,0000,0000,,You work all day to get all your stuff working. Dialogue: 0,0:31:02.49,0:31:03.73,Default,,0000,0000,0000,,All works by end of the day. Dialogue: 0,0:31:03.77,0:31:04.91,Default,,0000,0000,0000,,You check it in and go home. Dialogue: 0,0:31:04.96,0:31:07.27,Default,,0000,0000,0000,,Come back the next day all your stuff is broken. Dialogue: 0,0:31:07.33,0:31:08.09,Default,,0000,0000,0000,,Why? Dialogue: 0,0:31:09.77,0:31:12.40,Default,,0000,0000,0000,,Somebody stayed later than you. Dialogue: 0,0:31:13.45,0:31:15.84,Default,,0000,0000,0000,,And changed something you depend upon. Dialogue: 0,0:31:16.63,0:31:21.77,Default,,0000,0000,0000,,And so you work all day long to fix whatever the problem was. Dialogue: 0,0:31:21.77,0:31:24.41,Default,,0000,0000,0000,,You go home and come back the next day and your stuff is broken again. Dialogue: 0,0:31:24.52,0:31:26.39,Default,,0000,0000,0000,,How many times can you go around that loop? Dialogue: 0,0:31:27.40,0:31:30.94,Default,,0000,0000,0000,,Lots of time. This is a problem of large teams. Dialogue: 0,0:31:31.05,0:31:34.66,Default,,0000,0000,0000,,Large teams will start to step on each other. Dialogue: 0,0:31:34.74,0:31:36.86,Default,,0000,0000,0000,,And of course we've invented tools to help us. Dialogue: 0,0:31:36.86,0:31:38.92,Default,,0000,0000,0000,,We've got source code control systems. Dialogue: 0,0:31:38.92,0:31:41.56,Default,,0000,0000,0000,,And we've got all kinds of good stuff to help us with this. Dialogue: 0,0:31:41.80,0:31:47.40,Default,,0000,0000,0000,,But we still can step all over each other, unless we manage our projects well. Dialogue: 0,0:31:47.81,0:31:52.41,Default,,0000,0000,0000,,So, how can we manage our projects well? Dialogue: 0,0:31:55.95,0:31:57.74,Default,,0000,0000,0000,,There is a principle. Dialogue: 0,0:32:06.67,0:32:10.85,Default,,0000,0000,0000,,A principle called Acyclic Dependencies Principle. Dialogue: 0,0:32:13.19,0:32:18.58,Default,,0000,0000,0000,,The Acyclic dependencies principle says, "If you have a set of components" Dialogue: 0,0:32:18.62,0:32:22.76,Default,,0000,0000,0000,,"You would like to be able to arrange without any cycles in the dependency graph." Dialogue: 0,0:32:22.85,0:32:25.96,Default,,0000,0000,0000,,Now, for whole bunch of reasons we've already talked about one of them. Dialogue: 0,0:32:26.02,0:32:30.40,Default,,0000,0000,0000,,Which is compile time. We've talked about another which is just dependency load. Dialogue: 0,0:32:30.40,0:32:31.60,Default,,0000,0000,0000,,Here is another. Dialogue: 0,0:32:33.73,0:32:38.58,Default,,0000,0000,0000,,Alarm would like to release its version of alarm. Dialogue: 0,0:32:38.99,0:32:43.01,Default,,0000,0000,0000,,The team that's working on the Alarm would like to make release 1.0. Dialogue: 0,0:32:43.14,0:32:48.81,Default,,0000,0000,0000,,They've got nobody that they depend upon. Dialogue: 0,0:32:48.81,0:32:52.35,Default,,0000,0000,0000,,So they are completely free to make any release they want. Dialogue: 0,0:32:52.40,0:32:56.01,Default,,0000,0000,0000,,So they release their version of 1.0. Alarm 1.0. Dialogue: 0,0:32:56.01,0:32:58.01,Default,,0000,0000,0000,,They start working on alarm 1.1. Dialogue: 0,0:32:58.90,0:33:02.17,Default,,0000,0000,0000,,But now Alarm 1.0 has been released. Dialogue: 0,0:33:02.22,0:33:05.98,Default,,0000,0000,0000,,Which means that Elevator and Conveyor can make their release. Dialogue: 0,0:33:06.92,0:33:12.39,Default,,0000,0000,0000,,And once Elevator and Conveyor made their releases they can start to work on 1.1. Dialogue: 0,0:33:12.42,0:33:15.74,Default,,0000,0000,0000,,But now Transport can make its release. Dialogue: 0,0:33:15.78,0:33:17.76,Default,,0000,0000,0000,,You can see what's happening here. Right? Dialogue: 0,0:33:17.81,0:33:21.08,Default,,0000,0000,0000,,The version numbers bubble up from the bottom. Dialogue: 0,0:33:21.15,0:33:27.45,Default,,0000,0000,0000,,1.0 gets created here. Then there. Then there. Here. Here. And finally there. Dialogue: 0,0:33:27.50,0:33:30.02,Default,,0000,0000,0000,,The version numbers bubble up from the bottom. Dialogue: 0,0:33:30.05,0:33:32.63,Default,,0000,0000,0000,,If you look at it closely, you'll realize that Dialogue: 0,0:33:32.63,0:33:37.55,Default,,0000,0000,0000,,the version numbers follows exact same path as the build. The compile. Dialogue: 0,0:33:37.62,0:33:42.42,Default,,0000,0000,0000,,Dependencies are running in that direction. Dialogue: 0,0:33:43.32,0:33:50.36,Default,,0000,0000,0000,,And now, some poor shmuck does this. Dialogue: 0,0:33:50.45,0:33:52.60,Default,,0000,0000,0000,,Who's this? Dialogue: 0,0:33:52.70,0:33:54.19,Default,,0000,0000,0000,,Well that was me. I did that. Dialogue: 0,0:33:54.30,0:33:58.54,Default,,0000,0000,0000,,I had an alarm subsystem I was working on. Dialogue: 0,0:33:58.54,0:34:02.26,Default,,0000,0000,0000,,And I needed it to put a message on the display and the control panel. Dialogue: 0,0:34:02.33,0:34:06.96,Default,,0000,0000,0000,,There happened to be a class up here that had a function called Display. Dialogue: 0,0:34:06.96,0:34:10.02,Default,,0000,0000,0000,,And I thought, "Oh! I should just call it." So I called it. Dialogue: 0,0:34:10.02,0:34:13.32,Default,,0000,0000,0000,,This was not in a language that restrict me from cycles. Dialogue: 0,0:34:13.32,0:34:17.09,Default,,0000,0000,0000,,And so it compiled and everything was fine and all worked okay. Dialogue: 0,0:34:18.48,0:34:23.50,Default,,0000,0000,0000,,And then the next day I had a group of angry developers come to my cubicles with club Dialogue: 0,0:34:23.54,0:34:25.24,Default,,0000,0000,0000,,And tell me "What the hell did you do?" Dialogue: 0,0:34:25.65,0:34:32.59,Default,,0000,0000,0000,,I said, "Well, I just called the control panel and display class that has display function in it." Dialogue: 0,0:34:32.63,0:34:34.55,Default,,0000,0000,0000,,"I needed to put this message on the screen." Dialogue: 0,0:34:34.59,0:34:35.76,Default,,0000,0000,0000,,And they said, "You can't do that." Dialogue: 0,0:34:36.35,0:34:37.91,Default,,0000,0000,0000,,Why can't we do that? Dialogue: 0,0:34:39.78,0:34:41.17,Default,,0000,0000,0000,,First of all, Dialogue: 0,0:34:43.75,0:34:47.60,Default,,0000,0000,0000,,what order should we build those modules in? Dialogue: 0,0:34:49.89,0:34:52.74,Default,,0000,0000,0000,,You'd like to build them bottom up. Dialogue: 0,0:34:53.85,0:34:55.67,Default,,0000,0000,0000,,But now there's no bottom. Dialogue: 0,0:34:55.72,0:34:58.09,Default,,0000,0000,0000,,So there's no correct build order. Dialogue: 0,0:34:58.34,0:35:01.24,Default,,0000,0000,0000,,If you have cycles in the component graph, Dialogue: 0,0:35:01.61,0:35:06.48,Default,,0000,0000,0000,,there is no correct build order for the modules in that system. Dialogue: 0,0:35:06.52,0:35:11.14,Default,,0000,0000,0000,,And therefore the execution of that system is undefined. Dialogue: 0,0:35:11.68,0:35:14.99,Default,,0000,0000,0000,,What does undefined mean? What's the definition of undefined? Dialogue: 0,0:35:16.21,0:35:17.87,Default,,0000,0000,0000,,Works in the lab. Dialogue: 0,0:35:19.66,0:35:24.31,Default,,0000,0000,0000,,Anything undefined will work until you actually deploy it somewhere. Then it will fail. Dialogue: 0,0:35:25.44,0:35:29.01,Default,,0000,0000,0000,,You can get systems to fail rather badly by having this cycles. Dialogue: 0,0:35:29.04,0:35:30.94,Default,,0000,0000,0000,,This is pretty common in Java. Dialogue: 0,0:35:31.04,0:35:35.95,Default,,0000,0000,0000,,If you have a system of Java that has cycles in it. Dialogue: 0,0:35:35.95,0:35:37.06,Default,,0000,0000,0000,,You can build it. Dialogue: 0,0:35:37.09,0:35:39.02,Default,,0000,0000,0000,,Although there is no correct build order. Dialogue: 0,0:35:39.13,0:35:41.33,Default,,0000,0000,0000,,Then you run your test. And test will fail. Dialogue: 0,0:35:41.54,0:35:44.63,Default,,0000,0000,0000,,Then you build it again. That will choose different build order. Dialogue: 0,0:35:44.66,0:35:45.80,Default,,0000,0000,0000,,And maybe the test will pass. Dialogue: 0,0:35:45.86,0:35:49.17,Default,,0000,0000,0000,,I know of companies that put their build in a loop until test pass. Dialogue: 0,0:35:54.63,0:35:56.38,Default,,0000,0000,0000,,But the problem is worse than that. Dialogue: 0,0:35:56.92,0:36:03.66,Default,,0000,0000,0000,,Because conveyor would like to make their release. Dialogue: 0,0:36:03.69,0:36:05.88,Default,,0000,0000,0000,,They want to release 1.1. Dialogue: 0,0:36:05.91,0:36:11.09,Default,,0000,0000,0000,,Now for them to release 1.1, they have to test with alarm 1.1. Dialogue: 0,0:36:11.88,0:36:17.86,Default,,0000,0000,0000,,But alarm 1.1 is waiting for control panel 1.1, which is waiting for transport 1.1 Dialogue: 0,0:36:17.90,0:36:21.65,Default,,0000,0000,0000,,which is waiting for conveyor 1.1, which is the one trying to release. Dialogue: 0,0:36:21.65,0:36:27.73,Default,,0000,0000,0000,,So there's no way to make the release without checking all of that source code out into one place. Dialogue: 0,0:36:27.82,0:36:31.00,Default,,0000,0000,0000,,Integrating. Anybody remember integration. Dialogue: 0,0:36:31.04,0:36:32.30,Default,,0000,0000,0000,,The joys of integration. Dialogue: 0,0:36:32.35,0:36:37.13,Default,,0000,0000,0000,,Integrate the whole system and then make it work. Dialogue: 0,0:36:37.94,0:36:41.04,Default,,0000,0000,0000,,And while you're doing that you gonna be stepping all over each other. Dialogue: 0,0:36:41.35,0:36:49.58,Default,,0000,0000,0000,,So, if this cycle will bring back the problem of coming in 8 in the morning and find everything doesn't work. Dialogue: 0,0:36:50.16,0:36:52.10,Default,,0000,0000,0000,,But it's worse than that. Dialogue: 0,0:36:52.72,0:36:58.44,Default,,0000,0000,0000,,Because in order to test conveyor I need alarm. Dialogue: 0,0:36:58.47,0:37:02.41,Default,,0000,0000,0000,,Which needs control panel which needs revenue, which need the database. Dialogue: 0,0:37:02.50,0:37:06.25,Default,,0000,0000,0000,,The database takes 45 minutes to load and then it crashes. Dialogue: 0,0:37:06.53,0:37:08.97,Default,,0000,0000,0000,,I can't run my tests. Dialogue: 0,0:37:09.03,0:37:13.100,Default,,0000,0000,0000,,Ant the guys in conveyor saying, "Why the heck do I need the database?" Dialogue: 0,0:37:14.15,0:37:17.34,Default,,0000,0000,0000,,"Well, you need the database because of this strange dependency structure." Dialogue: 0,0:37:17.50,0:37:21.89,Default,,0000,0000,0000,,Anybody ever look at the number of DLLs that got loaded and scratch head and say, Dialogue: 0,0:37:21.89,0:37:23.81,Default,,0000,0000,0000,,"How come I need those?" Dialogue: 0,0:37:23.85,0:37:26.90,Default,,0000,0000,0000,,Anybody in C++ world have ever link line? Dialogue: 0,0:37:26.100,0:37:28.96,Default,,0000,0000,0000,,And wonder "what's all this stuff in the link line?" Dialogue: 0,0:37:29.00,0:37:30.53,Default,,0000,0000,0000,,"How come I need all that stuff?" Dialogue: 0,0:37:30.56,0:37:32.99,Default,,0000,0000,0000,,Right? You got cycles in the dependency graphs. Dialogue: 0,0:37:33.03,0:37:34.53,Default,,0000,0000,0000,,It's bringing in all kinds of gunk. Dialogue: 0,0:37:34.60,0:37:42.66,Default,,0000,0000,0000,,So the first principle of components is no cycles in the components. Dialogue: 0,0:37:42.70,0:37:45.06,Default,,0000,0000,0000,,What if you want to do this? Dialogue: 0,0:37:45.84,0:37:51.75,Default,,0000,0000,0000,,What if you really want to call some function from down here that lives up there? Dialogue: 0,0:37:51.75,0:37:53.11,Default,,0000,0000,0000,,How you gonna do it? Dialogue: 0,0:37:55.38,0:37:57.37,Default,,0000,0000,0000,,Well, you can put out another component. Dialogue: 0,0:37:58.45,0:37:59.87,Default,,0000,0000,0000,,That's one way to do it. Dialogue: 0,0:37:59.94,0:38:03.34,Default,,0000,0000,0000,,Here I took that class out of the control panel. Dialogue: 0,0:38:03.37,0:38:05.33,Default,,0000,0000,0000,,I put it in the display component. Dialogue: 0,0:38:05.33,0:38:07.96,Default,,0000,0000,0000,,Then the alarm component can talk to the display component. Dialogue: 0,0:38:07.96,0:38:10.26,Default,,0000,0000,0000,,The control panel can talk to the display component. Dialogue: 0,0:38:10.52,0:38:12.20,Default,,0000,0000,0000,,I can keep the cycles out. Dialogue: 0,0:38:12.26,0:38:14.24,Default,,0000,0000,0000,,That's common enough technique. Dialogue: 0,0:38:14.29,0:38:16.06,Default,,0000,0000,0000,,Remember, these are all DLLs. Dialogue: 0,0:38:16.11,0:38:23.03,Default,,0000,0000,0000,,So number of DLLs in your system will start to grow as people want to add cycles to the dependency graph. Dialogue: 0,0:38:23.09,0:38:24.60,Default,,0000,0000,0000,,Maybe. Dialogue: 0,0:38:25.02,0:38:28.36,Default,,0000,0000,0000,,Although there's another way to resolve the cycle. Dialogue: 0,0:38:30.44,0:38:33.08,Default,,0000,0000,0000,,You can use dependency inversion. Dialogue: 0,0:38:33.12,0:38:40.01,Default,,0000,0000,0000,,I could put an interface. A display interface. Dialogue: 0,0:38:40.06,0:38:42.28,Default,,0000,0000,0000,,In the alarm subsystem. Dialogue: 0,0:38:42.33,0:38:44.78,Default,,0000,0000,0000,,And have the control panel implemented it. Dialogue: 0,0:38:45.76,0:38:48.32,Default,,0000,0000,0000,,That turns the dependency around. Dialogue: 0,0:38:49.64,0:38:52.66,Default,,0000,0000,0000,,And changes a cycle into a straight tree. Dialogue: 0,0:38:59.79,0:39:01.32,Default,,0000,0000,0000,,What's OO? Dialogue: 0,0:39:04.01,0:39:06.27,Default,,0000,0000,0000,,What is Object Orientation? Dialogue: 0,0:39:08.80,0:39:10.47,Default,,0000,0000,0000,,Why do we like it? Dialogue: 0,0:39:10.54,0:39:14.94,Default,,0000,0000,0000,,How come all of our languages are object oriented languages? Dialogue: 0,0:39:14.94,0:39:16.88,Default,,0000,0000,0000,,We've been doing this for 30 years. We gotta know. Dialogue: 0,0:39:16.95,0:39:18.56,Default,,0000,0000,0000,,(Someone says) "Models the real world." Dialogue: 0,0:39:18.56,0:39:20.19,Default,,0000,0000,0000,,Models the real world! Thank you! Dialogue: 0,0:39:20.19,0:39:22.73,Default,,0000,0000,0000,,I planted him here so that he would say that. Dialogue: 0,0:39:22.73,0:39:24.92,Default,,0000,0000,0000,,So then I could rip him to shred. Dialogue: 0,0:39:24.97,0:39:26.85,Default,,0000,0000,0000,,No, that's absurd. Dialogue: 0,0:39:26.85,0:39:31.64,Default,,0000,0000,0000,,And that whole idea that OO has better way to model real world is plain non-sense. Dialogue: 0,0:39:31.71,0:39:35.37,Default,,0000,0000,0000,,It's something. Some guy concocted long time ago Dialogue: 0,0:39:35.45,0:39:39.48,Default,,0000,0000,0000,,To convince his manager to spend 12,000$ on C++ compiler. Dialogue: 0,0:39:39.51,0:39:42.09,Default,,0000,0000,0000,,Cause he couldn't figure out any other ways to get his manager to do it. Dialogue: 0,0:39:42.14,0:39:46.39,Default,,0000,0000,0000,,12,000$. Early C++ compiler costed a lot of money. Dialogue: 0,0:39:46.39,0:39:48.09,Default,,0000,0000,0000,,"12,000$. I'm not spending that for a compiler." Dialogue: 0,0:39:48.09,0:39:49.96,Default,,0000,0000,0000,,"Well, it will help me model the real world!" Dialogue: 0,0:39:49.96,0:39:53.09,Default,,0000,0000,0000,,"Oh. Okay then." Dialogue: 0,0:39:53.12,0:39:57.74,Default,,0000,0000,0000,,This whole notion of modeling the real world is downright silly. Dialogue: 0,0:39:57.77,0:40:04.56,Default,,0000,0000,0000,,What in the world is OO other than a bunch of functions using a bunch of data structure? Right? Dialogue: 0,0:40:04.56,0:40:06.82,Default,,0000,0000,0000,,Encapsulated. Okay fine. Encapsulated. Dialogue: 0,0:40:06.82,0:40:09.41,Default,,0000,0000,0000,,But bunch of functions using bunch of data structures. Dialogue: 0,0:40:09.41,0:40:11.59,Default,,0000,0000,0000,,How is that different from Non OO? Dialogue: 0,0:40:13.39,0:40:15.50,Default,,0000,0000,0000,,The answer to that is not easy to describe. Dialogue: 0,0:40:16.28,0:40:18.07,Default,,0000,0000,0000,,How that's different? Dialogue: 0,0:40:18.13,0:40:21.94,Default,,0000,0000,0000,,Well, okay. We kind of put the data structures in the functions together. Dialogue: 0,0:40:21.99,0:40:23.66,Default,,0000,0000,0000,,But we always used to do that. Dialogue: 0,0:40:24.16,0:40:26.81,Default,,0000,0000,0000,,Old C programmers used to that all the time. Dialogue: 0,0:40:27.06,0:40:29.96,Default,,0000,0000,0000,,Data structures in programs always went together. Dialogue: 0,0:40:29.96,0:40:33.59,Default,,0000,0000,0000,,There is a famous book called 'Algorithms plus data structures equals programs.' Dialogue: 0,0:40:34.29,0:40:36.53,Default,,0000,0000,0000,,Data structures now (??) working together. Dialogue: 0,0:40:36.58,0:40:39.29,Default,,0000,0000,0000,,So nothing really fancy about OO there. Dialogue: 0,0:40:39.29,0:40:43.75,Default,,0000,0000,0000,,There is one thing that OO gave us that we did not have before. Dialogue: 0,0:40:43.75,0:40:45.54,Default,,0000,0000,0000,,Because it wasn't safe. Dialogue: 0,0:40:45.60,0:40:47.27,Default,,0000,0000,0000,,And that's polymorphism. Dialogue: 0,0:40:47.30,0:40:50.99,Default,,0000,0000,0000,,Very very convenient polymorphism. Dialogue: 0,0:40:51.02,0:40:53.27,Default,,0000,0000,0000,,We used to have it in C. Dialogue: 0,0:40:53.92,0:40:57.90,Default,,0000,0000,0000,,Device independence in any operating system is an example of polymorphism. Dialogue: 0,0:40:57.95,0:41:02.79,Default,,0000,0000,0000,,If you can write a program, you don't need to know what device that program is gonna use. Dialogue: 0,0:41:02.86,0:41:04.84,Default,,0000,0000,0000,,It's a clearly polymorphic interface. Dialogue: 0,0:41:05.57,0:41:08.69,Default,,0000,0000,0000,,But that's dangerous in most languages. Dialogue: 0,0:41:08.76,0:41:10.47,Default,,0000,0000,0000,,Or it was back in those days. Dialogue: 0,0:41:10.47,0:41:12.26,Default,,0000,0000,0000,,Because you have to fiddle with pointers to functions. Dialogue: 0,0:41:12.26,0:41:13.53,Default,,0000,0000,0000,,And that was always dangerous. Dialogue: 0,0:41:14.64,0:41:18.56,Default,,0000,0000,0000,,What OO gave us was very very convenient polymorphism. Dialogue: 0,0:41:18.64,0:41:20.77,Default,,0000,0000,0000,,Polymorphism without thinking about it. Dialogue: 0,0:41:20.77,0:41:23.67,Default,,0000,0000,0000,,Java in particular all the methods are polymorphic. Dialogue: 0,0:41:23.67,0:41:25.11,Default,,0000,0000,0000,,There's no choice. Dialogue: 0,0:41:25.18,0:41:29.29,Default,,0000,0000,0000,,C#, you have choice. You can use that funny virtual keyword. Dialogue: 0,0:41:29.32,0:41:35.23,Default,,0000,0000,0000,,C++ programmers you've got a choice. You better use that virtual keyword. Especially on your destructors. Dialogue: 0,0:41:35.87,0:41:38.93,Default,,0000,0000,0000,,But most of us we don't even pay attention anymore. Dialogue: 0,0:41:38.93,0:41:42.01,Default,,0000,0000,0000,,All our functions are polymorphic. We don't even think about it. Dialogue: 0,0:41:42.06,0:41:42.94,Default,,0000,0000,0000,,Why? Dialogue: 0,0:41:44.17,0:41:49.38,Default,,0000,0000,0000,,Because when a function is polymorphic something amazing happens. Dialogue: 0,0:41:49.96,0:41:55.19,Default,,0000,0000,0000,,The flow of control goes down towards to derivatives. Dialogue: 0,0:41:55.24,0:41:59.15,Default,,0000,0000,0000,,But the source code dependency goes back towards base. Dialogue: 0,0:41:59.83,0:42:07.92,Default,,0000,0000,0000,,We can take a source code dependency and turn it around without changing the run time dependency. Dialogue: 0,0:42:07.92,0:42:10.11,Default,,0000,0000,0000,,How do you get DLLs? Dialogue: 0,0:42:10.11,0:42:11.87,Default,,0000,0000,0000,,How do you get components? Dialogue: 0,0:42:11.87,0:42:13.61,Default,,0000,0000,0000,,You isolate them. Dialogue: 0,0:42:13.61,0:42:16.95,Default,,0000,0000,0000,,But you have to maintain the run time dependency. Dialogue: 0,0:42:21.44,0:42:22.71,Default,,0000,0000,0000,,Visual Studio people Dialogue: 0,0:42:24.86,0:42:27.55,Default,,0000,0000,0000,,Are you using ReSharper? Dialogue: 0,0:42:28.53,0:42:30.06,Default,,0000,0000,0000,,Who is? ReSharper? Dialogue: 0,0:42:30.09,0:42:31.58,Default,,0000,0000,0000,,Look at that. Everybody. Dialogue: 0,0:42:32.82,0:42:35.61,Default,,0000,0000,0000,,Does Visual Studio know about ReSharper? Dialogue: 0,0:42:38.01,0:42:38.64,Default,,0000,0000,0000,,No. Dialogue: 0,0:42:38.72,0:42:42.34,Default,,0000,0000,0000,,Does Visual Studio call ReSharper? Dialogue: 0,0:42:43.46,0:42:44.72,Default,,0000,0000,0000,,Yes. Dialogue: 0,0:42:44.79,0:42:49.11,Default,,0000,0000,0000,,The flow of control goes from Visual Studio into ReSharper. Dialogue: 0,0:42:49.11,0:42:54.48,Default,,0000,0000,0000,,There are function calls in Visual Studio that their way into ReSharper. Dialogue: 0,0:42:54.48,0:43:00.69,Default,,0000,0000,0000,,But there is no source code dependency that moves from Visual Studio into ReSharper. Dialogue: 0,0:43:00.69,0:43:03.09,Default,,0000,0000,0000,,Because they've been inverted the dependencies. Dialogue: 0,0:43:04.02,0:43:09.91,Default,,0000,0000,0000,,You can create DLLs that your application will call. Dialogue: 0,0:43:09.94,0:43:12.50,Default,,0000,0000,0000,,But your application doesn't know it exist. Dialogue: 0,0:43:12.53,0:43:15.58,Default,,0000,0000,0000,,And you do that by inverting dependencies. Dialogue: 0,0:43:15.86,0:43:17.07,Default,,0000,0000,0000,,Turn them around. Dialogue: 0,0:43:17.16,0:43:19.28,Default,,0000,0000,0000,,So this is one nice way to do that. Dialogue: 0,0:43:19.65,0:43:28.94,Default,,0000,0000,0000,,Now the control panel is a plug-in to the alarm system. Dialogue: 0,0:43:29.02,0:43:31.59,Default,,0000,0000,0000,,The alarm system doesn't know the control panel exists. Dialogue: 0,0:43:31.59,0:43:35.76,Default,,0000,0000,0000,,The control panel is a plug-in. Dialogue: 0,0:43:35.81,0:43:38.61,Default,,0000,0000,0000,,And the alarm system would accept any kind of plug-in. Dialogue: 0,0:43:38.61,0:43:42.57,Default,,0000,0000,0000,,A lot of different things to do implement this display function here. Dialogue: 0,0:43:42.57,0:43:45.26,Default,,0000,0000,0000,,So we could have a lot of different things that we alarmed. Dialogue: 0,0:43:52.94,0:43:55.18,Default,,0000,0000,0000,,What would rather depend upon? Dialogue: 0,0:44:01.50,0:44:04.62,Default,,0000,0000,0000,,A component that was stable? Dialogue: 0,0:44:07.01,0:44:08.100,Default,,0000,0000,0000,,Or a component that was unstable? Dialogue: 0,0:44:10.78,0:44:12.14,Default,,0000,0000,0000,,Trick questions. Dialogue: 0,0:44:12.20,0:44:17.81,Default,,0000,0000,0000,,Right? Everybody knows that you want to depend on something that's stable. Dialogue: 0,0:44:22.58,0:44:25.28,Default,,0000,0000,0000,,But now let me define stability. Dialogue: 0,0:44:28.54,0:44:30.59,Default,,0000,0000,0000,,Is my laser stable? Dialogue: 0,0:44:34.33,0:44:36.27,Default,,0000,0000,0000,,It's not changing. Dialogue: 0,0:44:38.88,0:44:40.57,Default,,0000,0000,0000,,But is it stable? Dialogue: 0,0:44:40.61,0:44:43.67,Default,,0000,0000,0000,,Stability is not a Boolean. Dialogue: 0,0:44:43.73,0:44:46.33,Default,,0000,0000,0000,,Stability is a continuous variable. Dialogue: 0,0:44:46.38,0:44:50.61,Default,,0000,0000,0000,,And it is defined as the amount of work required to make a change. Dialogue: 0,0:44:50.66,0:44:53.40,Default,,0000,0000,0000,,If it takes a lot of work to make a change, it's stable. Dialogue: 0,0:44:53.43,0:44:56.25,Default,,0000,0000,0000,,If it takes very little work to make a change, it's unstable. Dialogue: 0,0:44:56.30,0:45:00.21,Default,,0000,0000,0000,,That is unstable. Dialogue: 0,0:45:00.28,0:45:03.77,Default,,0000,0000,0000,,Cause it doesn't take much work to make a change to its state. Dialogue: 0,0:45:03.82,0:45:08.63,Default,,0000,0000,0000,,This. Well I won't say that it's stable. Dialogue: 0,0:45:08.74,0:45:11.50,Default,,0000,0000,0000,,Cause it would take much work to upset it. Dialogue: 0,0:45:11.54,0:45:14.95,Default,,0000,0000,0000,,And this whole stage doesn't feel very stable to me. Dialogue: 0,0:45:15.78,0:45:18.94,Default,,0000,0000,0000,,So I may have to be careful about the way I move. Dialogue: 0,0:45:18.98,0:45:21.60,Default,,0000,0000,0000,,So let me ask the question again. Dialogue: 0,0:45:21.63,0:45:24.71,Default,,0000,0000,0000,,What would you rather depend upon? Dialogue: 0,0:45:24.77,0:45:26.96,Default,,0000,0000,0000,,Something easy to change? Dialogue: 0,0:45:26.100,0:45:28.74,Default,,0000,0000,0000,,Or something hard to change? Dialogue: 0,0:45:28.77,0:45:33.12,Default,,0000,0000,0000,,Modify the source code. Dialogue: 0,0:45:33.72,0:45:35.20,Default,,0000,0000,0000,,What would you rather depend upon? Dialogue: 0,0:45:35.20,0:45:39.81,Default,,0000,0000,0000,,A module whose source code was hard to change or a module whose source code was easy to change? Dialogue: 0,0:45:42.29,0:45:43.37,Default,,0000,0000,0000,,Same answer. Dialogue: 0,0:45:43.44,0:45:45.70,Default,,0000,0000,0000,,You wanna depend upon thing that hard to change. Dialogue: 0,0:45:45.73,0:45:48.100,Default,,0000,0000,0000,,And the reason behind that is very simple. Dialogue: 0,0:45:48.100,0:45:51.96,Default,,0000,0000,0000,,Do you mind depending on string? Dialogue: 0,0:45:51.99,0:45:52.72,Default,,0000,0000,0000,,No. Dialogue: 0,0:45:52.72,0:45:54.95,Default,,0000,0000,0000,,Why don't you mind depending on string? Dialogue: 0,0:45:54.95,0:45:58.41,Default,,0000,0000,0000,,Cause if those guys ever change string, they'll be held to pay. Dialogue: 0,0:45:59.68,0:46:01.40,Default,,0000,0000,0000,,They would suffer more than you. Dialogue: 0,0:46:01.62,0:46:04.16,Default,,0000,0000,0000,,That's the equation that we're talking about here. Dialogue: 0,0:46:04.16,0:46:06.49,Default,,0000,0000,0000,,You are happy to do depend upon something, Dialogue: 0,0:46:06.53,0:46:11.52,Default,,0000,0000,0000,,if it will hurt the authors of that thing more to change it than hurts you. Dialogue: 0,0:46:11.56,0:46:13.81,Default,,0000,0000,0000,,That's the equation. Dialogue: 0,0:46:13.85,0:46:15.60,Default,,0000,0000,0000,,You are happy to depend upon things Dialogue: 0,0:46:15.60,0:46:19.20,Default,,0000,0000,0000,,as long as you're not likely to change or at least the bastards gonna pay if they change. Dialogue: 0,0:46:19.20,0:46:25.36,Default,,0000,0000,0000,,So alright, we don't want to depend on things that are easy to change. Dialogue: 0,0:46:27.38,0:46:28.91,Default,,0000,0000,0000,,Think about that very carefully. Dialogue: 0,0:46:28.91,0:46:32.85,Default,,0000,0000,0000,,I don't want to depend on something easy to change. Dialogue: 0,0:46:34.59,0:46:40.27,Default,,0000,0000,0000,,Do we design parts of our system so that they will be easy to change? Dialogue: 0,0:46:42.65,0:46:43.78,Default,,0000,0000,0000,,Yes. Dialogue: 0,0:46:44.14,0:46:49.98,Default,,0000,0000,0000,,What parts of our system do we most want to be easy to change? Dialogue: 0,0:46:53.14,0:46:54.32,Default,,0000,0000,0000,,The GUI. Dialogue: 0,0:46:56.89,0:46:58.29,Default,,0000,0000,0000,,GUIs are volatile. Dialogue: 0,0:46:58.29,0:47:01.59,Default,,0000,0000,0000,,They change for no good reason at all. Dialogue: 0,0:47:01.62,0:47:05.07,Default,,0000,0000,0000,,People will change GUI just because they feel like it. Dialogue: 0,0:47:05.10,0:47:07.85,Default,,0000,0000,0000,,There will be some committee (??) to say, Dialogue: 0,0:47:07.85,0:47:09.74,Default,,0000,0000,0000,,"You know, our system look so old." Dialogue: 0,0:47:09.78,0:47:11.50,Default,,0000,0000,0000,,What the hell does that mean? Dialogue: 0,0:47:11.50,0:47:14.54,Default,,0000,0000,0000,,"Our system look so old, we need to give it a face lift." Dialogue: 0,0:47:14.90,0:47:19.38,Default,,0000,0000,0000,,"Marketing people have decided, we’ve gotta have whole new look and feel." Dialogue: 0,0:47:19.41,0:47:21.04,Default,,0000,0000,0000,,"Not gonna change any behavior." Dialogue: 0,0:47:21.09,0:47:22.90,Default,,0000,0000,0000,,"Just look and feel of the GUI." Dialogue: 0,0:47:22.93,0:47:25.04,Default,,0000,0000,0000,,GUI has to be easy to change. Dialogue: 0,0:47:25.04,0:47:28.51,Default,,0000,0000,0000,,The modules that hold that source code have to be easy to change Dialogue: 0,0:47:28.55,0:47:33.00,Default,,0000,0000,0000,,And that means that none of you modules should depend on the GUI. Dialogue: 0,0:47:33.63,0:47:36.67,Default,,0000,0000,0000,,No source code dependency should land on the GUI. Dialogue: 0,0:47:37.53,0:47:41.98,Default,,0000,0000,0000,,Your components should not have dependencies that land on the GUI. Dialogue: 0,0:47:42.03,0:47:45.18,Default,,0000,0000,0000,,GUI components have to depend upon the application. Dialogue: 0,0:47:45.23,0:47:48.53,Default,,0000,0000,0000,,Application component cannot depend upon the GUI. Dialogue: 0,0:47:49.11,0:47:53.21,Default,,0000,0000,0000,,Otherwise you wind up with the systems that wear the GUIs hard to change. Dialogue: 0,0:47:53.25,0:47:56.57,Default,,0000,0000,0000,,How many of you test your systems? Dialogue: 0,0:47:56.62,0:47:57.88,Default,,0000,0000,0000,,Automated test. Dialogue: 0,0:47:58.84,0:47:59.91,Default,,0000,0000,0000,,Through the GUI. Dialogue: 0,0:48:02.64,0:48:03.86,Default,,0000,0000,0000,,Got a couple of people. Dialogue: 0,0:48:04.81,0:48:06.62,Default,,0000,0000,0000,,You write test code through the GUI. Dialogue: 0,0:48:07.38,0:48:11.01,Default,,0000,0000,0000,,You are depending upon something that supposed to be easy to change. Dialogue: 0,0:48:11.06,0:48:13.23,Default,,0000,0000,0000,,You'll make it hard to change. Dialogue: 0,0:48:13.30,0:48:15.60,Default,,0000,0000,0000,,If you test your system through the GUI. Dialogue: 0,0:48:15.67,0:48:19.40,Default,,0000,0000,0000,,I have a client who have 15,000 tests all go through the GUI. Dialogue: 0,0:48:19.43,0:48:20.85,Default,,0000,0000,0000,,Same client, by the way. Dialogue: 0,0:48:20.93,0:48:22.07,Default,,0000,0000,0000,,Same one went out of the business. Dialogue: 0,0:48:22.10,0:48:25.79,Default,,0000,0000,0000,,15,000 tests through the GUI. Dialogue: 0,0:48:25.84,0:48:29.29,Default,,0000,0000,0000,,He had so many tests he didn't know what they were anymore. Dialogue: 0,0:48:29.32,0:48:30.83,Default,,0000,0000,0000,,He just knew they all had to pass. Dialogue: 0,0:48:30.86,0:48:32.78,Default,,0000,0000,0000,,If somebody touch the GUI Dialogue: 0,0:48:32.82,0:48:35.23,Default,,0000,0000,0000,,a thousand of those test would break. Dialogue: 0,0:48:35.28,0:48:37.06,Default,,0000,0000,0000,,He couldn't find the time to fix them. Dialogue: 0,0:48:37.11,0:48:39.22,Default,,0000,0000,0000,,So he came up with real simple rule. Dialogue: 0,0:48:39.26,0:48:40.80,Default,,0000,0000,0000,,What do you think that rule was? Dialogue: 0,0:48:40.85,0:48:43.58,Default,,0000,0000,0000,,No body touches the GUI. Dialogue: 0,0:48:43.61,0:48:47.12,Default,,0000,0000,0000,,They made the GUI hard to change. Dialogue: 0,0:48:47.53,0:48:51.70,Default,,0000,0000,0000,,The other thing of course could happened there is that you could lose your tests. Dialogue: 0,0:48:52.57,0:48:58.43,Default,,0000,0000,0000,,You spend a man year putting together nice automated test suite that go through the GUI. Dialogue: 0,0:48:58.47,0:49:01.94,Default,,0000,0000,0000,,And then somebody decides, "We need a face lift on our site." Dialogue: 0,0:49:01.98,0:49:04.36,Default,,0000,0000,0000,,"Pull all out the old GUI and put a brand new GUI" Dialogue: 0,0:49:04.40,0:49:05.97,Default,,0000,0000,0000,,And all those tests are gone. Dialogue: 0,0:49:06.00,0:49:09.71,Default,,0000,0000,0000,,And you get to rewrite them again, but you've got other systems you gotta test. Dialogue: 0,0:49:09.75,0:49:11.77,Default,,0000,0000,0000,,Don't test through the GUI. Dialogue: 0,0:49:11.81,0:49:13.78,Default,,0000,0000,0000,,Don't do anything through the GUI. Dialogue: 0,0:49:13.78,0:49:19.39,Default,,0000,0000,0000,,All dependencies point away from the GUI. Dialogue: 0,0:49:19.45,0:49:22.80,Default,,0000,0000,0000,,What other things do we want to be easy to change? Dialogue: 0,0:49:22.88,0:49:26.05,Default,,0000,0000,0000,,The database. Dialogue: 0,0:49:26.05,0:49:28.34,Default,,0000,0000,0000,,We want the database to be easy to change. Dialogue: 0,0:49:28.34,0:49:32.35,Default,,0000,0000,0000,,We want to be able to make changes to database without rippling through the whole applications. Dialogue: 0,0:49:33.81,0:49:37.65,Default,,0000,0000,0000,,All dependencies you should point away from the database. Dialogue: 0,0:49:37.65,0:49:40.61,Default,,0000,0000,0000,,Put the database in a component with all the dependencies pointing outwards. Dialogue: 0,0:49:40.68,0:49:44.23,Default,,0000,0000,0000,,Put the GUI into a component with all the dependencies pointing outwards. Dialogue: 0,0:49:46.31,0:49:54.15,Default,,0000,0000,0000,,I don't want to depend on anything that is unstable. Dialogue: 0,0:49:54.70,0:49:58.44,Default,,0000,0000,0000,,How can we measure instability? Dialogue: 0,0:50:02.01,0:50:03.82,Default,,0000,0000,0000,,See this guy up here? Dialogue: 0,0:50:04.100,0:50:06.32,Default,,0000,0000,0000,,That component up there? Dialogue: 0,0:50:06.75,0:50:08.93,Default,,0000,0000,0000,,Is he Stable? Or Unstable? Dialogue: 0,0:50:09.00,0:50:13.26,Default,,0000,0000,0000,,He's got lots of incoming dependencies. Dialogue: 0,0:50:13.33,0:50:15.62,Default,,0000,0000,0000,,No outgoing dependencies. Dialogue: 0,0:50:15.69,0:50:17.10,Default,,0000,0000,0000,,He's hard to change. Dialogue: 0,0:50:17.15,0:50:20.35,Default,,0000,0000,0000,,If I make a change to him, it impacts all those guys. Dialogue: 0,0:50:20.40,0:50:24.94,Default,,0000,0000,0000,,So this component here is responsible to those guys. Dialogue: 0,0:50:25.01,0:50:28.100,Default,,0000,0000,0000,,Oh and this component here is independent. Dialogue: 0,0:50:29.08,0:50:30.89,Default,,0000,0000,0000,,It doesn't depend on anybody. Dialogue: 0,0:50:30.89,0:50:32.80,Default,,0000,0000,0000,,It's responsible and independent. Dialogue: 0,0:50:32.80,0:50:33.85,Default,,0000,0000,0000,,I's an adult. Dialogue: 0,0:50:36.72,0:50:39.08,Default,,0000,0000,0000,,Stable. Adult. Dialogue: 0,0:50:40.05,0:50:41.09,Default,,0000,0000,0000,,This guy. Dialogue: 0,0:50:41.62,0:50:44.44,Default,,0000,0000,0000,,He depends on lots of other components. Dialogue: 0,0:50:44.95,0:50:46.79,Default,,0000,0000,0000,,No body depends upon him. Dialogue: 0,0:50:46.84,0:50:48.37,Default,,0000,0000,0000,,Is he responsible? Dialogue: 0,0:50:48.43,0:50:49.64,Default,,0000,0000,0000,,And dependent? Dialogue: 0,0:50:49.68,0:50:51.27,Default,,0000,0000,0000,,He's teenager. Dialogue: 0,0:50:52.01,0:50:53.58,Default,,0000,0000,0000,,And he's unstable. Dialogue: 0,0:50:54.06,0:50:57.62,Default,,0000,0000,0000,,These are the two extreme kinds of components. Dialogue: 0,0:50:57.68,0:51:00.40,Default,,0000,0000,0000,,At the two sides of component spectrum. Dialogue: 0,0:51:00.43,0:51:02.87,Default,,0000,0000,0000,,You've got the adults that highly stable. Dialogue: 0,0:51:02.94,0:51:06.79,Default,,0000,0000,0000,,And you’ve got the teenager who are highly unstable. Dialogue: 0,0:51:06.88,0:51:09.07,Default,,0000,0000,0000,,The unstable ones are easy to change. Dialogue: 0,0:51:09.15,0:51:11.68,Default,,0000,0000,0000,,That's what we wanna put all of our little code. Dialogue: 0,0:51:12.39,0:51:15.13,Default,,0000,0000,0000,,The stable ones are hard to change. Dialogue: 0,0:51:16.38,0:51:22.87,Default,,0000,0000,0000,,We can measure that stability by creating a metric. Dialogue: 0,0:51:22.90,0:51:25.83,Default,,0000,0000,0000,,That metric is a metric that I call "I" Dialogue: 0,0:51:26.82,0:51:33.60,Default,,0000,0000,0000,,'I' is equal to the fan-out. Number of outgoing dependencies. Dialogue: 0,0:51:33.67,0:51:37.10,Default,,0000,0000,0000,,Divided by the fan-in plus the fan-out. Dialogue: 0,0:51:37.18,0:51:40.23,Default,,0000,0000,0000,,And if you think about that for very long. Dialogue: 0,0:51:40.26,0:51:43.56,Default,,0000,0000,0000,,You'll realize that 'I' is a metric that goes from 0 to 1. Dialogue: 0,0:51:43.65,0:51:46.84,Default,,0000,0000,0000,,0 being stable. 1 being unstable. Dialogue: 0,0:51:46.87,0:51:50.03,Default,,0000,0000,0000,,0 being an adult. 1 being a teenager. Dialogue: 0,0:51:50.09,0:51:53.34,Default,,0000,0000,0000,,It’s all about the dependencies. Dialogue: 0,0:51:53.37,0:51:59.27,Default,,0000,0000,0000,,And now we can re-phrase the principle to say this. Dialogue: 0,0:52:05.66,0:52:13.95,Default,,0000,0000,0000,,Every dependency in a component graph should point at something more stable than it is. Dialogue: 0,0:52:14.35,0:52:21.75,Default,,0000,0000,0000,,Or, if use the metric, these arrow should point in the direction of decreasing 'I'. Dialogue: 0,0:52:21.83,0:52:25.39,Default,,0000,0000,0000,,Decreasing instability. Increasing stability. Dialogue: 0,0:52:25.43,0:52:30.66,Default,,0000,0000,0000,,And you can do the math on just the fan-ins and fan-outs and verify that's correct. Dialogue: 0,0:52:31.58,0:52:36.73,Default,,0000,0000,0000,,Why was the cycle bad idea? Dialogue: 0,0:52:37.98,0:52:41.44,Default,,0000,0000,0000,,Something stable depended on something unstable. Dialogue: 0,0:52:44.86,0:52:48.13,Default,,0000,0000,0000,,But that leaves us with a problem. Dialogue: 0,0:52:48.17,0:52:49.92,Default,,0000,0000,0000,,And the problem is this. Dialogue: 0,0:52:54.95,0:52:56.23,Default,,0000,0000,0000,,What's that guy? Dialogue: 0,0:52:57.66,0:52:59.33,Default,,0000,0000,0000,,Stable? Or unstable? Dialogue: 0,0:53:01.34,0:53:02.72,Default,,0000,0000,0000,,He's really stable. Dialogue: 0,0:53:02.77,0:53:05.10,Default,,0000,0000,0000,,He's sitting down here the bottom of the graph. Dialogue: 0,0:53:05.18,0:53:07.80,Default,,0000,0000,0000,,Everything over here depends on him. Dialogue: 0,0:53:08.60,0:53:10.42,Default,,0000,0000,0000,,He's very hard to change. Dialogue: 0,0:53:10.76,0:53:14.93,Default,,0000,0000,0000,,If I touch that component, all these other components will be affected by. Dialogue: 0,0:53:14.93,0:53:18.35,Default,,0000,0000,0000,,For no other reason than the release number changes. Dialogue: 0,0:53:23.94,0:53:29.02,Default,,0000,0000,0000,,That means the stuffs down here at the bottom of graph is very difficult to work with. Dialogue: 0,0:53:30.89,0:53:33.37,Default,,0000,0000,0000,,But there's an escape to that. Dialogue: 0,0:53:33.72,0:53:35.34,Default,,0000,0000,0000,,Back to polymorphism. Dialogue: 0,0:53:36.75,0:53:42.93,Default,,0000,0000,0000,,How can you make something easy to extend? Dialogue: 0,0:53:43.79,0:53:46.48,Default,,0000,0000,0000,,Even though it's hard to modify. Dialogue: 0,0:53:48.71,0:53:50.26,Default,,0000,0000,0000,,You make it abstract. Dialogue: 0,0:53:51.10,0:53:54.42,Default,,0000,0000,0000,,Abstract classes can be extended trivially. Dialogue: 0,0:53:55.21,0:53:57.36,Default,,0000,0000,0000,,Without having it modified. Dialogue: 0,0:53:57.46,0:54:00.42,Default,,0000,0000,0000,,You can add new features to a system Dialogue: 0,0:54:00.47,0:54:05.74,Default,,0000,0000,0000,,if those new features live inside the derivatives of base classes. Dialogue: 0,0:54:06.20,0:54:08.90,Default,,0000,0000,0000,,So the final principle is this. Dialogue: 0,0:54:09.76,0:54:16.15,Default,,0000,0000,0000,,We would like abstractness to increase as we go down the zeros. (??) Dialogue: 0,0:54:16.18,0:54:18.48,Default,,0000,0000,0000,,Stuff up here concrete. Dialogue: 0,0:54:18.51,0:54:20.31,Default,,0000,0000,0000,,Unstable and concrete. Dialogue: 0,0:54:20.31,0:54:23.14,Default,,0000,0000,0000,,Stuff down here abstract and stable. Dialogue: 0,0:54:23.14,0:54:30.24,Default,,0000,0000,0000,,Abstractness becomes more and more prevalent as we go down this tree. Dialogue: 0,0:54:32.09,0:54:39.39,Default,,0000,0000,0000,,In fact, we could say that abstractness is a number Dialogue: 0,0:54:39.42,0:54:46.42,Default,,0000,0000,0000,,which is the number of abstract classes divided by the total number of classes in a component. Dialogue: 0,0:54:46.90,0:54:50.36,Default,,0000,0000,0000,,And if you did that, you get this number 'A' which goes 0 to 1. Dialogue: 0,0:54:50.36,0:54:51.67,Default,,0000,0000,0000,,0 being concrete. Dialogue: 0,0:54:51.71,0:54:54.83,Default,,0000,0000,0000,,1 being entirely abstract. Composed of nothing but interfaces. Dialogue: 0,0:54:54.88,0:54:58.62,Default,,0000,0000,0000,,And then we can do this very interesting thing. Dialogue: 0,0:54:58.70,0:55:09.12,Default,,0000,0000,0000,,We can say that for any particular component 'A' plus 'I' should equal 1. Dialogue: 0,0:55:09.15,0:55:13.09,Default,,0000,0000,0000,,Either it's abstract where 'A' is 1. Dialogue: 0,0:55:13.13,0:55:15.50,Default,,0000,0000,0000,,And stable where 'I' is 0. Dialogue: 0,0:55:15.54,0:55:19.56,Default,,0000,0000,0000,,Or it is instable where 'I' is 1. Dialogue: 0,0:55:19.61,0:55:21.13,Default,,0000,0000,0000,,And concrete where 'A' is 0. Dialogue: 0,0:55:21.13,0:55:23.38,Default,,0000,0000,0000,,'A' plus 'I' equals 1. Dialogue: 0,0:55:23.42,0:55:26.73,Default,,0000,0000,0000,,The magic formula of components. 'A' plus 'I' equals 1. Dialogue: 0,0:55:26.73,0:55:30.86,Default,,0000,0000,0000,,Now you've got the adults up here which are abstract Dialogue: 0,0:55:30.90,0:55:33.34,Default,,0000,0000,0000,,And everybody depends upon them. So they are stable. Dialogue: 0,0:55:33.38,0:55:35.86,Default,,0000,0000,0000,,You've got the teenagers down here. Dialogue: 0,0:55:37.25,0:55:41.78,Default,,0000,0000,0000,,Everybody that's got no incoming dependencies but they're very concrete. Dialogue: 0,0:55:41.82,0:55:43.60,Default,,0000,0000,0000,,What do you got here? Dialogue: 0,0:55:43.64,0:55:47.14,Default,,0000,0000,0000,,This is the line 'A' plus 'I' equals 1. Dialogue: 0,0:55:48.47,0:55:53.46,Default,,0000,0000,0000,,This is where we would like our components to sit if they can sit. One of those two end points. Dialogue: 0,0:55:53.50,0:55:54.38,Default,,0000,0000,0000,,Why? Dialogue: 0,0:55:55.58,0:55:59.50,Default,,0000,0000,0000,,Well, what's up here? Dialogue: 0,0:56:00.98,0:56:03.95,Default,,0000,0000,0000,,Highly abstract. Nobody depends upon on it. Dialogue: 0,0:56:05.37,0:56:08.10,Default,,0000,0000,0000,,An interface that nobody implements. Useless. Dialogue: 0,0:56:08.73,0:56:11.02,Default,,0000,0000,0000,,This is the zone of uselessness. Dialogue: 0,0:56:11.07,0:56:14.32,Default,,0000,0000,0000,,We don't want our components going that way. Dialogue: 0,0:56:14.39,0:56:15.60,Default,,0000,0000,0000,,What's down here? Dialogue: 0,0:56:17.04,0:56:19.66,Default,,0000,0000,0000,,Very concrete. Everybody depends upon on it. Dialogue: 0,0:56:20.23,0:56:21.56,Default,,0000,0000,0000,,Database schemas. Dialogue: 0,0:56:23.29,0:56:25.21,Default,,0000,0000,0000,,Concrete. Everybody depends upon them. Dialogue: 0,0:56:25.26,0:56:26.52,Default,,0000,0000,0000,,Fun to change. Dialogue: 0,0:56:27.37,0:56:29.63,Default,,0000,0000,0000,,Right? We don't want things down here. Dialogue: 0,0:56:29.67,0:56:31.02,Default,,0000,0000,0000,,This is the zone of pain. Dialogue: 0,0:56:31.71,0:56:36.20,Default,,0000,0000,0000,,We would like our components to be as far from those 2 points as possible. Dialogue: 0,0:56:36.20,0:56:39.30,Default,,0000,0000,0000,,Ideally if we could get them here and here that would be best. Dialogue: 0,0:56:39.33,0:56:42.25,Default,,0000,0000,0000,,But it turns out the components are persnickety that way. Dialogue: 0,0:56:42.30,0:56:45.45,Default,,0000,0000,0000,,So at least we'd like them to be sitting along this line. Dialogue: 0,0:56:45.96,0:56:48.41,Default,,0000,0000,0000,,Or close to the line. Dialogue: 0,0:56:48.91,0:56:51.41,Default,,0000,0000,0000,,Which leaves us the one last metric. Dialogue: 0,0:56:52.57,0:56:53.57,Default,,0000,0000,0000,,'D' Dialogue: 0,0:56:54.32,0:56:56.98,Default,,0000,0000,0000,,How far away is a component from the line? Dialogue: 0,0:56:57.59,0:57:02.09,Default,,0000,0000,0000,,Well, 'D' could be the absolute value of 'A' plus 'I' minus 1. Dialogue: 0,0:57:02.09,0:57:04.71,Default,,0000,0000,0000,,You can do the math on this. It's not very difficult. Dialogue: 0,0:57:04.71,0:57:07.21,Default,,0000,0000,0000,,'D' is the metric that goes from 0 to 1. Dialogue: 0,0:57:07.46,0:57:09.57,Default,,0000,0000,0000,,0 means that right on the line. Dialogue: 0,0:57:09.61,0:57:11.64,Default,,0000,0000,0000,,1 means that one of the two bad end points. Dialogue: 0,0:57:12.11,0:57:14.83,Default,,0000,0000,0000,,If you wanna know which end point you can take the absolute value signs off. Dialogue: 0,0:57:14.83,0:57:16.36,Default,,0000,0000,0000,,But I don't care. Dialogue: 0,0:57:16.48,0:57:22.41,Default,,0000,0000,0000,,You can measure 'D' by looking at the fan-in and the fan-out of the component. Dialogue: 0,0:57:22.44,0:57:23.100,Default,,0000,0000,0000,,Measuring its abstractness. Dialogue: 0,0:57:24.08,0:57:27.70,Default,,0000,0000,0000,,Doing the math is not very difficult math to do. Dialogue: 0,0:57:27.73,0:57:33.60,Default,,0000,0000,0000,,And find out whether your component sits nicely on that line. Dialogue: 0,0:57:34.04,0:57:40.42,Default,,0000,0000,0000,,If it does then it is abstract as it is depended upon. Dialogue: 0,0:57:41.39,0:57:46.82,Default,,0000,0000,0000,,If it doesn't that means either it's very abstract and not depended on Dialogue: 0,0:57:46.88,0:57:49.02,Default,,0000,0000,0000,,or very concrete and heavily depended upon. Dialogue: 0,0:57:49.02,0:57:50.36,Default,,0000,0000,0000,,Both of which are very bad ideas. Dialogue: 0,0:57:51.46,0:57:55.19,Default,,0000,0000,0000,,There are lots of tools that automatically calculate these metrics for you. Dialogue: 0,0:57:55.26,0:57:58.66,Default,,0000,0000,0000,,If you ever used NDepend. That will calculate the metrics for you. Dialogue: 0,0:57:58.70,0:58:02.58,Default,,0000,0000,0000,,If you ever used any of the other static analysis tools, Dialogue: 0,0:58:02.66,0:58:06.18,Default,,0000,0000,0000,,they can generate all these metrics. I. D. All of them for you. Dialogue: 0,0:58:06.26,0:58:09.53,Default,,0000,0000,0000,,So that you can look at your components and see if they fit. Dialogue: 0,0:58:09.57,0:58:14.22,Default,,0000,0000,0000,,And then think about what should be easy to change. Dialogue: 0,0:58:14.82,0:58:17.92,Default,,0000,0000,0000,,Things that are easy to change should be in teenagers. Dialogue: 0,0:58:19.05,0:58:23.65,Default,,0000,0000,0000,,Things that are hard to change should be in adults that are abstract. Dialogue: 0,0:58:23.65,0:58:27.63,Default,,0000,0000,0000,,Concrete teenagers hold the stuff that's easy to change. Dialogue: 0,0:58:28.28,0:58:31.80,Default,,0000,0000,0000,,Abstract adults hold the stuff that's hard to change. Dialogue: 0,0:58:32.97,0:58:34.18,Default,,0000,0000,0000,,Any questions? Dialogue: 0,0:58:36.32,0:58:40.36,Default,,0000,0000,0000,,We started with PDP-8 assembly code and got here. Dialogue: 0,0:58:42.81,0:58:44.62,Default,,0000,0000,0000,,Any questions? No? Dialogue: 0,0:58:45.15,0:58:45.65,Default,,0000,0000,0000,,Good. Dialogue: 0,0:58:46.56,0:58:47.81,Default,,0000,0000,0000,,Oh, damn. Dialogue: 0,0:58:49.76,0:58:51.28,Default,,0000,0000,0000,,It's alright. It's okay. Dialogue: 0,0:58:51.39,0:58:56.85,Default,,0000,0000,0000,,(Someone is questioning.) Dialogue: 0,0:58:56.85,0:58:57.49,Default,,0000,0000,0000,,Yep. Dialogue: 0,0:58:57.49,0:59:03.08,Default,,0000,0000,0000,,(Someone is questioning) Dialogue: 0,0:59:03.08,0:59:04.96,Default,,0000,0000,0000,,2 versions. Dialogue: 0,0:59:04.96,0:59:07.02,Default,,0000,0000,0000,,(Someone is questioning) Dialogue: 0,0:59:07.02,0:59:10.35,Default,,0000,0000,0000,,Yeah, 2 versions. Same component. You kill the programmers. Dialogue: 0,0:59:10.54,0:59:11.19,Default,,0000,0000,0000,,Yeah. Dialogue: 0,0:59:11.60,0:59:15.28,Default,,0000,0000,0000,,Don't have multiple versions of same component in you system please. Dialogue: 0,0:59:15.32,0:59:16.92,Default,,0000,0000,0000,,That's DLL Hell. Dialogue: 0,0:59:17.85,0:59:19.91,Default,,0000,0000,0000,,Anybody else? Yeah. Dialogue: 0,0:59:21.35,0:59:24.02,Default,,0000,0000,0000,,Where do you place...? Very very good question. Dialogue: 0,0:59:24.02,0:59:26.19,Default,,0000,0000,0000,,String class sits right there. Dialogue: 0,0:59:26.95,0:59:31.84,Default,,0000,0000,0000,,It's in the worst possible place but nobody ever changes it. So we don't care. Dialogue: 0,0:59:32.12,0:59:35.77,Default,,0000,0000,0000,,This is all about the stuff we are actively developing. Dialogue: 0,0:59:35.81,0:59:37.83,Default,,0000,0000,0000,,The stuff that is being changed. Dialogue: 0,0:59:38.06,0:59:42.79,Default,,0000,0000,0000,,So we pay very close attention to the stuff that's in our libraries that are changing. Dialogue: 0,0:59:42.79,0:59:45.88,Default,,0000,0000,0000,,The stuff that we get from other libraries that's not changing. Dialogue: 0,0:59:45.92,0:59:49.03,Default,,0000,0000,0000,,Or the stuff that's in our old libraries that's not changing. Dialogue: 0,0:59:49.07,0:59:50.47,Default,,0000,0000,0000,,We not gonna pay attention to that here. Dialogue: 0,0:59:50.51,0:59:52.33,Default,,0000,0000,0000,,A lot of that stuff may live here. Dialogue: 0,0:59:52.33,0:59:53.46,Default,,0000,0000,0000,,And that's okay. Dialogue: 0,0:59:53.46,0:59:54.92,Default,,0000,0000,0000,,None of it's gonna live here. Dialogue: 0,0:59:55.73,0:59:57.62,Default,,0000,0000,0000,,Well, some of it might. Dialogue: 0,0:59:57.62,0:59:59.59,Default,,0000,0000,0000,,Anybody pull out any dead code? Dialogue: 0,0:59:59.62,1:00:01.95,Default,,0000,0000,0000,,Abstract classes that nobody implements? Dialogue: 0,1:00:02.01,1:00:04.87,Default,,0000,0000,0000,,Yeah, okay. So maybe you see some stuffs there. Dialogue: 0,1:00:04.90,1:00:11.72,Default,,0000,0000,0000,,But String, Vector, a lot of libraries live down here we don't care because they're not volatile. Dialogue: 0,1:00:11.76,1:00:16.27,Default,,0000,0000,0000,,Think of another axis is coming out from this graph, right, towards you. Dialogue: 0,1:00:16.31,1:00:18.37,Default,,0000,0000,0000,,That's the axis of volatility. Dialogue: 0,1:00:18.37,1:00:21.57,Default,,0000,0000,0000,,This is a slice where volatility is close to 1. Dialogue: 0,1:00:22.12,1:00:24.84,Default,,0000,0000,0000,,The stuff where volatility is 0, we don't care about it. Dialogue: 0,1:00:26.14,1:00:27.08,Default,,0000,0000,0000,,Anybody else? Dialogue: 0,1:00:27.96,1:00:29.20,Default,,0000,0000,0000,,Yo! In the back.