1 00:00:18,740 --> 00:00:19,869 DAVID HEINEMEIER HANSSON: That any better? 2 00:00:19,869 --> 00:00:22,460 Oh, there we go. Woo. 3 00:00:22,460 --> 00:00:27,090 Software's hard, as you can see. Hardware, too. 4 00:00:27,090 --> 00:00:33,270 So last year I had the personal pleasure of 5 00:00:33,270 --> 00:00:36,620 celebrating ten years of working with Ruby and ten 6 00:00:36,620 --> 00:00:40,420 years of working with Rails. But this year, I 7 00:00:40,420 --> 00:00:44,360 have a much more interesting anniversary, which is ten 8 00:00:44,360 --> 00:00:48,210 years of sharing Ruby on Rails with all of 9 00:00:48,210 --> 00:00:51,239 you and everyone who's been using it over the 10 00:00:51,239 --> 00:00:55,000 past decade. 11 00:00:55,000 --> 00:00:56,920 The picture in the background is actually from almost 12 00:00:56,920 --> 00:00:59,030 exactly this time, where I gave the very first 13 00:00:59,030 --> 00:01:03,769 presentation on Ruby on Rails at a Danish university 14 00:01:03,769 --> 00:01:06,100 ten years ago. 15 00:01:06,100 --> 00:01:07,780 Ten years ago, I had to talk a lot 16 00:01:07,780 --> 00:01:12,210 about what is MVC, for example. Today, not so 17 00:01:12,210 --> 00:01:14,409 much. There's a lot of things that over the 18 00:01:14,409 --> 00:01:17,979 past ten years, things we were worried about in 19 00:01:17,979 --> 00:01:20,920 the beginning, sort of leveling up as a community 20 00:01:20,920 --> 00:01:23,630 and as, as programmers, that just aren't relevant anymore. 21 00:01:23,630 --> 00:01:25,280 We're just taking all that stuff for granted. 22 00:01:25,280 --> 00:01:27,530 Which is awesome. We get to care about a 23 00:01:27,530 --> 00:01:30,189 lot of other stuff. 24 00:01:30,189 --> 00:01:32,090 But as I look back over the past ten 25 00:01:32,090 --> 00:01:35,460 years, which is pretty much the majority of my 26 00:01:35,460 --> 00:01:40,079 adult life, I've been working on Ruby on Rails. 27 00:01:40,079 --> 00:01:42,780 It's fun to look back even further. I think 28 00:01:42,780 --> 00:01:49,520 there's a common misconception that anybody who ends up 29 00:01:49,520 --> 00:01:52,700 creating something like Rails or 30 00:01:52,700 --> 00:01:54,869 doing something else within 31 00:01:54,869 --> 00:01:56,530 software development or computer science, 32 00:01:56,530 --> 00:01:57,249 well, they must have 33 00:01:57,249 --> 00:02:00,689 been programming since they were five years old, right. 34 00:02:00,689 --> 00:02:03,719 The whole notion of a hacker is somebody who, 35 00:02:03,719 --> 00:02:07,670 who sort of got their first computer twenty years 36 00:02:07,670 --> 00:02:11,900 ago and was just programming the entire time. Well. 37 00:02:11,900 --> 00:02:13,310 That wasn't me. 38 00:02:13,310 --> 00:02:15,650 I did not learn to program when I was 39 00:02:15,650 --> 00:02:19,260 five years old. I didn't learn to program until 40 00:02:19,260 --> 00:02:23,580 I was closer to twenty. I'd been interested in 41 00:02:23,580 --> 00:02:25,850 computers for a long time, but it wasn't really 42 00:02:25,850 --> 00:02:30,480 until the late '90s, early 2000 that I dove 43 00:02:30,480 --> 00:02:32,510 into computer programming as something that I was going 44 00:02:32,510 --> 00:02:32,780 to do. 45 00:02:32,780 --> 00:02:34,120 I had a lot of friends who were doing 46 00:02:34,120 --> 00:02:37,750 it. I knew a lot of programmers. But somehow 47 00:02:37,750 --> 00:02:41,860 it, it sort of never, never caught on. Before 48 00:02:41,860 --> 00:02:44,380 I started writing software that I needed for myself, 49 00:02:44,380 --> 00:02:47,190 and before I found sort of a place in 50 00:02:47,190 --> 00:02:49,730 the software world for that to happen. 51 00:02:49,730 --> 00:02:53,220 And the reason I, I say that is, is 52 00:02:53,220 --> 00:02:56,080 I've seen a number of essays of like, what 53 00:02:56,080 --> 00:02:58,300 is a true hacker, and, and as a true 54 00:02:58,300 --> 00:03:01,640 hacker, one of the things that keeps being thrown 55 00:03:01,640 --> 00:03:03,530 out is those ten years, right. You should have 56 00:03:03,530 --> 00:03:05,450 been programming for ten years already, 57 00:03:05,450 --> 00:03:07,150 otherwise you're way behind. 58 00:03:07,150 --> 00:03:11,740 Well, I learned to program about three years before 59 00:03:11,740 --> 00:03:17,300 I released Ruby on Rails. Turned out fine. 60 00:03:17,300 --> 00:03:23,150 And I don't say that as, like, it was 61 00:03:23,150 --> 00:03:24,960 because I grew up on a farm and didn't 62 00:03:24,960 --> 00:03:30,820 know what a computer was. This is me in, 63 00:03:30,820 --> 00:03:33,760 in the center there with the stick, and the 64 00:03:33,760 --> 00:03:39,010 blue shirt in 1985. These are the kids that 65 00:03:39,010 --> 00:03:41,200 were living in my neighborhood. 66 00:03:41,200 --> 00:03:43,560 In 1985 I got introduced to my, my first 67 00:03:43,560 --> 00:03:49,680 computer. And I was about five years old. And 68 00:03:49,680 --> 00:03:54,210 I got introduced to computers through gaming. Sort of, 69 00:03:54,210 --> 00:03:56,940 we were playing ninjas in the streets around our 70 00:03:56,940 --> 00:04:02,270 houses, and then we'd play ninjas on the box. 71 00:04:02,270 --> 00:04:03,790 And I found it fascinating right from the get 72 00:04:03,790 --> 00:04:06,200 go, right. Computers were really 73 00:04:06,200 --> 00:04:08,070 fascinating and games really 74 00:04:08,070 --> 00:04:12,480 captured my imagination early on. I remember, at, at 75 00:04:12,480 --> 00:04:14,500 that time, there were certain, lots of parents were 76 00:04:14,500 --> 00:04:15,860 like, well make sure you get out and play 77 00:04:15,860 --> 00:04:18,228 a lot. Because you don't want to spend your, 78 00:04:18,228 --> 00:04:19,418 or wasting your time, that was the, that was 79 00:04:19,418 --> 00:04:22,220 the word, wasting your time in front of computers 80 00:04:22,220 --> 00:04:23,340 inside, right. 81 00:04:23,340 --> 00:04:25,720 Well, I really did want to waste my time 82 00:04:25,720 --> 00:04:27,949 in front of computers. And this was the computer 83 00:04:27,949 --> 00:04:34,470 to have in 1985, in our neighborhood. But we 84 00:04:34,470 --> 00:04:36,419 couldn't afford a computer like that. There was only 85 00:04:36,419 --> 00:04:37,840 one guy in the whole neighborhood that had a 86 00:04:37,840 --> 00:04:39,409 computer like that. So we all shared it and 87 00:04:39,409 --> 00:04:43,330 we all played Yeah, Kung Fu, in turn. 88 00:04:43,330 --> 00:04:47,999 But then the next year, so, I, I couldn't 89 00:04:47,999 --> 00:04:52,400 afford this computer, but my dad somehow, he was 90 00:04:52,400 --> 00:04:56,550 fixing TVs and stereos, he traded a stereo with 91 00:04:56,550 --> 00:05:00,030 this guy for this other weird computer, which was 92 00:05:00,030 --> 00:05:04,139 an Abstraught 646. 93 00:05:04,139 --> 00:05:06,419 And I was really excited. It didn't actually play 94 00:05:06,419 --> 00:05:08,300 Yeah, Kung Fu. I was a little disappointed by 95 00:05:08,300 --> 00:05:10,689 that, but it had some other crappier games. Anyway, 96 00:05:10,689 --> 00:05:12,569 it was a computer. And that was sort of 97 00:05:12,569 --> 00:05:15,210 my first introduction to, to computers, six years old. 98 00:05:15,210 --> 00:05:17,550 And, and I tried to learn programming. 99 00:05:17,550 --> 00:05:20,840 I, I got a magazine and, at the back 100 00:05:20,840 --> 00:05:22,689 of these magazines back then, there were programs you 101 00:05:22,689 --> 00:05:24,960 could type in. And I was like, wow, this 102 00:05:24,960 --> 00:05:27,050 is, this is amazing. I can control this computer. 103 00:05:27,050 --> 00:05:31,249 So I built my first information technology system. 104 00:05:31,249 --> 00:05:36,539 It was messages to my mom of where I 105 00:05:36,539 --> 00:05:38,300 went, where, I had this clever system that would 106 00:05:38,300 --> 00:05:41,460 really optimize the fact that writing a message of 107 00:05:41,460 --> 00:05:43,180 where I went and, and when I was going 108 00:05:43,180 --> 00:05:45,080 to be home, it was too complicated. It would 109 00:05:45,080 --> 00:05:46,840 be much easier if I just wrote a little 110 00:05:46,840 --> 00:05:49,729 note where I gave her the location on the 111 00:05:49,729 --> 00:05:52,419 tape that she had to fast forward to, and 112 00:05:52,419 --> 00:05:54,370 then she could read where I was. 113 00:05:54,370 --> 00:05:56,509 I thought, man this is so clever. I just 114 00:05:56,509 --> 00:05:59,050 have to write down two twenty-eight, and then I 115 00:05:59,050 --> 00:06:01,259 could preprogram that note, and she'll never know I 116 00:06:01,259 --> 00:06:07,409 was over at Peter's house playing Yeah, Kung Fu. 117 00:06:07,409 --> 00:06:10,360 That really wasn't programming, right. I just typed some 118 00:06:10,360 --> 00:06:12,069 stuff in. I didn't know what the hell I 119 00:06:12,069 --> 00:06:14,919 was doing. I just somehow figured out print, OK, 120 00:06:14,919 --> 00:06:16,809 that puts stuff up on the screen. That was, 121 00:06:16,809 --> 00:06:18,259 that was the extent of it, right. But it 122 00:06:18,259 --> 00:06:20,849 was my first stab at programming. And I, and 123 00:06:20,849 --> 00:06:22,819 I, it kind of failed. 124 00:06:22,819 --> 00:06:25,309 That was the extent of my programming, that I 125 00:06:25,309 --> 00:06:28,719 knew how to fast-forward to a pre-recorded message. 126 00:06:28,719 --> 00:06:31,360 Not that great. 127 00:06:31,360 --> 00:06:36,069 So a couple years later, late 80s, I saw 128 00:06:36,069 --> 00:06:39,229 this game for the first time. Battle Squadrant. And 129 00:06:39,229 --> 00:06:43,499 I remember thinking, holy shit, these graphics are amazing. 130 00:06:43,499 --> 00:06:47,050 How can they make this? This looks so good, 131 00:06:47,050 --> 00:06:50,629 when you were used to a Commodore 64, the 132 00:06:50,629 --> 00:06:53,800 graphics of the Amiga 500, which is mind blowing, 133 00:06:53,800 --> 00:06:56,529 right. And once again, I felt this, like, wow, 134 00:06:56,529 --> 00:06:58,620 wouldn't it be amazing to be part of that? 135 00:06:58,620 --> 00:07:00,719 To be able to create something like that? 136 00:07:00,719 --> 00:07:03,050 I'd love to make games. 137 00:07:03,050 --> 00:07:06,240 So I sort of started looking around, and, and 138 00:07:06,240 --> 00:07:08,389 I found this thing called Amus. I don't know, 139 00:07:08,389 --> 00:07:12,659 has anybody here ever programmed in Amus? Not a 140 00:07:12,659 --> 00:07:16,430 single hand. OK. Must have been a very European 141 00:07:16,430 --> 00:07:16,849 thing. 142 00:07:16,849 --> 00:07:18,900 But it was sort of a real programming environment, 143 00:07:18,900 --> 00:07:21,800 and, and I got the box, and sort of 144 00:07:21,800 --> 00:07:23,990 my English was a little, not that great, so 145 00:07:23,990 --> 00:07:25,889 I was sort of just reading through it and 146 00:07:25,889 --> 00:07:27,309 trying to find the code. And it was all 147 00:07:27,309 --> 00:07:30,930 about sprites and vectors and ifs and variables, and 148 00:07:30,930 --> 00:07:32,569 it, it didn't make any sense to me at 149 00:07:32,569 --> 00:07:32,809 all. 150 00:07:32,809 --> 00:07:34,779 So I thought, eh this is a little bit 151 00:07:34,779 --> 00:07:37,550 too hard. Thankfully, there was something called Easy Amos, 152 00:07:37,550 --> 00:07:40,589 right. Oh, wow, that's gonna be great. This other 153 00:07:40,589 --> 00:07:42,009 one was too hard. Now I just have to 154 00:07:42,009 --> 00:07:43,430 do the easy one. 155 00:07:43,430 --> 00:07:46,939 Unfortunately, in Easy Amos, it was still programming, and 156 00:07:46,939 --> 00:07:49,330 it still had conditionals and variables and all these 157 00:07:49,330 --> 00:07:52,099 other things I just did not understand. I, it's 158 00:07:52,099 --> 00:07:55,099 so funny, because, once you learn something, it can 159 00:07:55,099 --> 00:07:56,749 sometimes be hard to go back and think, like, 160 00:07:56,749 --> 00:07:58,339 how was it before I knew how to do 161 00:07:58,339 --> 00:08:02,129 this? But I distinctly remember, why would you have 162 00:08:02,129 --> 00:08:03,129 a variable? 163 00:08:03,129 --> 00:08:05,139 Like, if you just assign something once, why would 164 00:08:05,139 --> 00:08:06,699 you ever sort of want to change that? Why 165 00:08:06,699 --> 00:08:08,279 does it have to be a space. Why can't 166 00:08:08,279 --> 00:08:09,539 it just be the thing. Like, I did not 167 00:08:09,539 --> 00:08:11,849 get the concept of variables. 168 00:08:11,849 --> 00:08:14,539 And this is at, I don't know, age ten 169 00:08:14,539 --> 00:08:17,599 or whatever. So, still not getting programming. It's still 170 00:08:17,599 --> 00:08:21,860 not making any sense to me. So I gave 171 00:08:21,860 --> 00:08:24,509 up on that, too. 172 00:08:24,509 --> 00:08:28,659 Then, in 1993, I went to something called the 173 00:08:28,659 --> 00:08:32,799 Gathering. The Gathering three, which was a big demo 174 00:08:32,799 --> 00:08:37,339 party in Denmark, where people from all over Europe, 175 00:08:37,339 --> 00:08:39,419 maybe some from the U.S. as well, would gather 176 00:08:39,419 --> 00:08:42,289 to, to show off their skills of creating these 177 00:08:42,289 --> 00:08:43,190 demos. 178 00:08:43,190 --> 00:08:46,990 And demos were basically just, like, little music videos 179 00:08:46,990 --> 00:08:49,670 with computer graphics. And I thought that was really 180 00:08:49,670 --> 00:08:52,680 awesome. And, again, I got this sensation of, wow, 181 00:08:52,680 --> 00:08:56,040 that's amazing. People are creating these sequences, they look 182 00:08:56,040 --> 00:08:58,430 really good. This is, this is awesome. I'd love 183 00:08:58,430 --> 00:08:59,540 to be a part of that. 184 00:08:59,540 --> 00:09:03,040 This is '93, so I'm, I'm fourteen. And this 185 00:09:03,040 --> 00:09:06,120 demo party, and then I met pretty much everybody 186 00:09:06,120 --> 00:09:08,600 I knew for the next ten years in, in 187 00:09:08,600 --> 00:09:12,850 computer software, including Allen of TextMate fame. I was 188 00:09:12,850 --> 00:09:14,170 fourteen and he was part of one of these 189 00:09:14,170 --> 00:09:18,370 demo groups, and we got talking, and then ten 190 00:09:18,370 --> 00:09:22,829 years later, I'd help him release Textmate, and this 191 00:09:22,829 --> 00:09:24,639 is now twenty years ago. 192 00:09:24,639 --> 00:09:25,810 Anyway. 193 00:09:25,810 --> 00:09:27,709 I still didn't get the concept, right. Like, it 194 00:09:27,709 --> 00:09:29,949 was all, it was Assembler. So it was even 195 00:09:29,949 --> 00:09:35,050 harder and weirder to figure out than Amos was. 196 00:09:35,050 --> 00:09:37,269 It was vectors, it was math, it was, it 197 00:09:37,269 --> 00:09:40,720 was just really hard. So once again, this is 198 00:09:40,720 --> 00:09:43,509 the third time I tried to sort of figure 199 00:09:43,509 --> 00:09:45,620 out programming, because I want to build stuff. 200 00:09:45,620 --> 00:09:49,630 And the third time, it failed. 201 00:09:49,630 --> 00:09:52,000 So I ended up building another information system. At 202 00:09:52,000 --> 00:09:57,310 that time, there's something called BBS's. So pre-internet, you 203 00:09:57,310 --> 00:10:01,040 dialed up to basically every web site individually through 204 00:10:01,040 --> 00:10:04,360 a modem, and I ran one of those things. 205 00:10:04,360 --> 00:10:05,790 At that time, it was, it was called a 206 00:10:05,790 --> 00:10:08,420 Where's BBS, which is where we traded all the 207 00:10:08,420 --> 00:10:11,620 illegal software that we couldn't afford, and games, and 208 00:10:11,620 --> 00:10:11,970 demos. 209 00:10:11,970 --> 00:10:14,100 And I had a lot of fun doing that. 210 00:10:14,100 --> 00:10:16,480 I was fifteen and I was, I was working 211 00:10:16,480 --> 00:10:18,269 at a grocery store, and I spent all my 212 00:10:18,269 --> 00:10:22,839 money buying modems and phone lines. 213 00:10:22,839 --> 00:10:27,259 But sort of the long and the short of 214 00:10:27,259 --> 00:10:30,910 that is that I failed to identify with programming 215 00:10:30,910 --> 00:10:33,779 under the computer-science paradigm. 216 00:10:33,779 --> 00:10:37,089 Computer science, in itself, just didn't really appeal to 217 00:10:37,089 --> 00:10:40,389 me. Like, it didn't make sense to me. Learning 218 00:10:40,389 --> 00:10:44,860 programming through sort of the lens, the prism of, 219 00:10:44,860 --> 00:10:49,220 of hard science just, it didn't really, it just 220 00:10:49,220 --> 00:10:52,800 didn't click. And I was actually pretty disappointed for 221 00:10:52,800 --> 00:10:55,370 awhile. I had tried to learn programming three or 222 00:10:55,370 --> 00:10:58,060 four times over the past ten years of my, 223 00:10:58,060 --> 00:11:02,970 my life, and it just, it wasn't clicking. 224 00:11:02,970 --> 00:11:07,529 No surprise to sort of my teachers. This is 225 00:11:07,529 --> 00:11:10,720 my high school diploma, part of it, and it 226 00:11:10,720 --> 00:11:16,300 says math, final exam, F. And, and English, I 227 00:11:16,300 --> 00:11:19,920 got an A. But math was just never my 228 00:11:19,920 --> 00:11:21,910 thing. Physics never, was never my thing. 229 00:11:21,910 --> 00:11:24,779 Any of the hard sciences were just never my 230 00:11:24,779 --> 00:11:27,339 thing. And you say, oh, well that explains a 231 00:11:27,339 --> 00:11:29,779 lot. That's why Rails is so fucking slow. 232 00:11:29,779 --> 00:11:34,690 But it, it's true. It just never appealed to 233 00:11:34,690 --> 00:11:39,149 me. But, I think it also inoculated me with 234 00:11:39,149 --> 00:11:42,110 something really early on, which was, it disabused me 235 00:11:42,110 --> 00:11:44,620 of the thinking that I was a computer scientist. 236 00:11:44,620 --> 00:11:46,529 That I was ever going to come up with 237 00:11:46,529 --> 00:11:50,000 an algorithm. That I was ever going to make 238 00:11:50,000 --> 00:11:55,199 any ground-breaking discoveries at the low-level of, of computer 239 00:11:55,199 --> 00:11:57,160 science. 240 00:11:57,160 --> 00:11:59,920 And that was actually really a relief. Because when 241 00:11:59,920 --> 00:12:03,000 I finally got into programming, I knew that was 242 00:12:03,000 --> 00:12:04,209 just not what I was going to do with 243 00:12:04,209 --> 00:12:06,819 it. That was never, it wasn't my idol, it 244 00:12:06,819 --> 00:12:09,810 was not what I was chasing. I wanted to 245 00:12:09,810 --> 00:12:12,509 build information systems. Like all these attempts I had 246 00:12:12,509 --> 00:12:15,029 over the years, they were all about information systems. 247 00:12:15,029 --> 00:12:18,069 They were about using the computer to build something 248 00:12:18,069 --> 00:12:20,220 else that really didn't have much to do with 249 00:12:20,220 --> 00:12:24,560 the underlying things. That there were people, smart people, 250 00:12:24,560 --> 00:12:27,079 who had come up with algorithms underneath to, to 251 00:12:27,079 --> 00:12:30,699 make it all work, wonderful. I'm not one of 252 00:12:30,699 --> 00:12:31,129 them. 253 00:12:31,129 --> 00:12:33,170 And that's fine. 254 00:12:33,170 --> 00:12:39,060 I think as an industry, very few people have 255 00:12:39,060 --> 00:12:42,389 gotten to that realization. Even if it is, that 256 00:12:42,389 --> 00:12:45,779 they, on a daily basis, build information systems. Even 257 00:12:45,779 --> 00:12:48,300 if it is that they're working on yet another 258 00:12:48,300 --> 00:12:52,129 social network for sock puppets, or horror, in my 259 00:12:52,129 --> 00:12:57,360 case, yet another fucking to-do list. The aspiration of 260 00:12:57,360 --> 00:12:59,550 the whole industry, everyone in it, is that we're 261 00:12:59,550 --> 00:13:01,379 all programmers. 262 00:13:01,379 --> 00:13:02,339 Right? 263 00:13:02,339 --> 00:13:09,339 No we're not. I am nothing like Linus, right. 264 00:13:09,670 --> 00:13:12,410 He's actually a real computer scientist. To figure out 265 00:13:12,410 --> 00:13:14,560 how to, I don't know, fucking improve the scheduler 266 00:13:14,560 --> 00:13:20,819 in the kernel. Shew. No clue. No interest. All 267 00:13:20,819 --> 00:13:21,569 good. 268 00:13:21,569 --> 00:13:25,220 I am ever in debt that there are people 269 00:13:25,220 --> 00:13:28,610 like that out there who can do this stuff. 270 00:13:28,610 --> 00:13:30,149 So I don't have to do it. So I 271 00:13:30,149 --> 00:13:33,980 can focus on something else. But I think most 272 00:13:33,980 --> 00:13:36,540 programmers think that, oh yeah, that, that's what I 273 00:13:36,540 --> 00:13:39,899 do. Yeah, I work information systems, but, we're kind 274 00:13:39,899 --> 00:13:42,290 of colleagues, right? Me and Linus here. 275 00:13:42,290 --> 00:13:45,720 I'm pretty sure that he would tell you, fuck 276 00:13:45,720 --> 00:13:49,480 you. We're nothing alike. We are not colleagues. What 277 00:13:49,480 --> 00:13:52,620 you do is making another fucking to do list. 278 00:13:52,620 --> 00:13:57,410 I'm improving the fucking kernel of Linux. Far more 279 00:13:57,410 --> 00:14:00,620 important work. He would disabuse you of your delusions 280 00:14:00,620 --> 00:14:06,600 of grandeur real quick. 281 00:14:06,600 --> 00:14:08,360 And I think that's a real shame. I think 282 00:14:08,360 --> 00:14:12,350 it's a real shame that if you sort of 283 00:14:12,350 --> 00:14:15,970 pick your heroes in such a impossible fashion, that 284 00:14:15,970 --> 00:14:17,850 they're actually nothing like you and you will be 285 00:14:17,850 --> 00:14:20,050 nothing like them, you're gonna set yourself up for 286 00:14:20,050 --> 00:14:22,189 a bad time for the whole ride. 287 00:14:22,189 --> 00:14:27,389 The truth of the matter is that most information 288 00:14:27,389 --> 00:14:31,550 system development has very little to do with science. 289 00:14:31,550 --> 00:14:35,439 Yes, it's all built on top of computer science. 290 00:14:35,439 --> 00:14:38,329 Yes, computer science is what makes it possible for 291 00:14:38,329 --> 00:14:40,730 us to do what it is that we do. 292 00:14:40,730 --> 00:14:44,610 But it doesn't define what we do. 293 00:14:44,610 --> 00:14:46,699 And I think in many ways that prism of 294 00:14:46,699 --> 00:14:50,850 computer science is harmful to the development of information 295 00:14:50,850 --> 00:14:55,000 systems. It's actually not a good view on the 296 00:14:55,000 --> 00:14:59,089 world to have. Just because you can make, you're 297 00:14:59,089 --> 00:15:00,610 Steingraeber and Sohne, and you can make the best 298 00:15:00,610 --> 00:15:02,610 piano in the world, that doesn't make you a 299 00:15:02,610 --> 00:15:05,579 great pianist. It doesn't mean you can play wonderful 300 00:15:05,579 --> 00:15:08,529 tunes. Just because you can create the foundations of 301 00:15:08,529 --> 00:15:12,480 which other people can build upon, just because you're 302 00:15:12,480 --> 00:15:15,800 a great computer scientist, doesn't mean you're a great 303 00:15:15,800 --> 00:15:18,360 software writer. 304 00:15:18,360 --> 00:15:22,300 Doesn't mean you're a great programmer of information systems. 305 00:15:22,300 --> 00:15:25,519 And most of all, if you are committed to 306 00:15:25,519 --> 00:15:28,129 building information systems, and I am wholly committed to 307 00:15:28,129 --> 00:15:30,910 building information systems, I've given up the notion, long 308 00:15:30,910 --> 00:15:33,399 ago, that I was going to get into games 309 00:15:33,399 --> 00:15:37,149 programming or vector programming or anything else that sounds 310 00:15:37,149 --> 00:15:41,139 like hard science and is hard. 311 00:15:41,139 --> 00:15:42,639 I think you're gonna be much better off. But 312 00:15:42,639 --> 00:15:45,389 I think it's also really tough, because I think 313 00:15:45,389 --> 00:15:49,160 most of the paths, the celebrated paths into programming 314 00:15:49,160 --> 00:15:53,009 go through courses called computer science. So you're sort 315 00:15:53,009 --> 00:15:56,079 of taught right from the get go that computer 316 00:15:56,079 --> 00:16:00,189 science, like that is the ultimate ideal, and what 317 00:16:00,189 --> 00:16:02,379 you're doing here is just sort of piddling along 318 00:16:02,379 --> 00:16:05,300 until you can get to this top of the 319 00:16:05,300 --> 00:16:06,620 mountain. 320 00:16:06,620 --> 00:16:08,360 Even worse, if you actually have a degree in 321 00:16:08,360 --> 00:16:13,749 computer science, right, and now you're slumming it, with 322 00:16:13,749 --> 00:16:16,439 yet another social network, or, yet another fucking to-do 323 00:16:16,439 --> 00:16:19,649 list. I mean, that's a recipe for self-loathing if 324 00:16:19,649 --> 00:16:21,749 I ever knew one. 325 00:16:21,749 --> 00:16:24,589 But, as I say, this is mostly about the 326 00:16:24,589 --> 00:16:27,240 prism of how you're looking at programming, what is 327 00:16:27,240 --> 00:16:30,480 programming, what is writing software. What is that we 328 00:16:30,480 --> 00:16:34,610 do every day when we create information systems? 329 00:16:34,610 --> 00:16:36,519 And if you look at it from this prism 330 00:16:36,519 --> 00:16:41,459 of the hard sciences, you think, well, Law of 331 00:16:41,459 --> 00:16:45,310 Thermodynamics. Physics. This is, this is the real serious 332 00:16:45,310 --> 00:16:48,800 hard stuff, right. You will laugh at French poetry. 333 00:16:48,800 --> 00:16:51,899 Ha, ha, ha, ha! They're all just, what, analyzing 334 00:16:51,899 --> 00:16:54,889 what some schmuck in the 1700s did, and there's 335 00:16:54,889 --> 00:16:58,249 a thousand different interpretations of, of what that person 336 00:16:58,249 --> 00:17:00,819 actually wrote and what does that actually mean? Like, 337 00:17:00,819 --> 00:17:04,490 that's pathetic, right. You can't arrive at any ultimate, 338 00:17:04,490 --> 00:17:06,430 clear, universal truths. 339 00:17:06,430 --> 00:17:11,339 Math! There's a truth. There's a final result. Physics. 340 00:17:11,339 --> 00:17:14,119 There's a truth. We're knowing more about the natural 341 00:17:14,119 --> 00:17:18,500 world in a way where we can be completely 342 00:17:18,500 --> 00:17:22,900 confident. Mostly. In what we know. Certainly in math, 343 00:17:22,900 --> 00:17:23,380 right. 344 00:17:23,380 --> 00:17:28,539 If you carry that over into programming, you end 345 00:17:28,539 --> 00:17:35,100 up with shit like this. Law of Demeter. Practices 346 00:17:35,100 --> 00:17:40,860 and principles who sort of project that they're universal 347 00:17:40,860 --> 00:17:44,590 truths about the natural world, that this is how 348 00:17:44,590 --> 00:17:47,159 good programs are made, and this is not really 349 00:17:47,159 --> 00:17:50,320 an argument. The only argument is whether you're professional 350 00:17:50,320 --> 00:17:53,370 and following the laws, or you're an amateur and 351 00:17:53,370 --> 00:17:58,070 you're breaking them. 352 00:17:58,070 --> 00:17:59,990 When I look at computer programming, and when I 353 00:17:59,990 --> 00:18:04,000 reach most, read most programs, I'm not reading hard 354 00:18:04,000 --> 00:18:07,470 sciences. It is much more like studying 17th century 355 00:18:07,470 --> 00:18:10,020 French poetry. What the fuck did this guy mean? 356 00:18:10,020 --> 00:18:13,210 Like, I can't follow this at all. Like, is 357 00:18:13,210 --> 00:18:16,909 this some weird reference to some play somewhere? What's 358 00:18:16,909 --> 00:18:18,090 going on here? 359 00:18:18,090 --> 00:18:20,950 It's actually more like forensics. It's more like analysis. 360 00:18:20,950 --> 00:18:24,010 It's much more subjective. Like, what is actually going 361 00:18:24,010 --> 00:18:27,650 on? What were they trying to communicate? What's just 362 00:18:27,650 --> 00:18:29,840 going on here, right? 363 00:18:29,840 --> 00:18:32,860 So, I find it so funny that, that programmers 364 00:18:32,860 --> 00:18:37,380 who work in programming, and they laugh at all 365 00:18:37,380 --> 00:18:40,960 these subjective fields of endeavor, when that is what 366 00:18:40,960 --> 00:18:44,570 they do every day. They just, no, what I'm 367 00:18:44,570 --> 00:18:48,580 doing is computer science. This is empirical truth, blah, 368 00:18:48,580 --> 00:18:52,110 blah, blah, we have laws, blah, blah, blah. 369 00:18:52,110 --> 00:18:54,190 I think the, the bottom line is that is 370 00:18:54,190 --> 00:18:55,799 when you go in with that notion, when you 371 00:18:55,799 --> 00:18:57,549 go in with the notion that we can actually 372 00:18:57,549 --> 00:19:02,120 discover laws of programming, like, Law of Demeter, of 373 00:19:02,120 --> 00:19:04,620 how we should be creating our programs, you lull 374 00:19:04,620 --> 00:19:10,200 yourself into this belief that there are some practices 375 00:19:10,200 --> 00:19:13,200 that are just true. They're not up for debate. 376 00:19:13,200 --> 00:19:15,210 They're not up for discussion. 377 00:19:15,210 --> 00:19:19,890 They're science. That what we do is science. Well, 378 00:19:19,890 --> 00:19:22,230 I think there's another word for, sort of, those 379 00:19:22,230 --> 00:19:29,230 delusions. Pseudoscience. When people think they're doing science and 380 00:19:30,159 --> 00:19:34,460 they're not actually doing science. That's pseudoscience. I think 381 00:19:34,460 --> 00:19:38,380 a lot of what's going on in software, methodology, 382 00:19:38,380 --> 00:19:41,610 practices, is pseudoscience. 383 00:19:41,610 --> 00:19:43,640 Which would be fine if people would accept that 384 00:19:43,640 --> 00:19:46,190 and say, yes, what I'm doing is pseudo science. 385 00:19:46,190 --> 00:19:48,520 Like, I'm not finding any grand truths here, but 386 00:19:48,520 --> 00:19:51,690 they're not, right. They're ex-pouting that this is, this 387 00:19:51,690 --> 00:19:52,640 is the truth. 388 00:19:52,640 --> 00:19:59,640 Well, here's another pseudoscience. Diet schemes. I think diets 389 00:20:00,270 --> 00:20:06,429 are actually incredibly similar to most software methodology approaches. 390 00:20:06,429 --> 00:20:10,900 They all sort of espouse that I have the 391 00:20:10,900 --> 00:20:13,610 truth, what you need to get slim and healthy 392 00:20:13,610 --> 00:20:17,210 is the ten-day green smoothie cleanse. 393 00:20:17,210 --> 00:20:18,539 That is the truth. That's how you get it, 394 00:20:18,539 --> 00:20:22,210 right. And then you, shit, that, that's, OK, smoothies. 395 00:20:22,210 --> 00:20:25,340 Sounds good. But what about this super shred diet? 396 00:20:25,340 --> 00:20:28,260 Like, I lose twenty pounds in four weeks? That's 397 00:20:28,260 --> 00:20:30,640 certainly better than ten pounds in, I don't know, 398 00:20:30,640 --> 00:20:33,279 ten weeks, or whatever that hungry diet girl is 399 00:20:33,279 --> 00:20:35,820 promising. I'll go with that super shred guy, like 400 00:20:35,820 --> 00:20:37,970 he's got to have the truth, right. 401 00:20:37,970 --> 00:20:40,620 And it's so funny, if you read any diet 402 00:20:40,620 --> 00:20:42,289 books, and diet books are incredibly popular. If you 403 00:20:42,289 --> 00:20:44,270 look at the most popular book on Amazon, the 404 00:20:44,270 --> 00:20:46,270 top one hundred list, a lot of them are 405 00:20:46,270 --> 00:20:50,529 diet books. People want to be told how they 406 00:20:50,529 --> 00:20:53,899 can cheat the basics. I think software development is 407 00:20:53,899 --> 00:20:55,529 exactly like that. 408 00:20:55,529 --> 00:20:58,779 I think software developers are exactly like people trying 409 00:20:58,779 --> 00:21:03,870 to lose ten pounds and thinking, you know what, 410 00:21:03,870 --> 00:21:07,210 all this exercising, just eating healthier, that's a little 411 00:21:07,210 --> 00:21:09,330 too hard. Let's, let's listen to this super shred 412 00:21:09,330 --> 00:21:09,960 guy. 413 00:21:09,960 --> 00:21:11,600 He's got to have the answer. An answer that's 414 00:21:11,600 --> 00:21:16,649 less painful, less simple and basic. There's got to 415 00:21:16,649 --> 00:21:19,370 be some grand secret I just don't know yet. 416 00:21:19,370 --> 00:21:21,909 If I can just learn the secret then everything's 417 00:21:21,909 --> 00:21:25,159 gonna be great, right. But it's pseudoscience. Those diets 418 00:21:25,159 --> 00:21:31,260 are based on anecdotes. They're based on one guy 419 00:21:31,260 --> 00:21:33,360 trying something, or, or looking at a few people, 420 00:21:33,360 --> 00:21:37,980 a tiny sample size, it's just pure, poor, pure 421 00:21:37,980 --> 00:21:39,860 poor science. 422 00:21:39,860 --> 00:21:44,049 External variables, uncontrolled experiments that run for too long. 423 00:21:44,049 --> 00:21:46,480 You can't derive any absolute truths from it. But 424 00:21:46,480 --> 00:21:51,860 people keep arriving at absolute truths. 425 00:21:51,860 --> 00:21:55,909 And just like feeling a little overweight, and most 426 00:21:55,909 --> 00:21:58,070 people do at some point in their life. Everybody 427 00:21:58,070 --> 00:22:00,179 wants to lose whatever it is. They want to 428 00:22:00,179 --> 00:22:02,080 feel healthier even if they are at the correct 429 00:22:02,080 --> 00:22:04,549 weight. They want to be in better shape. All 430 00:22:04,549 --> 00:22:07,230 our code bases are exactly like that. 431 00:22:07,230 --> 00:22:09,090 Everyone has like, oh I'd love that this part 432 00:22:09,090 --> 00:22:11,230 of the code base, it's not that clean, right. 433 00:22:11,230 --> 00:22:13,779 So we have that same feeling of being a 434 00:22:13,779 --> 00:22:19,220 little insecure about our quote code quality, just like 435 00:22:19,220 --> 00:22:21,510 most people are a little insecure, at least at 436 00:22:21,510 --> 00:22:25,279 certain times in their life, about their body, right. 437 00:22:25,279 --> 00:22:27,789 So we're ripe for somebody to come in and 438 00:22:27,789 --> 00:22:32,260 tell us what's wrong. To fix it for us 439 00:22:32,260 --> 00:22:34,100 by just saying, oh, no, no, no, you don't 440 00:22:34,100 --> 00:22:35,960 have to do any of the hard stuff. Writing 441 00:22:35,960 --> 00:22:37,320 good code, do you know what that's about? It's 442 00:22:37,320 --> 00:22:40,970 about this one practice. This one secret that they 443 00:22:40,970 --> 00:22:42,750 don't want you to know. 444 00:22:42,750 --> 00:22:45,880 If I teach you that, then all your code 445 00:22:45,880 --> 00:22:48,679 is going to be wonderful. But right now, you're 446 00:22:48,679 --> 00:22:52,360 not a professional. You're an amateur. You're writing dirty 447 00:22:52,360 --> 00:22:56,429 code. You should feel really bad about that. You 448 00:22:56,429 --> 00:22:58,039 have sinned. 449 00:22:58,039 --> 00:23:02,149 But, I will give you absolution. I have the 450 00:23:02,149 --> 00:23:06,059 pathway to clean code. 451 00:23:06,059 --> 00:23:10,850 And it hits a lot of people right in 452 00:23:10,850 --> 00:23:14,830 the impostor plexus. Like, ugh, you're saying my code 453 00:23:14,830 --> 00:23:17,020 is dirty? Yeah, I guess it is a little 454 00:23:17,020 --> 00:23:19,710 dirty. There's this one part that's, like, shit, maybe 455 00:23:19,710 --> 00:23:22,789 I'm not really a computer scientist. Maybe it doesn't 456 00:23:22,789 --> 00:23:26,690 really, I don't really belong here amongst the programmers. 457 00:23:26,690 --> 00:23:28,710 Can you please tell me, how do I get 458 00:23:28,710 --> 00:23:32,270 to be a computer scientist? 459 00:23:32,270 --> 00:23:36,600 How can I get to belong amongst the esteemed 460 00:23:36,600 --> 00:23:41,059 professional programmers? Can you tell me how? And there 461 00:23:41,059 --> 00:23:44,090 are lots of people willing to tell you how. 462 00:23:44,090 --> 00:23:46,679 That the salvation will come through these patterns and 463 00:23:46,679 --> 00:23:49,159 practices, and as long as you follow these ten 464 00:23:49,159 --> 00:23:54,659 commandments of good code, all shall be well. 465 00:23:54,659 --> 00:23:56,990 OK. 466 00:23:56,990 --> 00:24:00,450 I think the most popular commandment, I'm gonna spend 467 00:24:00,450 --> 00:24:02,950 some time on that, the most popular practice, the 468 00:24:02,950 --> 00:24:06,570 most popular pattern for making people feel shitty about 469 00:24:06,570 --> 00:24:09,049 their code and shitty about themselves and shitty about 470 00:24:09,049 --> 00:24:16,049 their path through programming, is TDD. 471 00:24:17,960 --> 00:24:23,370 TDD is the most successful software diet of all 472 00:24:23,370 --> 00:24:30,370 times. It's so alluring, it has such an appeal 473 00:24:31,380 --> 00:24:34,679 in its basic principles, that everyone gets wrapped up 474 00:24:34,679 --> 00:24:37,100 in it. I got wrapped up in it for 475 00:24:37,100 --> 00:24:41,860 quite awhile. I got wrapped up in the storytelling 476 00:24:41,860 --> 00:24:47,149 that all software before TDD was shit and unprofessional. 477 00:24:47,149 --> 00:24:49,039 And that the only way to arrive at clean 478 00:24:49,039 --> 00:24:54,269 code was to follow the principles of TDD. 479 00:24:54,269 --> 00:24:57,190 And the principles of TDD, mind you, are not 480 00:24:57,190 --> 00:25:02,130 about the tests. It's about test first. It's about 481 00:25:02,130 --> 00:25:07,370 test-driven design, right. That we have tests afterwards, that's 482 00:25:07,370 --> 00:25:12,760 just an accidental side-effect. A benefit, if you will, 483 00:25:12,760 --> 00:25:15,179 after the fact. And it's the perfect diet. 484 00:25:15,179 --> 00:25:20,080 I tried multiple times, which is usually how it 485 00:25:20,080 --> 00:25:22,269 goes with diets, we try one and it doesn't 486 00:25:22,269 --> 00:25:25,110 really work and we fall off the wagon and 487 00:25:25,110 --> 00:25:26,610 then a few months later you try again and 488 00:25:26,610 --> 00:25:28,190 you feel bad about it the whole time and 489 00:25:28,190 --> 00:25:29,419 that's how I felt about TDD for a long 490 00:25:29,419 --> 00:25:29,740 time. 491 00:25:29,740 --> 00:25:32,169 I felt like TDD was what I was supposed 492 00:25:32,169 --> 00:25:34,809 to do. I was supposed to write all my 493 00:25:34,809 --> 00:25:37,669 tests first, and then I would be allowed to 494 00:25:37,669 --> 00:25:42,279 write my code. And it just didn't work. I 495 00:25:42,279 --> 00:25:45,059 kept just feeling like, this is not, I'm not 496 00:25:45,059 --> 00:25:48,340 arriving at something better here. When I'm driving my 497 00:25:48,340 --> 00:25:51,510 design by writing my tests first, the code I 498 00:25:51,510 --> 00:25:55,809 look at afterwards, it's not better. It's not cleaner. 499 00:25:55,809 --> 00:26:00,500 The dirty code I wrote without being test-driven first, 500 00:26:00,500 --> 00:26:02,390 it actually looks better. 501 00:26:02,390 --> 00:26:06,519 But, so successful has TDD been, that for the 502 00:26:06,519 --> 00:26:09,919 longest time, until actually fairly recently, I just thought, 503 00:26:09,919 --> 00:26:12,070 well, I'm the wrong-doer. I'm the one doing it 504 00:26:12,070 --> 00:26:16,399 wrong. TDD is not at fault, right. Just because 505 00:26:16,399 --> 00:26:19,190 everybody's doing TDD wrong, doesn't mean that there's anything 506 00:26:19,190 --> 00:26:21,710 wrong with TDD. There's just something wrong with all 507 00:26:21,710 --> 00:26:23,890 of you. That's the problem. 508 00:26:23,890 --> 00:26:26,399 If you would just be more faithful to the 509 00:26:26,399 --> 00:26:28,730 practices, then everything would be great. 510 00:26:28,730 --> 00:26:31,100 And that's what makes it such a great diet. 511 00:26:31,100 --> 00:26:33,500 That it keeps people in the perpetual state of 512 00:26:33,500 --> 00:26:37,659 feeling inadequate. So, you keep having to buy more 513 00:26:37,659 --> 00:26:42,519 books, and attend more conference talks, and attend more 514 00:26:42,519 --> 00:26:44,940 workshops, and hire more consultants, to teach you to 515 00:26:44,940 --> 00:26:50,909 be truer to the religion of TDD. Hogwash. 516 00:26:50,909 --> 00:26:54,380 Let's look at some code. So here's a very 517 00:26:54,380 --> 00:26:58,570 simple piece of code. Person has an age method, 518 00:26:58,570 --> 00:27:01,570 that calculates how old somebody is. And we have 519 00:27:01,570 --> 00:27:04,880 a test for it. This piece of code depends 520 00:27:04,880 --> 00:27:06,220 on the world. 521 00:27:06,220 --> 00:27:11,110 It directly refers to date today. It's a explicit 522 00:27:11,110 --> 00:27:13,649 dependency. You cannot change it in there. Well, in 523 00:27:13,649 --> 00:27:15,750 a lot of languages, that's a problem. Like, how 524 00:27:15,750 --> 00:27:17,679 are you actually going to test this if you 525 00:27:17,679 --> 00:27:19,419 can't somehow figure out how to change the date 526 00:27:19,419 --> 00:27:21,470 of today. Like, every time you run your test 527 00:27:21,470 --> 00:27:23,490 it might be a different day and it might 528 00:27:23,490 --> 00:27:24,279 be broken. 529 00:27:24,279 --> 00:27:27,019 Well, in Ruby it's really easy. We just stop 530 00:27:27,019 --> 00:27:29,059 that constant and make it work. That's what the 531 00:27:29,059 --> 00:27:32,000 travel-to method is about, right. 532 00:27:32,000 --> 00:27:34,299 Proponents of TDD will look at that code and 533 00:27:34,299 --> 00:27:41,299 say, dirty, dirty code. Explicit dependencies hidden inside. You're 534 00:27:41,360 --> 00:27:44,980 mocking a global object? What the fuck? 535 00:27:44,980 --> 00:27:48,360 You need to shape up. Here's the shaped up 536 00:27:48,360 --> 00:27:52,029 version. We inject our dependency, so we have a 537 00:27:52,029 --> 00:27:55,490 default of date.today, but we can put in our 538 00:27:55,490 --> 00:27:57,600 own, in the test, we can put in our 539 00:27:57,600 --> 00:28:00,870 own date, right. This is much cleaner. Right. No. 540 00:28:00,870 --> 00:28:03,779 Great. We improved our code base. 541 00:28:03,779 --> 00:28:07,610 Did we? Is this a better code base? Is 542 00:28:07,610 --> 00:28:10,720 this method better than what we just had there? 543 00:28:10,720 --> 00:28:13,720 Is it simpler? Is it clearer? No. It's easier 544 00:28:13,720 --> 00:28:18,029 to test. And that's the important point, right. That's 545 00:28:18,029 --> 00:28:19,549 the important point in all of these debates, is 546 00:28:19,549 --> 00:28:21,519 just, is it easier to test? 547 00:28:21,519 --> 00:28:23,559 That's the measure of success. I think that's a 548 00:28:23,559 --> 00:28:26,419 shitty measure of success. I think there are much 549 00:28:26,419 --> 00:28:29,769 higher ideals than just whether something is easy to 550 00:28:29,769 --> 00:28:34,169 test. But it gets worse. 551 00:28:34,169 --> 00:28:36,159 Here's another example. If you actually have a method 552 00:28:36,159 --> 00:28:39,169 that depends on another method, we have to inject 553 00:28:39,169 --> 00:28:41,500 the dependency all the way down, now you're really 554 00:28:41,500 --> 00:28:43,510 muddying things up and now the code is really 555 00:28:43,510 --> 00:28:45,929 starting to get nasty. And this is such a 556 00:28:45,929 --> 00:28:49,200 simple example. I've actually posted this example online before 557 00:28:49,200 --> 00:28:51,809 and had arguments with TDD proponents about that. 558 00:28:51,809 --> 00:28:53,380 And, yes, this is, I'm like, well, what does 559 00:28:53,380 --> 00:28:57,029 it matter? You're just injecting one dependency, what does 560 00:28:57,029 --> 00:28:58,740 it matter? It's not that big of a deal, 561 00:28:58,740 --> 00:29:00,090 right? Yes it is. 562 00:29:00,090 --> 00:29:02,820 Because this is exactly the type of thinking that 563 00:29:02,820 --> 00:29:05,899 leads you down a really nasty path. Let's look 564 00:29:05,899 --> 00:29:07,019 at another example. 565 00:29:07,019 --> 00:29:11,929 Here's a standard Rails controller. It has reliance on 566 00:29:11,929 --> 00:29:14,429 the world. It relies on a before action that 567 00:29:14,429 --> 00:29:19,389 ensures permissions. It sets up a new object and 568 00:29:19,389 --> 00:29:21,630 sends out an email and then it responds to 569 00:29:21,630 --> 00:29:24,330 something, right. The whole purpose of the controller in 570 00:29:24,330 --> 00:29:27,470 Rails is to sort of direct the world. It's 571 00:29:27,470 --> 00:29:28,880 to interact with the world. 572 00:29:28,880 --> 00:29:31,730 But how do you unit test that, right? That's 573 00:29:31,730 --> 00:29:34,159 really hard. It's relying on the entire world. If 574 00:29:34,159 --> 00:29:37,500 we're following this scientific approach of unit testing where 575 00:29:37,500 --> 00:29:40,480 we're isolating all the variables, holding everything else constant 576 00:29:40,480 --> 00:29:43,269 except for these two things, what goes in, what 577 00:29:43,269 --> 00:29:49,740 goes out. This is bad, right. 578 00:29:49,740 --> 00:29:53,519 If we instead put in something like a person 579 00:29:53,519 --> 00:29:56,269 creation command and hide away all the actual doing 580 00:29:56,269 --> 00:29:58,149 of the control and then we inject all the 581 00:29:58,149 --> 00:30:00,990 stuff that it depends on we can test person 582 00:30:00,990 --> 00:30:04,190 creation command really well. 583 00:30:04,190 --> 00:30:07,470 Is that code better? Is that code simpler? Is 584 00:30:07,470 --> 00:30:09,510 it clearer? Would you rather look at this and 585 00:30:09,510 --> 00:30:11,080 then understand what the system does or would you 586 00:30:11,080 --> 00:30:13,299 rather look at this and try to figure out 587 00:30:13,299 --> 00:30:16,149 where does this thing go? 588 00:30:16,149 --> 00:30:21,639 And that's the consequence of this chase of test-first. 589 00:30:21,639 --> 00:30:23,960 It leads you down a path where the gospel 590 00:30:23,960 --> 00:30:28,139 of test-driven design is that anything that's easier to 591 00:30:28,139 --> 00:30:32,549 test is better. That's it. That's the measure of 592 00:30:32,549 --> 00:30:35,590 quality. If you can test it easily it's better. 593 00:30:35,590 --> 00:30:39,059 If you can't test it easily, it's worse. 594 00:30:39,059 --> 00:30:43,010 Boo. Exactly right. Boo. 595 00:30:43,010 --> 00:30:45,830 It's not better. We're losing sight of what we're 596 00:30:45,830 --> 00:30:48,659 actually trying to do. Tests were supposed to support 597 00:30:48,659 --> 00:30:53,950 us. They weren't supposed to be the main thing. 598 00:30:53,950 --> 00:30:55,289 And I think this is leading to a lot 599 00:30:55,289 --> 00:31:00,889 of Zombie astronautic architectures. Things that I thought we 600 00:31:00,889 --> 00:31:04,480 moved past long ago. If you look at, at 601 00:31:04,480 --> 00:31:07,980 this person create command, that reminds me very much 602 00:31:07,980 --> 00:31:11,010 about Struts 1 point 2, and how they had 603 00:31:11,010 --> 00:31:12,880 every action as their own object. And that it 604 00:31:12,880 --> 00:31:15,169 was great because it was easy to test, and 605 00:31:15,169 --> 00:31:16,169 it was shit when you were trying to put 606 00:31:16,169 --> 00:31:19,179 a whole architecture together, because you had all these 607 00:31:19,179 --> 00:31:20,409 create commands and all of the sudden you had 608 00:31:20,409 --> 00:31:22,250 a million objects. Yes, they were easier to test, 609 00:31:22,250 --> 00:31:26,340 but the system was much harder to reason about. 610 00:31:26,340 --> 00:31:28,669 You see the same thing around ActiveRecord, for example. 611 00:31:28,669 --> 00:31:32,200 You see, well ActiveRecord should just be data access 612 00:31:32,200 --> 00:31:34,080 objects. They shouldn't actually have any logic. They should 613 00:31:34,080 --> 00:31:36,139 just be about interfacing with the database, because then 614 00:31:36,139 --> 00:31:38,340 we can split out everything else. Our domain logic, 615 00:31:38,340 --> 00:31:40,720 it's just that it doesn't have to touch the 616 00:31:40,720 --> 00:31:43,009 database, so that our tests can be simple, so 617 00:31:43,009 --> 00:31:46,070 that our tests can be fast, right? 618 00:31:46,070 --> 00:31:52,919 Again. Order of priority. Test, test fast, oh, your 619 00:31:52,919 --> 00:31:58,519 architecture. That'll just fall from that, right? 620 00:31:58,519 --> 00:32:02,880 I recently read James Coplien, has a great paper 621 00:32:02,880 --> 00:32:06,220 out called "Why Most Unit Testing is Waste." And 622 00:32:06,220 --> 00:32:09,809 for me, this is the money quote. Splitting up 623 00:32:09,809 --> 00:32:13,639 functions to support the testing process, destroys your system 624 00:32:13,639 --> 00:32:17,809 architecture and code comprehension along with it. Test at 625 00:32:17,809 --> 00:32:22,330 a coarser level of granularity. 626 00:32:22,330 --> 00:32:28,740 TDD is focused on the unit. The unit is 627 00:32:28,740 --> 00:32:31,440 the sacred piece, because that's the science piece. That's 628 00:32:31,440 --> 00:32:33,419 what we can control all of the variables. We're 629 00:32:33,419 --> 00:32:35,950 just looking at these few pieces, right. 630 00:32:35,950 --> 00:32:39,230 What James is saying, maybe that's not the right 631 00:32:39,230 --> 00:32:44,009 level. Maybe testing, the role it should have, shouldn't 632 00:32:44,009 --> 00:32:47,779 be about the unit most of the time. And, 633 00:32:47,779 --> 00:32:50,019 I sort of alluded to this awhile back, I 634 00:32:50,019 --> 00:32:54,220 wrote a post called Testing Like the TSA, and 635 00:32:54,220 --> 00:32:56,470 the main thing about that was about over-testing and 636 00:32:56,470 --> 00:32:58,480 sort of this testing theater that goes on. But 637 00:32:58,480 --> 00:33:02,360 I hadn't really made the switch that it, the 638 00:33:02,360 --> 00:33:03,980 problem is that we're trying to test at the 639 00:33:03,980 --> 00:33:05,059 wrong level. 640 00:33:05,059 --> 00:33:07,110 It's not testing itself. Testing is great. I'm not 641 00:33:07,110 --> 00:33:10,399 advocating that we shouldn't have tests. I'm advocating that 642 00:33:10,399 --> 00:33:14,080 driving your design from unit tests is actually not 643 00:33:14,080 --> 00:33:17,559 a good idea. That you actually end up destroying 644 00:33:17,559 --> 00:33:20,039 your system architecture and your code comprehension along with 645 00:33:20,039 --> 00:33:21,559 it. 646 00:33:21,559 --> 00:33:26,019 So if unit tests aren't the thing, what could 647 00:33:26,019 --> 00:33:26,850 we do instead? 648 00:33:26,850 --> 00:33:29,620 Well, I think there are higher levels of testing. 649 00:33:29,620 --> 00:33:31,269 We've already sort of moved to that in Rails. 650 00:33:31,269 --> 00:33:33,659 It's no longer called test unit, where you place 651 00:33:33,659 --> 00:33:37,090 your tests, it's called test models. That's already one 652 00:33:37,090 --> 00:33:40,399 step up. That sort of frees you from feeling 653 00:33:40,399 --> 00:33:42,570 bad about the fact that your, your model tests 654 00:33:42,570 --> 00:33:44,970 actually touch the database. That's not a bad thing. 655 00:33:44,970 --> 00:33:46,950 Yes. They run slower. But they also test more 656 00:33:46,950 --> 00:33:47,690 things. 657 00:33:47,690 --> 00:33:49,179 You can make anything fast if it doesn't have 658 00:33:49,179 --> 00:33:52,009 to work. 659 00:33:52,009 --> 00:33:53,880 And I think that's the problem with testing in 660 00:33:53,880 --> 00:33:55,139 a lot of cases. We recently had a really 661 00:33:55,139 --> 00:33:57,330 bad bug on base kim where we actually lost 662 00:33:57,330 --> 00:34:01,009 some data for real customers. And it was incredibly 663 00:34:01,009 --> 00:34:05,779 well-tested at the unit level. And all the tests 664 00:34:05,779 --> 00:34:08,179 passed. And still we lost data. How the fuck 665 00:34:08,179 --> 00:34:09,918 did that happen? 666 00:34:09,918 --> 00:34:11,750 It happened because we were so focused on driving 667 00:34:11,750 --> 00:34:14,190 our design from the unit test level, we didn't 668 00:34:14,190 --> 00:34:17,050 have any system tests for that particular thing. And 669 00:34:17,050 --> 00:34:18,580 it was a really simple thing. It was like, 670 00:34:18,580 --> 00:34:21,110 if you were editing an object and you were 671 00:34:21,110 --> 00:34:22,520 editing the attachments, you could lose an attachment. And 672 00:34:22,520 --> 00:34:25,560 we lost some attachments and it was a terrible 673 00:34:25,560 --> 00:34:26,679 thing. 674 00:34:26,679 --> 00:34:29,949 And after that, sort of thought, wait a minute. 675 00:34:29,949 --> 00:34:33,210 All these unit tests are just focusing on these 676 00:34:33,210 --> 00:34:36,139 core objects in the system. These individual unit pieces. 677 00:34:36,139 --> 00:34:38,179 It doesn't say anything about whether the whole system 678 00:34:38,179 --> 00:34:38,829 works. 679 00:34:38,829 --> 00:34:42,899 Most TDD proponents, I find, are much more focused 680 00:34:42,899 --> 00:34:45,159 on the unit level, because that's where they're driving 681 00:34:45,159 --> 00:34:47,219 their design. And they're not very much focused on 682 00:34:47,219 --> 00:34:49,149 the system level at all, which is what people 683 00:34:49,149 --> 00:34:50,190 actually give a shit about. 684 00:34:50,190 --> 00:34:52,649 Does the system work? I don't care about whether 685 00:34:52,649 --> 00:34:55,750 your units work. Does the whole thing work? That's 686 00:34:55,750 --> 00:34:57,760 what matters. 687 00:34:57,760 --> 00:35:00,450 So that kind of freed my mind up a 688 00:35:00,450 --> 00:35:03,230 little bit. That if we give up this need 689 00:35:03,230 --> 00:35:05,240 for hard science experience, where we have to control 690 00:35:05,240 --> 00:35:07,140 all the variables and boil everything down to a 691 00:35:07,140 --> 00:35:09,220 single unit that can be tested, we can float 692 00:35:09,220 --> 00:35:11,900 freely with the world. 693 00:35:11,900 --> 00:35:13,530 Awesome. 694 00:35:13,530 --> 00:35:18,140 This realization, I came to realize, was why people 695 00:35:18,140 --> 00:35:22,740 hate fixtures. So fixtures in, in Rails is about 696 00:35:22,740 --> 00:35:27,390 spinning up a world, it's about setting up, sort 697 00:35:27,390 --> 00:35:33,540 of, small size version of the whole world. Where 698 00:35:33,540 --> 00:35:36,780 most approaches, they focus on just one unit. 699 00:35:36,780 --> 00:35:38,660 I don't want to have an account in here 700 00:35:38,660 --> 00:35:40,300 and a project in here if I'm just testing 701 00:35:40,300 --> 00:35:42,560 my message. I just want to test this one 702 00:35:42,560 --> 00:35:44,970 single thing, right. And if you're doing that, yeah, 703 00:35:44,970 --> 00:35:46,510 fixtures are probably not a good thing. It doesn't 704 00:35:46,510 --> 00:35:47,670 really work for that. 705 00:35:47,670 --> 00:35:50,730 It works really well when you're not concerned about 706 00:35:50,730 --> 00:35:53,700 the hard science focus on unit tests. It works 707 00:35:53,700 --> 00:35:57,300 really well when you're focused on a larger level. 708 00:35:57,300 --> 00:35:58,810 When you're focused on models, when you're focused on 709 00:35:58,810 --> 00:36:03,319 controllers, and most importantly when you're focused on systems. 710 00:36:03,319 --> 00:36:09,410 But all that is sort of usually swept away 711 00:36:09,410 --> 00:36:14,970 by the holy trinity of test metrics. Coverage, ratio, 712 00:36:14,970 --> 00:36:17,230 and speed. 713 00:36:17,230 --> 00:36:23,920 I've been in a lot of internet arguments lately. 714 00:36:23,920 --> 00:36:28,250 In such esteemed establishments as Hacker News, and, and 715 00:36:28,250 --> 00:36:31,970 elsewhere, and I find it really interesting, because each 716 00:36:31,970 --> 00:36:35,410 individual argument will make me rage, but then the 717 00:36:35,410 --> 00:36:38,400 larger set of all arguments, like a meta study, 718 00:36:38,400 --> 00:36:41,060 actually reveals really interesting things about what people care 719 00:36:41,060 --> 00:36:42,400 about. What they value. 720 00:36:42,400 --> 00:36:44,849 And what I find is, in most discussions about 721 00:36:44,849 --> 00:36:48,210 design, especially around Rails, what people care about these 722 00:36:48,210 --> 00:36:51,520 things, and these things only. It's about the test 723 00:36:51,520 --> 00:36:53,750 coverage. It's about the test ratio. And it's about 724 00:36:53,750 --> 00:36:55,650 how fast your tests run. 725 00:36:55,650 --> 00:36:59,630 Like, that's the pedestal. That's the holy grail. What 726 00:36:59,630 --> 00:37:03,730 actually happens underneath, the design of the rest of 727 00:37:03,730 --> 00:37:07,140 the application is, eh. Doesn't really matter. 728 00:37:07,140 --> 00:37:10,000 And thus, a lot of people come to celebrate, 729 00:37:10,000 --> 00:37:12,670 oh, I have a one to four test ratio. 730 00:37:12,670 --> 00:37:14,530 For every line of production code, I have four 731 00:37:14,530 --> 00:37:18,630 lines of test. Oh yeah. 732 00:37:18,630 --> 00:37:22,569 And they say that with pride. And I'm like, 733 00:37:22,569 --> 00:37:25,230 what? So you're saying for every line of production 734 00:37:25,230 --> 00:37:26,890 code you write, you have to write four lines 735 00:37:26,890 --> 00:37:29,140 of code? And that somehow makes you a hero? 736 00:37:29,140 --> 00:37:31,400 How, how does that work? 737 00:37:31,400 --> 00:37:34,109 So your system is now five times as large, 738 00:37:34,109 --> 00:37:35,770 reasoning about the whole system is now five times 739 00:37:35,770 --> 00:37:38,760 as complex, and you're proud of this, why? Well, 740 00:37:38,760 --> 00:37:41,839 of course, because I have a hundred percent coverage. 741 00:37:41,839 --> 00:37:44,980 My five thousand tests run incredibly fast because they 742 00:37:44,980 --> 00:37:47,069 never actually test very much. 743 00:37:47,069 --> 00:37:49,420 They certainly do not test the system. They test 744 00:37:49,420 --> 00:37:52,800 all these little slices of unit. Wonderful. 745 00:37:52,800 --> 00:37:56,099 It's not wonderful. You have anemic fucking tests. They 746 00:37:56,099 --> 00:37:57,970 don't prove shit. You're gonna have the same bug 747 00:37:57,970 --> 00:38:00,119 that we have on base camp, and the system 748 00:38:00,119 --> 00:38:01,960 is not going to work even though you've proudly 749 00:38:01,960 --> 00:38:05,540 proclaimed, oh, well, your units are working. 750 00:38:05,540 --> 00:38:10,240 Well, whoopity-doo. This decoupling is now free. People think 751 00:38:10,240 --> 00:38:13,810 that, oh, this is like that saying, like, quality's 752 00:38:13,810 --> 00:38:16,510 free. Right. Testing is free. Not when you're doing 753 00:38:16,510 --> 00:38:21,020 it like this. It's not free. 754 00:38:21,020 --> 00:38:22,760 And most importantly, it's not free, not so much 755 00:38:22,760 --> 00:38:27,460 in time, but in conceptual overhead. Understanding a system 756 00:38:27,460 --> 00:38:32,780 that has been test-driven designed from the unit perspective 757 00:38:32,780 --> 00:38:36,400 is really hard. Because you have all these levels 758 00:38:36,400 --> 00:38:40,170 of indirection. You have all these levels of intermediation. 759 00:38:40,170 --> 00:38:45,240 To separate the tests from slow things, like HTML 760 00:38:45,240 --> 00:38:47,760 or the database or, any of the other parts 761 00:38:47,760 --> 00:38:50,460 of the system that actually makes up your system. 762 00:38:50,460 --> 00:38:53,800 And they focus just on that one thing. So 763 00:38:53,800 --> 00:38:56,060 they can be very fast, if they don't have 764 00:38:56,060 --> 00:38:57,650 to work. They don't actually have to test your 765 00:38:57,650 --> 00:38:58,990 system. 766 00:38:58,990 --> 00:39:01,280 So that's sort of two charges in one. It's 767 00:39:01,280 --> 00:39:04,089 a charge first that your design is not going 768 00:39:04,089 --> 00:39:07,260 to improve. Your design is going to deteriorate by 769 00:39:07,260 --> 00:39:11,069 doing test first programming, because you're going to construct 770 00:39:11,069 --> 00:39:15,440 your units of testing, your methods, in a different 771 00:39:15,440 --> 00:39:16,980 way, like we say with the age example. You're 772 00:39:16,980 --> 00:39:19,970 going to inject all your dependencies in a way 773 00:39:19,970 --> 00:39:21,980 that does not prove things. 774 00:39:21,980 --> 00:39:23,609 And second of all, you're not gonna get the 775 00:39:23,609 --> 00:39:26,530 benefit of great coverage. You might have a lot 776 00:39:26,530 --> 00:39:28,470 of tests, but they don't test your system. It 777 00:39:28,470 --> 00:39:33,140 doesn't improve your confidence in actually the whole thing 778 00:39:33,140 --> 00:39:35,849 working, and then what good is it? 779 00:39:35,849 --> 00:39:40,900 Well, I thought about this for a long time 780 00:39:40,900 --> 00:39:44,950 and thought, like, this is not really, it doesn't 781 00:39:44,950 --> 00:39:47,589 seem like that great of a revelation. Why, why 782 00:39:47,589 --> 00:39:50,369 do I keep having these arguments over and over 783 00:39:50,369 --> 00:39:52,920 again? Why are people focused so hard and so 784 00:39:52,920 --> 00:39:57,690 intensely on this trinity of test metrics? How did 785 00:39:57,690 --> 00:40:00,510 that come to be the main thing that people 786 00:40:00,510 --> 00:40:01,530 are arguing about? 787 00:40:01,530 --> 00:40:03,230 How did that come to be the main decider 788 00:40:03,230 --> 00:40:05,670 of what's good design and what's bad design? Really, 789 00:40:05,670 --> 00:40:09,760 couldn't really figure it out. Until I started thinking 790 00:40:09,760 --> 00:40:11,700 back of like, what is this prism we're looking 791 00:40:11,700 --> 00:40:17,630 through? We're looking through computer science. Engineering. Professionalism. 792 00:40:17,630 --> 00:40:21,550 James Harrington wrote a bunch of books on quality 793 00:40:21,550 --> 00:40:23,940 of engineering, and he has a great quote here. 794 00:40:23,940 --> 00:40:26,890 If you can't measure something, you can't understand it. 795 00:40:26,890 --> 00:40:28,950 If you can't understand it, you can't control it. 796 00:40:28,950 --> 00:40:31,280 If you can't control it, you can't improve it. 797 00:40:31,280 --> 00:40:36,309 That makes a lot of sense. Cause like, yeah, 798 00:40:36,309 --> 00:40:38,079 yeah, that makes sense. That's gotta be why. And 799 00:40:38,079 --> 00:40:40,510 then I got another great quote. Just because you 800 00:40:40,510 --> 00:40:43,040 can, just because something is easy to measure doesn't 801 00:40:43,040 --> 00:40:44,180 mean it's important. 802 00:40:44,180 --> 00:40:48,990 This, I think, is exactly what's going on here. 803 00:40:48,990 --> 00:40:52,809 Programming of information systems is a lot more like 804 00:40:52,809 --> 00:40:57,609 French poetry than it is like physics. But programmers 805 00:40:57,609 --> 00:41:00,280 grow up thinking that they're computer scientists, so they 806 00:41:00,280 --> 00:41:03,210 want it really badly to be like physics. They 807 00:41:03,210 --> 00:41:06,710 want it really badly to be a hard, professional 808 00:41:06,710 --> 00:41:07,819 science. 809 00:41:07,819 --> 00:41:13,589 And coverage, ratio, and speed. You can get that 810 00:41:13,589 --> 00:41:18,329 fucking thing down to six decimals. Like, that, I 811 00:41:18,329 --> 00:41:20,349 can be so precise about how fast my test 812 00:41:20,349 --> 00:41:26,300 runs, eighty-four point seven percent coverage, boom. Got it. 813 00:41:26,300 --> 00:41:28,020 Doesn't say anything about whether or not that's actually 814 00:41:28,020 --> 00:41:31,750 important. Doesn't say anything about whether that's actually producing 815 00:41:31,750 --> 00:41:33,550 a good system. Doesn't say anything about whether the 816 00:41:33,550 --> 00:41:36,280 person after you, or you yourself, three months from 817 00:41:36,280 --> 00:41:38,369 now, can understand what the hell is going on 818 00:41:38,369 --> 00:41:41,260 in this code base. 819 00:41:41,260 --> 00:41:43,480 You haven't necessarily made anything any clearer. You've made 820 00:41:43,480 --> 00:41:47,880 it very easy to produce metrics. And if there's 821 00:41:47,880 --> 00:41:51,480 one thing we love with, with science, it's clear 822 00:41:51,480 --> 00:41:58,329 concise objective truths and coverage and ratio and speed 823 00:41:58,329 --> 00:42:00,690 fit that bill. So we adopted them with open 824 00:42:00,690 --> 00:42:03,910 arms, even though they were not that important. 825 00:42:03,910 --> 00:42:08,450 Second part of it. Cost is not value. A 826 00:42:08,450 --> 00:42:12,180 lot of people have invested so much in building 827 00:42:12,180 --> 00:42:17,609 up their expertise, their time, their four-to-one ratio in 828 00:42:17,609 --> 00:42:22,079 tests. The investment is massive. Well, of course they're 829 00:42:22,079 --> 00:42:25,010 gonna be defensive about it. Like, you've invested so 830 00:42:25,010 --> 00:42:28,319 much of your ego and your time and your 831 00:42:28,319 --> 00:42:31,069 resources on this project, into testing. So of course 832 00:42:31,069 --> 00:42:33,369 it must be valuable. Of course it must be 833 00:42:33,369 --> 00:42:33,780 important. 834 00:42:33,780 --> 00:42:36,650 That's not how it works. Just because something is 835 00:42:36,650 --> 00:42:39,410 really expensive, just because something takes a lot of 836 00:42:39,410 --> 00:42:42,609 your time doesn't mean it's valuable. Doesn't mean it's 837 00:42:42,609 --> 00:42:47,619 important. 838 00:42:47,619 --> 00:42:52,440 So I was sort of giving a brief description 839 00:42:52,440 --> 00:42:57,079 of this talk yesterday at dinner with Aaron Patterson, 840 00:42:57,079 --> 00:43:01,369 and he trolled me right back and said, TL;DR, 841 00:43:01,369 --> 00:43:03,940 just don't test, right. Like, that's what I'm supposed 842 00:43:03,940 --> 00:43:06,990 to get out of this. 843 00:43:06,990 --> 00:43:12,430 No. No. Testing absolutely has value. Regression testing absolutely 844 00:43:12,430 --> 00:43:18,089 has value. Driving your design through test first? In 845 00:43:18,089 --> 00:43:23,040 my mind, rarely has value. Not never. There are 846 00:43:23,040 --> 00:43:25,010 times where I'll write my tests first, usually when 847 00:43:25,010 --> 00:43:29,210 it's something like a translator of some kind, where 848 00:43:29,210 --> 00:43:30,550 I know exactly what's going in and I know 849 00:43:30,550 --> 00:43:31,720 exactly what I want out. 850 00:43:31,720 --> 00:43:33,809 That could be a good case to start with 851 00:43:33,809 --> 00:43:37,000 test first. Most information system design is not like 852 00:43:37,000 --> 00:43:38,640 that. I'm trying to figure out and sell what 853 00:43:38,640 --> 00:43:41,829 the system is supposed to do. What I'm going 854 00:43:41,829 --> 00:43:44,240 to arrive at is the test, is this set 855 00:43:44,240 --> 00:43:46,619 of tests, it's a set of regression tests, that 856 00:43:46,619 --> 00:43:47,960 make me feel good about that after the fact, 857 00:43:47,960 --> 00:43:50,430 that I can still change my system and not 858 00:43:50,430 --> 00:43:56,230 break it, right. 859 00:43:56,230 --> 00:44:03,230 So TDD. Kent Beck. Main proponent behind TDD has 860 00:44:05,839 --> 00:44:08,869 a very sensible quote that goes exactly along these 861 00:44:08,869 --> 00:44:12,210 lines. I get paid for code that works, not 862 00:44:12,210 --> 00:44:15,079 for tests, so my philosophy is to test as 863 00:44:15,079 --> 00:44:18,890 little as possible to reach a given level of 864 00:44:18,890 --> 00:44:19,579 confidence. 865 00:44:19,579 --> 00:44:24,369 Immensely sensible. I find that that's actually often the 866 00:44:24,369 --> 00:44:27,890 case with these things that get taken too far. 867 00:44:27,890 --> 00:44:32,579 TDD started out as a pretty sensible thing. Kent 868 00:44:32,579 --> 00:44:35,390 has an even more sensible perception of it now, 869 00:44:35,390 --> 00:44:39,270 I think, than when he wrote the test-driven book 870 00:44:39,270 --> 00:44:42,710 originally. But that's not what most people take away. 871 00:44:42,710 --> 00:44:44,839 That's not what most people run with if they 872 00:44:44,839 --> 00:44:46,950 want to build a career on making people feel 873 00:44:46,950 --> 00:44:50,180 shitty about their code bases and their dirty, dirty 874 00:44:50,180 --> 00:44:50,690 code. 875 00:44:50,690 --> 00:44:54,450 They take a much more extremist approach, that unless 876 00:44:54,450 --> 00:44:59,440 you're doing test-first, you're not a professional. Certainly not 877 00:44:59,440 --> 00:45:01,839 what Kent's saying. 878 00:45:01,839 --> 00:45:06,619 OK. So for me, this really boils down to, 879 00:45:06,619 --> 00:45:09,950 we're, we're trying to wear the wrong hat the 880 00:45:09,950 --> 00:45:13,089 majority of the time. Thinking of yourself as a 881 00:45:13,089 --> 00:45:18,130 software engineer will lead you down the path of 882 00:45:18,130 --> 00:45:24,150 coverage, speed, metrics, hard sciences - all these things 883 00:45:24,150 --> 00:45:29,260 we can measure and it leave you laughing at 884 00:45:29,260 --> 00:45:34,720 shit like interpretation of French poetry. Of subjective evaluations 885 00:45:34,720 --> 00:45:36,880 of a design in the system, even though these 886 00:45:36,880 --> 00:45:39,640 are the only tools that we have. 887 00:45:39,640 --> 00:45:43,349 So this has taken me awhile to arrive at 888 00:45:43,349 --> 00:45:45,960 this conclusion. I've hated the word software engineer for 889 00:45:45,960 --> 00:45:48,660 quite awhile. Cause I never felt it fit me. 890 00:45:48,660 --> 00:45:51,510 I never thought of myself as a software engineer. 891 00:45:51,510 --> 00:45:53,670 I kind of tried to be one, a few 892 00:45:53,670 --> 00:45:55,750 times, and I failed all the time. And by 893 00:45:55,750 --> 00:45:58,359 the time I finally arrived at programming as something 894 00:45:58,359 --> 00:46:00,280 that I wanted to do, it sure as shit 895 00:46:00,280 --> 00:46:02,569 wasn't software engineering. 896 00:46:02,569 --> 00:46:06,230 Yes. It's a hard hat that I wear occasionally, 897 00:46:06,230 --> 00:46:10,559 when I do performance optimization. That's hard science. You 898 00:46:10,559 --> 00:46:13,220 make a change. You measure it. Was it an 899 00:46:13,220 --> 00:46:19,040 improvement? If not, revert. If yes, deploy. Very scientific. 900 00:46:19,040 --> 00:46:20,790 Very good. 901 00:46:20,790 --> 00:46:23,859 Great to wear the hard hat when that fits. 902 00:46:23,859 --> 00:46:25,680 Is what, that what I do the majority of 903 00:46:25,680 --> 00:46:27,480 the time? Is that how I think of myself 904 00:46:27,480 --> 00:46:29,480 when I write most of the things that I 905 00:46:29,480 --> 00:46:31,300 write? When I add a new feature to base 906 00:46:31,300 --> 00:46:34,109 camp or do forensics to figure out how a 907 00:46:34,109 --> 00:46:37,119 bug came about, or what somebody meant when they 908 00:46:37,119 --> 00:46:39,280 wrote a bug in or something? No. That's not 909 00:46:39,280 --> 00:46:40,710 what I do. 910 00:46:40,710 --> 00:46:42,369 So I don't try to think of myself as 911 00:46:42,369 --> 00:46:43,530 a software engineer. 912 00:46:43,530 --> 00:46:48,040 OK. If we're not software engineers, most of the 913 00:46:48,040 --> 00:46:51,619 time when we make information systems, what are we 914 00:46:51,619 --> 00:46:55,059 then? What other hat should we try to wear? 915 00:46:55,059 --> 00:46:58,520 What other identity should we try to aspire to? 916 00:46:58,520 --> 00:47:01,109 I think we had it all along. I think 917 00:47:01,109 --> 00:47:04,000 we had it in the language all along. We're 918 00:47:04,000 --> 00:47:10,319 software writers. Writing is a much more apt metaphor 919 00:47:10,319 --> 00:47:12,510 for what we do most of the time, than 920 00:47:12,510 --> 00:47:19,510 engineering is. Writing is about clarity. It's about presenting 921 00:47:22,339 --> 00:47:28,460 information and motivations in a clear-to-follow manner so that 922 00:47:28,460 --> 00:47:29,640 anybody can understand it. 923 00:47:29,640 --> 00:47:33,770 There are not bonus points for making something convoluted, 924 00:47:33,770 --> 00:47:37,349 as there often is with engineering and with test-first 925 00:47:37,349 --> 00:47:40,390 design. Making things more convoluted gives you the benefits 926 00:47:40,390 --> 00:47:44,000 of, perhaps, easier to test. They don't give you 927 00:47:44,000 --> 00:47:49,160 clarity. So those things are often in opposition. 928 00:47:49,160 --> 00:47:52,640 Clarity is all about being succinct without being terse. 929 00:47:52,640 --> 00:47:56,140 WE can write things using as small words as 930 00:47:56,140 --> 00:47:59,670 we know how, using as little complication as we 931 00:47:59,670 --> 00:48:03,299 know how, using as little conceptual overhead as we 932 00:48:03,299 --> 00:48:06,950 know how to get the job done. 933 00:48:06,950 --> 00:48:10,140 That's a much better approach. And I think it 934 00:48:10,140 --> 00:48:14,170 comes very easy if you think of software development 935 00:48:14,170 --> 00:48:16,760 as writing. If you look at a piece of 936 00:48:16,760 --> 00:48:18,680 writing that somebody has written and it's kind of 937 00:48:18,680 --> 00:48:21,690 convoluted, can't really follow the argument, and paragraphs are 938 00:48:21,690 --> 00:48:24,020 not broken up neatly, is the first thing you're 939 00:48:24,020 --> 00:48:25,500 gonna say, you know what the problem with this 940 00:48:25,500 --> 00:48:28,760 is? You're not using big enough words. 941 00:48:28,760 --> 00:48:30,829 If we just shoved some bigger words into this 942 00:48:30,829 --> 00:48:34,980 text, it's gonna be there. That's good. Oh. The 943 00:48:34,980 --> 00:48:37,750 problem here is like, like your sentences are too 944 00:48:37,750 --> 00:48:41,619 clear. If you just insert a sentence in the 945 00:48:41,619 --> 00:48:43,920 middle, that'd be great. Oh, do you know what? 946 00:48:43,920 --> 00:48:46,799 This needs more semicolons. That's what this needs. If 947 00:48:46,799 --> 00:48:50,910 this has more semicolons, boom. You got clarity. 948 00:48:50,910 --> 00:48:54,000 No. More indirection. More third-person. These are not the 949 00:48:54,000 --> 00:48:57,049 things that make for great, clear writing. And that's 950 00:48:57,049 --> 00:48:59,630 obvious when we talk about things like writing. SO 951 00:48:59,630 --> 00:49:02,869 if we talk about software development as writing, I 952 00:49:02,869 --> 00:49:05,869 think it'll be obvious too. I think if we 953 00:49:05,869 --> 00:49:10,960 supplant the high ideal of what matters for design 954 00:49:10,960 --> 00:49:12,430 is how easy it is to test, how easy 955 00:49:12,430 --> 00:49:16,170 it is to make engineering driven, and put clarity 956 00:49:16,170 --> 00:49:20,240 of the code base above all else, we're gonna 957 00:49:20,240 --> 00:49:22,660 be much better off. And arguments are gonna be 958 00:49:22,660 --> 00:49:25,890 settled much easier. And it's gonna be much easier 959 00:49:25,890 --> 00:49:27,670 to read the fucking code you wrote three months 960 00:49:27,670 --> 00:49:30,099 ago, because you had that in mind. 961 00:49:30,099 --> 00:49:31,680 That was your motivation. That was what you were 962 00:49:31,680 --> 00:49:33,839 going for. 963 00:49:33,839 --> 00:49:38,010 So what is clarity? How do you figure that 964 00:49:38,010 --> 00:49:40,540 out, right? That's real easy to say, oh it's 965 00:49:40,540 --> 00:49:46,190 just clarity. Boom. It's open to interpretation, right. It's 966 00:49:46,190 --> 00:49:47,910 not as clear as just saying, oh if you 967 00:49:47,910 --> 00:49:50,270 can just get your code coverage above 85% then 968 00:49:50,270 --> 00:49:51,619 you're gold, right. 969 00:49:51,619 --> 00:49:53,599 Clarity doesn't work like that. There's not a metric 970 00:49:53,599 --> 00:49:56,490 we can just apply, because, again, it's not hard 971 00:49:56,490 --> 00:50:01,079 science. Clarity of writing is not hard science. 972 00:50:01,079 --> 00:50:05,290 So the easy answer is, I know when I 973 00:50:05,290 --> 00:50:08,640 see it. Right? There's not just gonna be a 974 00:50:08,640 --> 00:50:11,960 list of principles and practices that somebody can be 975 00:50:11,960 --> 00:50:15,380 taught and then they will automatically produce clear writing 976 00:50:15,380 --> 00:50:19,849 every time. Right? If you want to be a 977 00:50:19,849 --> 00:50:21,970 good writer, is it enough just to sit and 978 00:50:21,970 --> 00:50:28,160 memorize the dictionary? No. Just knowing the words available 979 00:50:28,160 --> 00:50:30,480 to you, knowing the patterns of development is not 980 00:50:30,480 --> 00:50:32,799 gonna make you a good developer. 981 00:50:32,799 --> 00:50:37,309 You have to develop an eye. You have to 982 00:50:37,309 --> 00:50:39,849 develop an eye for clarity, which means first of 983 00:50:39,849 --> 00:50:41,450 all, you have to decide that that's important to 984 00:50:41,450 --> 00:50:43,950 you. So that's the first step. If you're still 985 00:50:43,950 --> 00:50:46,450 stuck in, the most important thing about my system 986 00:50:46,450 --> 00:50:49,040 is how fast my tests run, and how many 987 00:50:49,040 --> 00:50:51,609 of them I have, well. Forget about it. You're 988 00:50:51,609 --> 00:50:52,740 not gonna get to this point. 989 00:50:52,740 --> 00:50:54,440 You have to decide that the most important thing 990 00:50:54,440 --> 00:50:59,130 for your system is clarity. When you do decide 991 00:50:59,130 --> 00:51:02,420 that, you can start developing an eye. I started 992 00:51:02,420 --> 00:51:07,540 getting into photography maybe six years ago. When I 993 00:51:07,540 --> 00:51:10,250 first got into photography, like, I would look at 994 00:51:10,250 --> 00:51:12,530 a picture and it was like, well, looks like 995 00:51:12,530 --> 00:51:13,349 a good picture. 996 00:51:13,349 --> 00:51:15,170 Now, I've been looking at thousands of pictures. I've 997 00:51:15,170 --> 00:51:18,040 been taking thousands of pictures. And I've developed an 998 00:51:18,040 --> 00:51:20,270 eye. I can see when the white balance is 999 00:51:20,270 --> 00:51:23,280 off. I can see, oh, this has a blue 1000 00:51:23,280 --> 00:51:25,420 tint. Oh, this actually, if we crop it just 1001 00:51:25,420 --> 00:51:27,839 a little bit more, only the subjects we want 1002 00:51:27,839 --> 00:51:29,329 to have in focus are in focus. Oh, this 1003 00:51:29,329 --> 00:51:31,920 would actually be better in black and white. 1004 00:51:31,920 --> 00:51:36,309 That eye just came from doing it. A lot. 1005 00:51:36,309 --> 00:51:37,890 It didn't come from just sitting down and reading 1006 00:51:37,890 --> 00:51:42,170 a lot of photography books. And I think it's 1007 00:51:42,170 --> 00:51:44,089 the same thing with code. I think a lot 1008 00:51:44,089 --> 00:51:47,990 of programmers, coming at it from a software engineering 1009 00:51:47,990 --> 00:51:50,020 angle, thing that just all they have to do 1010 00:51:50,020 --> 00:51:55,270 is learn the practices, learn the patterns, memorize them 1011 00:51:55,270 --> 00:51:57,619 all, and then they will be good programmers. 1012 00:51:57,619 --> 00:52:00,640 No, they won't. The only way to become a 1013 00:52:00,640 --> 00:52:04,099 good programmer, where, by definition, I define good programmers 1014 00:52:04,099 --> 00:52:07,410 as somebody who programs, who writes software with clarity, 1015 00:52:07,410 --> 00:52:10,450 is to read a lot of software, write a 1016 00:52:10,450 --> 00:52:12,569 lot of software. 1017 00:52:12,569 --> 00:52:13,859 Just like how do you become a good photographer? 1018 00:52:13,859 --> 00:52:15,950 You take a lot of pictures. And you look 1019 00:52:15,950 --> 00:52:18,020 at them. And you practice. And you practice. And 1020 00:52:18,020 --> 00:52:20,220 you practice. 1021 00:52:20,220 --> 00:52:22,150 I think it's quite similar to the problem with 1022 00:52:22,150 --> 00:52:26,460 diets, right. The fundamental truth with diets is to 1023 00:52:26,460 --> 00:52:29,339 be healthy you should probably exercise regularly, you should 1024 00:52:29,339 --> 00:52:32,849 probably eat a reasonable amount and it should be 1025 00:52:32,849 --> 00:52:37,440 good stuff. Like, that's three things. Incredibly hard to 1026 00:52:37,440 --> 00:52:41,240 do. Most people do not do that, right. Figuring 1027 00:52:41,240 --> 00:52:43,770 out how to write good software: read a lot 1028 00:52:43,770 --> 00:52:47,660 of software, write a lot of software, aim for 1029 00:52:47,660 --> 00:52:49,270 clarity. It sounds too simple. 1030 00:52:49,270 --> 00:52:51,460 Why is it simple? Because there's not just a 1031 00:52:51,460 --> 00:52:53,730 secret. There's not just one answer somebody can give 1032 00:52:53,730 --> 00:52:57,210 you. The only way you can get there is 1033 00:52:57,210 --> 00:53:01,520 by doing it. So when I first started developing 1034 00:53:01,520 --> 00:53:06,470 Rails, I read a ton of software. I read 1035 00:53:06,470 --> 00:53:10,579 the entire Ruby standard library. Partly because documentation of 1036 00:53:10,579 --> 00:53:12,559 Ruby at that time was pretty poor, and the 1037 00:53:12,559 --> 00:53:13,510 only way to figure out how it worked was 1038 00:53:13,510 --> 00:53:15,549 to actually look at the code. But that was 1039 00:53:15,549 --> 00:53:17,760 also where I learned so much. 1040 00:53:17,760 --> 00:53:22,349 Today, we have it so much easier. Bundle open 1041 00:53:22,349 --> 00:53:24,799 name of any gem, and it'll open, boom, right 1042 00:53:24,799 --> 00:53:26,170 up in your text editor. You can look at 1043 00:53:26,170 --> 00:53:28,770 any code. 1044 00:53:28,770 --> 00:53:31,599 How many of you have read through a complete 1045 00:53:31,599 --> 00:53:37,490 gem recently. Something you did not write. Awesome. That's 1046 00:53:37,490 --> 00:53:39,390 actually really encouraging. I thought it would be much 1047 00:53:39,390 --> 00:53:40,470 less. 1048 00:53:40,470 --> 00:53:42,119 I think that is exactly the path you need 1049 00:53:42,119 --> 00:53:44,119 to take. You need to read a shit ton 1050 00:53:44,119 --> 00:53:45,839 of code. And it's not so much just because 1051 00:53:45,839 --> 00:53:47,430 you read this code and then, oh that's all 1052 00:53:47,430 --> 00:53:50,910 great stuff. Just as important as it is to, 1053 00:53:50,910 --> 00:53:53,200 to develop your sense of writing by reading a 1054 00:53:53,200 --> 00:53:57,670 lot of shit writing, so is it with code. 1055 00:53:57,670 --> 00:53:58,809 And I think you will find that that is 1056 00:53:58,809 --> 00:54:01,619 actually very easy. Because a lot of things you'll 1057 00:54:01,619 --> 00:54:07,150 do bundle open on will follow Sturgeon's Revelation. 90% 1058 00:54:07,150 --> 00:54:08,780 of everything is crap. 1059 00:54:08,780 --> 00:54:12,970 Well, at least you know you have company if 1060 00:54:12,970 --> 00:54:15,170 you write crap software and I certainly do from 1061 00:54:15,170 --> 00:54:17,980 time to time. And that's a great way to 1062 00:54:17,980 --> 00:54:20,970 learn. I actually find that I learn the most 1063 00:54:20,970 --> 00:54:23,410 about software and learn the most about what matters 1064 00:54:23,410 --> 00:54:25,579 to me, I learn the most about what clarity 1065 00:54:25,579 --> 00:54:28,309 is when I read poor software. 1066 00:54:28,309 --> 00:54:30,359 Because what I do is, I take a piece 1067 00:54:30,359 --> 00:54:33,819 of software, I take a class or method, and 1068 00:54:33,819 --> 00:54:35,940 then I look at it, how could this be 1069 00:54:35,940 --> 00:54:37,460 clearer? Like this is, I think this is poorly 1070 00:54:37,460 --> 00:54:41,109 written. I think this smells. How can I rewrite 1071 00:54:41,109 --> 00:54:41,990 it? 1072 00:54:41,990 --> 00:54:43,640 So by just sitting down and going through that 1073 00:54:43,640 --> 00:54:46,150 exercise and rewriting it, I find I learn a 1074 00:54:46,150 --> 00:54:49,000 whole lot about what I care about. So that's 1075 00:54:49,000 --> 00:54:51,700 what I've been doing lately. Engaging in a lot 1076 00:54:51,700 --> 00:54:54,150 of these internet arguments. Somebody will submit a piece 1077 00:54:54,150 --> 00:54:58,890 of code, and usually the submission will come along 1078 00:54:58,890 --> 00:55:00,319 with the proposed solution, too, right. 1079 00:55:00,319 --> 00:55:02,730 I have this shitty piece of code. Then I 1080 00:55:02,730 --> 00:55:06,619 learned about these three patterns. And now it's wonderful. 1081 00:55:06,619 --> 00:55:09,280 And what I have found every single time, and 1082 00:55:09,280 --> 00:55:11,180 I've only done this maybe a handful of times, 1083 00:55:11,180 --> 00:55:13,660 maybe a little more, is that every single time, 1084 00:55:13,660 --> 00:55:15,130 you just took the shitty code and you stuck 1085 00:55:15,130 --> 00:55:16,520 it into some different boxes. 1086 00:55:16,520 --> 00:55:19,049 Like, it didn't actually improve. Applying the pattern to 1087 00:55:19,049 --> 00:55:21,799 it did not improve the underlying clarity of the 1088 00:55:21,799 --> 00:55:25,329 code, because you just wrote it poorly. Like, the 1089 00:55:25,329 --> 00:55:27,020 problem with the code was not that it was 1090 00:55:27,020 --> 00:55:29,920 missing patterns. The problem with the code was that 1091 00:55:29,920 --> 00:55:32,880 it was crap. That it just had to be 1092 00:55:32,880 --> 00:55:34,730 rewritten. 1093 00:55:34,730 --> 00:55:41,730 Now, that leads us to sort of a mission, 1094 00:55:42,480 --> 00:55:44,990 in some ways, from Rails is and what Ruby 1095 00:55:44,990 --> 00:55:48,700 is, and it leads also to clarify some of 1096 00:55:48,700 --> 00:55:50,400 the arguments we've had in the Rails community for 1097 00:55:50,400 --> 00:55:54,299 awhile. Readability is incredibly important to Ruby. We have 1098 00:55:54,299 --> 00:55:57,309 a lot of duplicated methods that do exactly the 1099 00:55:57,309 --> 00:56:01,349 same thing, just so we can improve readability. 1100 00:56:01,349 --> 00:56:04,950 I remember the first time I saw unless, when 1101 00:56:04,950 --> 00:56:06,920 I was learning about Ruby. That was one of 1102 00:56:06,920 --> 00:56:09,760 those light bulb moments. It's like, wait a minute. 1103 00:56:09,760 --> 00:56:13,990 Unless is exactly the same as if not, but 1104 00:56:13,990 --> 00:56:18,740 it's a different keyword. Huh. 1105 00:56:18,740 --> 00:56:21,500 Right? It was not just about making the most 1106 00:56:21,500 --> 00:56:28,500 efficient, compact language. It was about readability. Poof! 1107 00:56:30,200 --> 00:56:32,559 Mind blown. 1108 00:56:32,559 --> 00:56:37,270 And decade-long love-affair with Ruby established. And I think 1109 00:56:37,270 --> 00:56:40,539 that this is what we're trying to achieve constantly 1110 00:56:40,539 --> 00:56:43,079 in Rails as well. A lot of people will 1111 00:56:43,079 --> 00:56:46,170 gripe about, oh, ActiveRecord is too big or something 1112 00:56:46,170 --> 00:56:49,140 is too big, or have too many methods. The 1113 00:56:49,140 --> 00:56:51,799 surface area is too big or there's, whatever it 1114 00:56:51,799 --> 00:56:52,450 is, right. 1115 00:56:52,450 --> 00:56:55,099 Like, who gives a shit? Is it more readable? 1116 00:56:55,099 --> 00:56:57,480 Is it more clear? That's the only thing that 1117 00:56:57,480 --> 00:56:59,839 matters. What do I care whether the surface area 1118 00:56:59,839 --> 00:57:02,490 of a method is a hundred methods or it's 1119 00:57:02,490 --> 00:57:04,520 two hundred methods? I don't give a shit about 1120 00:57:04,520 --> 00:57:05,690 that. The only thing I give a shit about 1121 00:57:05,690 --> 00:57:07,670 is whether, is the code I'm actually reading, is 1122 00:57:07,670 --> 00:57:10,210 the system I'm trying to understand, is that more 1123 00:57:10,210 --> 00:57:12,680 clear. When you put clarity as your number one 1124 00:57:12,680 --> 00:57:15,410 mission, a lot of concerns just fall by the 1125 00:57:15,410 --> 00:57:15,520 wayside. 1126 00:57:15,520 --> 00:57:21,510 It just doesn't matter anymore. And it's liberating. 1127 00:57:21,510 --> 00:57:24,430 So, I think this actually comes from sort of 1128 00:57:24,430 --> 00:57:26,109 the same rope. I didn't have time to write 1129 00:57:26,109 --> 00:57:27,950 a short letter, so I wrote a long one 1130 00:57:27,950 --> 00:57:32,160 instead. I think that describes about eighty percent of 1131 00:57:32,160 --> 00:57:34,559 all that ninety percent of shitty code. 1132 00:57:34,559 --> 00:57:39,200 Most people did not take the time to write 1133 00:57:39,200 --> 00:57:40,680 a short piece of code, so they wrote a 1134 00:57:40,680 --> 00:57:42,900 long one instead. And then they wrote that long 1135 00:57:42,900 --> 00:57:45,359 one, piece of code, and they like, pulled out 1136 00:57:45,359 --> 00:57:47,960 their suspenders and like, oh yeah, I'm done. My 1137 00:57:47,960 --> 00:57:49,059 tests pass. 1138 00:57:49,059 --> 00:57:52,400 Boom. Right? Or they look at it and decide, 1139 00:57:52,400 --> 00:57:54,180 oh shit, this is too long. I must be 1140 00:57:54,180 --> 00:57:57,869 missing some patterns. I just sprinkle some patterns over 1141 00:57:57,869 --> 00:58:03,430 this. Wonders, right? No. What you wrote was a 1142 00:58:03,430 --> 00:58:05,930 draft. 1143 00:58:05,930 --> 00:58:08,740 This was just a first draft, right. Any piece 1144 00:58:08,740 --> 00:58:12,099 of code you write down is just a draft. 1145 00:58:12,099 --> 00:58:16,230 Mark Twain actually had the hard job, right. He 1146 00:58:16,230 --> 00:58:18,420 wrote in ink. If you actually had to change 1147 00:58:18,420 --> 00:58:20,579 that, well that was kind of hard, right. So 1148 00:58:20,579 --> 00:58:23,410 his drafts were a lot more complicated. Ours? We 1149 00:58:23,410 --> 00:58:25,960 have it so easy. A text editor? You just 1150 00:58:25,960 --> 00:58:28,430 delete stuff. And you don't need any of the 1151 00:58:28,430 --> 00:58:30,109 little stuff that you, you fill over the page 1152 00:58:30,109 --> 00:58:33,049 and you spill it everywhere and so forth. An 1153 00:58:33,049 --> 00:58:33,839 eraser. 1154 00:58:33,839 --> 00:58:36,250 You can just delete stuff. Like that's my favorite 1155 00:58:36,250 --> 00:58:40,890 key. The delete key. It's the number one tool 1156 00:58:40,890 --> 00:58:47,539 for improving code. Delete key. 1157 00:58:47,539 --> 00:58:52,650 So when I was in high school, I submitted 1158 00:58:52,650 --> 00:58:56,670 a bunch of first drafts as essays, and they 1159 00:58:56,670 --> 00:58:58,539 were really shitty. And of course they were. They 1160 00:58:58,539 --> 00:59:00,809 were the first draft. And my teacher at the 1161 00:59:00,809 --> 00:59:03,319 time said, oh, all right, all right, this is 1162 00:59:03,319 --> 00:59:05,890 actually not bad. You just told me the step 1163 00:59:05,890 --> 00:59:07,440 one. If you have something on your mind, you 1164 00:59:07,440 --> 00:59:08,680 should write it down. 1165 00:59:08,680 --> 00:59:10,349 That's what I did. I, I wrote it down. 1166 00:59:10,349 --> 00:59:12,809 And then I handed it in. Oh, if you've 1167 00:59:12,809 --> 00:59:15,480 written something down, you should rewrite it. 1168 00:59:15,480 --> 00:59:18,460 Oh. That was the step I missed. And I 1169 00:59:18,460 --> 00:59:20,530 think that's the step most people miss when they 1170 00:59:20,530 --> 00:59:22,910 write down code. Cause they're focused on all these 1171 00:59:22,910 --> 00:59:24,970 other things. They're not focused on the clarity, because 1172 00:59:24,970 --> 00:59:26,359 when you are focused on the clarity, you will 1173 00:59:26,359 --> 00:59:30,740 realize that all your first drafts are terrible. 1174 00:59:30,740 --> 00:59:33,380 All my first drafts are terrible. All my first 1175 00:59:33,380 --> 00:59:36,240 attempts at writing a good class are poor. They're 1176 00:59:36,240 --> 00:59:39,569 too long. They're not at the same level of 1177 00:59:39,569 --> 00:59:42,770 abstraction. They're not clear. And that's OK. I wrote 1178 00:59:42,770 --> 00:59:44,089 something down. I was trying to figure out what 1179 00:59:44,089 --> 00:59:47,049 the system was supposed to do. 1180 00:59:47,049 --> 00:59:48,950 That's hard work. And often times you don't get 1181 00:59:48,950 --> 00:59:50,589 perfect code out of that when you're still trying 1182 00:59:50,589 --> 00:59:53,099 to figure out what it is that you're writing. 1183 00:59:53,099 --> 00:59:55,710 But once you've written it down, you should rewrite 1184 00:59:55,710 --> 00:59:57,559 it. 1185 00:59:57,559 --> 01:00:03,480 And I think the key part of rewriting is 1186 01:00:03,480 --> 01:00:06,730 omitting needless words when it comes to regular writing. 1187 01:00:06,730 --> 01:00:10,970 When it comes to programming, it's omitting needless concepts. 1188 01:00:10,970 --> 01:00:14,920 It's omitting needless patterns. It's omitting needless practices. It's 1189 01:00:14,920 --> 01:00:21,260 omitting needless classes. It's omitting all these extra things 1190 01:00:21,260 --> 01:00:25,130 that aren't getting you closer to clarity, right. 1191 01:00:25,130 --> 01:00:27,099 How do you know? You develop an eye for 1192 01:00:27,099 --> 01:00:28,960 it. How do you develop an eye? You read 1193 01:00:28,960 --> 01:00:30,099 a lot of code. You write a lot of 1194 01:00:30,099 --> 01:00:32,980 code. You rewrite a lot of code. And you 1195 01:00:32,980 --> 01:00:36,809 forget about fucking patterns for awhile. You forget about 1196 01:00:36,809 --> 01:00:39,930 fucking TDD for awhile. And you focus on just 1197 01:00:39,930 --> 01:00:42,250 what's in front of you. The piece of code. 1198 01:00:42,250 --> 01:00:44,640 How can I write it simpler? 1199 01:00:44,640 --> 01:00:48,219 Write software well. Thank you very much.