Coding Blocks - Clean Code – Formatting Matters

Episode Date: November 29, 2016

Ever judged a book by its cover?  Of course you have.  Ever passed judgement on some code simply because it didn’t look pretty?  There’s more to writing code than having it functional and in th...is episode we dive into the reasons code formatting actually matters.  Who wins the newspaper format debate?!  Leave us a comment and […]

Transcript
Discussion (0)
Starting point is 00:00:00 You're listening to Coding Blocks, episode 50. Five! Oh, baby! Woo! We made it to 50. Subscribe to us and leave us a review on iTunes, Stitcher, and more using your favorite podcast app. Visit us at codingblocks.net where you can find show notes, examples, discussion, and
Starting point is 00:00:14 other stuff. Send your feedback, questions, and rants to comments at codingblocks.net. Follow us on Twitter at Coding Blocks or head to www.codingblocks.net and find all our social links there at the top of the page. With that, I'm Alan Underwood. I'm Joe Zach. And I'm Mike Woutlaw. And it's time for me trying to say some names. I feel like people are messing with me now with some of these names.
Starting point is 00:00:44 Actually, this time isn't so bad, though. some names i feel like people are messing with me now with some of these names i actually this time isn't so bad though i don't i don't feel like that so you know we always start with uh saying thanks to um people that left the reviews in itunes and stitcher and some names are way more challenging to pronounce than others at least for me because names are like kryptonite to me um but this time i don't feel like it was too terribly bad i'll let i'll let oh i was gonna take stitcher no uh yeah i got i got stitcher you go ahead and do itunes no but i practice stitcher no no you do it i got i got nothing on itunes it's all you do it what i'm about to do with them All right, here we go. You ready?
Starting point is 00:01:28 Trey Waters, Clever Cookies. You cheated. We were Shizo, Abraham Linksys. That one I loved. I also like this one a lot. To Nickfinity and Beyond. And then Trigger PLZ. ESAM Candidly, I guess. Canadally. You think?
Starting point is 00:01:52 Okay. And SMic03. Or SMic. Or SMic. So iTunes. Here we go. Hello, Basti. TuxDK.
Starting point is 00:02:01 DavidBC. AnimeGirl44. Bacarlino. EmbeddedEmily, DonNeil14, PS180, and DanClarkPhoto. So I tripped you up there. You might have cheated a little bit. Advantage of going first. So thank you, everybody, for taking the time to do that. Some really amazing reviews in there made our days as always we sincerely love these reviews so please do
Starting point is 00:02:32 if you haven't already do it um you know make somebody smile all right also um we have a lot of other uh stuff um a lot of other news i a lot of other news. I don't know. Community news? I don't know. Maybe we need a little subsection here. But I'll try not to take too much time with it. But I do have a few things I wanted to call out, like Hussein and Mike. Check your email.
Starting point is 00:02:59 It's two of the four winners from episode 47. And we haven't heard back from you guys about your addresses. So hit us up because we want to send you free books. And also want to give a shout out to anger zoot uh we haven't mentioned her in a while and she's awesome does martial arts so beware don't mess with her um also some of the big news uh cynical developer has launched um james start we've mentioned him a few times um he's uh got a new podcast out just started talking about things like cake exam on react with zach brady um all really good so that's exciting yeah definitely go check it out although we need to tell james stay close to his microphone could you not hear him i couldn't he failed a few times on me with the zach brady interview
Starting point is 00:03:40 wow awesome uh very cool uh also um this is uh really interesting we actually um got an opportunity to give away a free pass to the o'reilly software architecture contest software architecture convention that just uh started actually i guess today um well it depends on when you listen to it right but anyway it's a conference it was in san francisco we had a $1,700 ticket to give away. We had to give it away quickly. And so we ran a quick contest on Twitter and awarded the prize to Mark McDowell, who sent us a picture from the conference.
Starting point is 00:04:14 And so glad he's having a good time. And I wanted to mention that means you guys should follow us on Twitter, Facebook, and mailing list or anywhere else you can find us because sometimes we have stuff to give away that's really awesome and we aren't able to get it on the show for some reason so you should follow us and get free stuff. Totally.
Starting point is 00:04:36 Yep. Also, last episode I mentioned Codemade as my tip but I forgot who introduced me and I apologize. It was Marizo Pazabon. And so just wanted to say thanks for that. And also wanted to mention, this is not really related to people, but we do have an O'Reilly discount code right now. It's more related to the conference, but it's 50% off most print and 40% off eBooks. And I don't know how long this is going to last,
Starting point is 00:05:05 but it's a pretty good deal. So you can get a book like soft skills and JavaScript, the good parts. And, uh, we, there's no affiliate fee because I can't figure out how to set it up. Um,
Starting point is 00:05:14 it's just discount for you. So go get it while you can. And, and you do that by coming to our site and clicking the banner on the right hand side of the page. Or if you're on mobile, you probably have scroll down to the bottom. Yep.
Starting point is 00:05:27 Alright. Excellent, excellent news. Alright. Yeah, so sorry. You know, last time was conference season for me. It felt like we talked a lot about conferences. And, oh, guess what happened? Between last episode and now, I went to another one.
Starting point is 00:05:47 So this time was the DevFest 2016 for the Google Developer Group, and we'll include a link to that. There was some pretty cool stuff. Sorry that you couldn't be there, but there was some pretty cool topics that they talked about. My main interest there was the machine learning, um, uh,
Starting point is 00:06:08 track. We'll call it. Um, but yeah, they, they had some really cool stuff that, that, that they were talking about,
Starting point is 00:06:14 uh, in general, uh, Firebase was another one of the, uh, conversations. Have you, have you played with Firebase yet?
Starting point is 00:06:20 Have you checked out Firebase? Nope. Um, it was like, uh, cross platform capabilities for like android ios uh some c plus plus some javascript heavy on android um for obvious maybe reasons but um some features that things that we've done in like you know, maybe an AWS environment, but now it was like, you know, here's this nice SDK for free features. Well, there were tiered pricing, um, but there was a free tier,
Starting point is 00:06:51 but like, uh, you know, some analytics, some, uh, key value pair storage, uh, file storage was another one of the features, um, uh, testing features that were built into it. So I'm by no means doing a Firebase that's full justice, but yeah, it had some pretty cool features. Uh, they were built into it. And then TensorFlow was another one of the big conversations. Again, like I said, I went more for the machine learning uh track and so tensorflow came up which was another uh google technology that was talked about there i didn't realize tensorflow is google i've seen a few demonstrations of it doing some really cool stuff um with like
Starting point is 00:07:36 just visually and just some cool things with neural networks and tensorflow that i don't understand most people probably don't understand it yet. Yeah. Well, now you're making me question. Yeah, TensorFlow was originally developed by researchers and engineers working on the Google brain team. Yeah.
Starting point is 00:07:55 Awesome. They have a brain team? I mean, it's Google, so are you surprised that they would have a brain team? Yeah. Like, you'd be more shocked if you found out that they didn't have a brain team, right? Right.
Starting point is 00:08:09 That's true. Like, what do you mean they only have an eyeball team? As a Google or Alphabet? Oh, Google. Google. All right. We got some scary stuff here. Yeah.
Starting point is 00:08:23 So I don't know. I feel like, you know, okay, so there was that whole conversation that we had. I don't know. What was that now? Like a week or two ago, a couple weeks ago about the Android iOS thing, right? And, you know, obviously, you know, I was wrong. I got told I was wrong a lot. So that's fine.
Starting point is 00:08:44 I get that because, you know, like it's. I got, I got, I told her I was wrong a lot. So that's fine. I get that because, you know, it like, it's one of those Android versus iOS is a heated conversation. Right. But if you recall, like, let's take all the heat away from it though. There was the one part of the conversation that we talked about where, uh, with the bug bounties, right. And that, and I'd mentioned that, you know, at least on ios uh you know maybe i have this false sense of security you know whether it's true or not i don't know but this was like a story that came up just yesterday i want to believe i want to say um and it just kind of resonated exactly or maybe it was this morning um but it kind of resonated exactly what i was talking about so there's a story that the New York Times reported
Starting point is 00:09:26 about Android phones, some Android phones, where the phones were sending, the security experts discovered that the phones were sending, oh, shoot, I had it right here and then scrolled, but it was sending like the complete text conversation and call logs. Here it is. Crypt it was sending the complete text conversation and call logs. Here it is. Cryptowire, the security firm
Starting point is 00:09:48 that discovered the vulnerability, said the Hadoop software transmitted the full contents of text messages, contact lists, call logs, location information, and other data to a Chinese server. This was software that was just built into the phone, an Android phone. And it was kind of going along the lines of like where
Starting point is 00:10:06 we were talking about, you know, during that previous conversation where on the iOS, it felt like, well, that couldn't happen, you know, because Apple's controlling both sides, you know, the hardware and the software. But I thought that that was an interesting and scary story that, you know, that existed and that was a thing. But it was on lower-end phones. So, in fairness, this wasn't on your, like, high-end, you know, Samsung or Nexus line or, I guess, now Google line phones. The Pixel, yeah. This one says it was the blue products, and there were, like, 120,000 of its phones that were affected.
Starting point is 00:10:43 And you know what stinks about it though is nowadays well their software runs on seven million seven hundred million phones all over the world yeah so the blue product was one i'm sorry to cut you off but the blue was one american manufacturer yeah so what i was going to say though one of the scary things is most people don't pay attention when they install apps nowadays for all the privileges it asks for so i mean just about anything could do it this one happened to be baked into the phone which really stinks but yeah right yeah i mean it's and that's kind of why i'm saying like maybe it's a false sense of security that i have with ios like i i i'll concede to that right well the thing is most people don't care even after they know they're being spied on so you know who cares who cares if they are or not it's it really kind of stinks it kind of makes people want to go back to a flip
Starting point is 00:11:30 phone and i and i get that honestly seriously bring back the motorola razor seriously remember that yeah i mean yeah that phone was awesome back in the day so i mean that was like the original phone that everybody craved and you iPhone, everybody wanted the Razr. Yep, it was slim. It was pretty. Yeah, that's one of the things that kind of stinks. I find myself in that situation. I mean, I digress.
Starting point is 00:11:54 I don't want to go in too much on the phone thing. But, yeah, it's a scary world with this stuff. In other news, I ended up going to the MVP Summit, which was amazing. It was out there in Bellevue, Washington, uh, gorgeous out there. Gray the entire time, sort of wet, but, uh, I mean, seriously. Oh, and because of the time change, it was dark every day at like four 30 in the afternoon. It was, it was a little brutal, but not that cuts you off, but it looks like here in the show notes, you had an expletive here.
Starting point is 00:12:24 Cause you had to like mark out some of your your show notes here uh you did something and it starts with an f i don't know right so i actually did a little bit of functional programming and some f sharp and it was kind of cool because the way that they were like hey you want to learn this thing go go download this dojo from GitHub. And I'll have to find that link and put it in the show notes. Now, wait a minute. Now everybody's going to think dojo. They're going to think of the JavaScript framework.
Starting point is 00:12:52 No, not the JavaScript framework. It was actually do like a little like a lesson type thing. It's like a kata? No, it wasn't a kata. It was more like literally just try this. They call it a dojo up on their GitHub project page. But basically it was draw a tree with F sharp. And it was pretty neat.
Starting point is 00:13:12 Like most people would have this nice pretty looking tree. And I was like, man, that's not cool. I need something organic. So I kind of did a random tree generator. And that was kind of neat. Are we talking about like a fractal trees? Yes, a fractal tree. Oh, a fractal.
Starting point is 00:13:24 Okay. Yeah, so it was a lot of fun. It was literally drawing lines and doing angles and all that kind of neat. Are we talking about like fractal trees? Yes, a fractal tree. Oh, a fractal. Okay. Yeah, so it was a lot of fun. It was literally drawing lines and doing angles and all that kind of stuff. So it was a lot of fun. I like his description of it. I drew lines and angles and stuff. Yeah, that's what it did. So there was another one that was cool that was excellent
Starting point is 00:13:39 that they had basically like a bot program. So you could literally create like a messenger and then have a bot do responses to it. So like you could say something along the lines of, Hey, what's the fastest car in the world. And it would know based off some of the wording that you did in there, you train your bot and it would go do a Bing search for you.
Starting point is 00:13:59 So is that why your responses in Slack have been so weird? Cause you replaced it with a, an Allen Slack bot? It's amazing, isn't it? That makes so much more sense now. All it does is say awesome and cool. I thought something was really robotic about it. Yeah, I've noticed you've been a lot better at draw something lately.
Starting point is 00:14:16 Right, right. Draw something? Who plays that anymore? Wow. Welcome to 2010. I still play. But that was totally what was that omg pop omg pop wow that's good stuff uh so yeah i mean the conference was amazing i can't talk about most of it because i'm under nda but hololens can you talk about the hall oh i can't talk about hololens so i did actually he wasn't supposed to talk about F-sharp, and now he's in trouble.
Starting point is 00:14:45 I did attend a session that was basically being able to develop VR and AR apps, augmented reality or virtual reality apps, using either Unity 3D, the Unreal Engine, or there's another thing called R-sharp, and we'll leave a link in the show notes. And it was pretty cool. I mean, they kind of – Wait, like Ur?
Starting point is 00:15:07 It's like U-H-R-sharp. It's really – it's weird. I guess that one was created in the south. Probably. Ur? What kind of language you got there? I got me some Ursharp. Some Ursharp.
Starting point is 00:15:20 That's Ursharp right there. Not Urflat. I was playing with Urflat earlier. So here was the thing, right? The presentation was cool and all, but at the end they were like, hey, does anybody want to come up and try out a HoloLens? I looked around and everybody was sitting down like, dude, I bolted to the front of the room.
Starting point is 00:15:36 I was like, I've got to check this thing out. Man, it is way more amazing than what I ever thought it would be. What Alan realized later is it was a rhetorical question. They really didn't want anyone to jump up. That's fine. This is awkward. You know what was funny? It was kind of like everybody's like, hey, everybody go get a plate and eat,
Starting point is 00:15:52 and everybody stands around and waits for that first guy. Dude, after I got up there, there were like 30 people behind me. You were like, I don't mind being the first guy. Get out of the way. That's right. Here I come. Man, it is like seriously, like I could take an object and I had no idea how to navigate this thing. Like the dude's looking at me like I'm an idiot.
Starting point is 00:16:10 And he's like, you got to pinch it. I'm like, what do you mean pinch it? Right. So I'm like waving my hand around in the air. And he's like, no, you got to pinch your fingers. I was like, oh, OK, I got it. So I could literally I took this puppy and I placed it on top of a pinch, a puppy. I pinched a puppy.
Starting point is 00:16:24 Wait, that's not nice. And I put them right on top of somebody's head and it was amazing. The thing would like detect surfaces. Like it, I can't even describe how cool it was. Cause literally then I was like, okay, well that's cool.
Starting point is 00:16:37 I stuck them on top of somebody said, let me put them on the desk. And sure enough, it would detect it and kind of snap to the desk. And then you turn around and look at something else and look back. And sure enough, there it was. Man, I'm telling you right now. Like, I've played with some virtual reality things.
Starting point is 00:16:52 Like, our buddy has the Oculus. Yeah. And that's neat. Don't get me wrong. That's really cool. It's neat. But there was a whole other level of involvement with that augmented reality where it really felt like you had something in the room that you could play with okay now let me ask you
Starting point is 00:17:08 this in all fairness though to the oculus rift because when we did play around with that oculus rift it was kind of underpowered at the time i mean we all admitted to that right it was off a laptop but so here's what i'll tell you so do you think that they just had like a lot more hardware to drive that experience for the hololens? No, I don't think so. So I think what the difference is is just the perception. Like with the augmented reality, as it's called, you're interacting inside your own real world, right? Like you're taking virtual objects and messing with them in your world, whereas virtual reality is you're surrounded by another world. And that level of interaction, like they showed some demos.
Starting point is 00:17:49 And I think these are on YouTube where literally, like imagine you're somebody that's a home designer, right? You walk into somebody's room and you say, oh, you want to change out your floors in your room? You look down there, it detects the surface, and then you pick, you know, what you want the surface. Right, so to be fair, then HoloLens is an augmented reality experience, and the Oculus Rift was a virtual reality experience. Yep. For those not familiar with either. Yep, both super cool. The only thing that was a little bit, and people have said this, like the view area on the HoloLens is a little bit limited.
Starting point is 00:18:20 Like you've got to be looking in like the lens area, otherwise you lose focus of what you said. Aren't you wearing like a big giant? You are, but the screen's not as all-encompassing as you might think. So that's really the only thing that might have been a little bit of a drawback. But, man, seriously, some super cool technology. So are you able to scratch your unibrow with the helmet on or do you have to take it off? Are you saying I need to shave?
Starting point is 00:18:45 I'm saying it's a concern for me. I mean, let's pretend that we were saying that. Let's pretend that we were saying that you did. Just for the sake of argument, let's not make this weird. Could you, theoretically, if you had to scratch your unibrow? I don't remember. You were so immersed in the experience. I seriously was.
Starting point is 00:19:10 You forgot all about your unibrow. I was so enjoying that, I didn't even realize I didn't have clothes on. So you're admitting to the unibrow. That's what we're getting. Yes. Seriously, if you ever get the chance, apparently if you go to a Microsoft store where they have them, you can schedule a – somebody on our Slack channel. I wish I could remember who it was said that you can actually go schedule an appointment to check it out and they'll have like a 15 minute thing that you can go mess with.
Starting point is 00:19:37 So I highly recommend it. If you're into tech at all is a lot of fun, man. For a minute there, I just had like a flashback of like the days of the arcade, right? Where, you know, you would, quote, schedule your time by like dropping your quarters on like, I'm next on this Mortal Kombat game, yo. That's right. I'm coming in here with some Scorpion or some Sub-Zero. I got this. Don't worry.
Starting point is 00:20:03 Dude, that's amazing. Oh, another thing that just happened, this happened today actually, was Microsoft Connect. I don't know if you guys are watching it, but they were showing a lot of new stuff that they were doing. One of them is Visual Studio on the Mac.
Starting point is 00:20:18 Not Visual Studio Code, but Visual Studio on the Mac. That's actually really exciting for me. So I plan on downloading that and playing with it here pretty soon because that's, man, what a world we live in. And on that, they also mentioned, and this kind of blew my mind, Microsoft is the top contributor on GitHub. Yeah, but I thought that's been known, right?
Starting point is 00:20:41 That's not like they didn't just cross that threshold, right? No, no, it's probably happened, but I'd never even heard that. It was just kind of crazy. I know Docker was up there at the top. I don't remember what else it was, but Microsoft is the biggest contributor to open source on GitHub. That's pretty cool. It's a different world we live in.
Starting point is 00:21:00 Now, the Visual Studio on the Mac. Okay, so for one, because we already got some feedback about, I guess, one of us said something about getting a tattoo. If there was ever a Visual Studio for the Mac. Oh, crap. That sounds like something I would say. Yeah, it does. So, yeah, I guess one of us has to get a tattoo but but because i'm afraid it was me maybe i don't know i gotta go back and listen to it i think it was like episode 12 somebody
Starting point is 00:21:35 mentioned in maybe the slack channel or something how are you gonna remember that some no so it was either tweeted to us or somebody mentioned it in the slack channel i don't remember how it came up i'm pretty sure it was in slack that us or somebody mentioned it in the Slack channel. I don't remember how it came up. I'm pretty sure it was in Slack that somebody was like, oh, yeah, hey, by the way, you guys were talking about if it was ever available for the Visual Studio ever came out from Mac that you'd get it tattooed. You'd get a Microsoft logo tattooed. Well, I hope it was you.
Starting point is 00:22:02 So, yeah, so awkward. You know, I'm sure the Zoom tattoo guy didn't regret it later, right? It was you. So, yeah, so awkward. You have to do it, man. You know, I'm sure the Zune tattoo guy didn't regret it later, right? Right. Oh, crap. You had to put it like that, too, didn't you? Wow. Oh, man. Yeah, I heard a podcast.
Starting point is 00:22:16 Was it? Oh, I forget. I'll remember the name in a minute. But the people that got the Pepe the Frog tattoos and stuff um back when it was kind of a funny meme and then it got involved in all sorts of uh um like hate memes and this tattoo that of this figure that has recently become a figure of hate speech and now wait somebody on reply all has a tattoo reply all was the podcast yeah yeah they talked with the guy uh who drew pepe the frog and how his friends and family got this tip too and the next thing you know he's like you see this character
Starting point is 00:22:49 like wearing you know all sorts of uh racist and fascist stuff and and whatnot so it became a symbol of something very different from how it started out and all these people have this tattoo and they're you know kind of covering up around election season. Well, yeah. So I guess where I was going with this though, um, is that cause so the visual studio, it's just a, well,
Starting point is 00:23:13 it's just a, but isn't it more like a rebranding of the Xamarin tools that were already there? So it's not, it's not that Microsoft wrote from the ground up. Oh, here, or even a port of Visual Studio to the Mac, right? No. This is, oh, well, we made this acquisition of Xamarin, and they have this tool.
Starting point is 00:23:36 Xamarin Studio. And so we've decided to rename Xamarin Studio to Visual Studio. I don't think it's just renaming it because they actually showed on that connecting, I believe, somebody just compiling a regular application. So it wasn't for like iOS or Android, I don't think, is what I'm getting at. So Xamarin Studio was always, okay, you could take your core C sharp stuff and write like your business logic and that kind of thing. But then you could write like your uis for ios and for android it was basically mobile based type stuff and i think this is they're trying to take it a step further to where you can literally write like um desktop type applications
Starting point is 00:24:18 i don't know i didn't get to see all of it but i think they're trying to take a step further but it is definitely xamarin studio that they're now renaming visual studio code is it free now yeah xamarin studio is free since they acquired them okay well so awesome so if you have a mac you should go get it yeah i would definitely check it out i mean if nothing else it'd be cool just to see what's out there. But, man, times is a changing. Yeah, I feel like we're going to have to do some research on this because it sounds like one of us is going to have to get a tattoo, so we might as well know why. It definitely ain't me.
Starting point is 00:24:55 Well, I mean, it could be you. I don't know. I promise you I never said that. Oh, hey, look what I just found. It was actually Alan that said it. Well, that's awkward. Yeah, so, yeah, definitely want to follow up on that. All right, and then next up, we've been giving away stickers, people.
Starting point is 00:25:15 If you want a sticker, send us a self-addressed stamp envelope. And if you don't know where to send it to, contact us on Twitter, Slack. I mean, you probably don't know where to send it to. That's fair. I don't know where to send it to, contact us on Twitter, Slack. I mean, you probably don't know where to send it to. That's fair. I don't know where to send it. I don't know either. Okay. So, yeah, just contact us.
Starting point is 00:25:34 We'll send you the thing. It'll be the easiest way to go. And we will send you out a sticker or two or three if you want to give some to your friends. So just holler at us. All right. So let's see. Episode 48. So we gave out in episode 47, we said we were going to give out some copies of clean code.
Starting point is 00:25:56 And then again in episode 48, we decided to do the same thing. And so we did our drawing. And well, you know what? Last time i said drum roll you guys made it really awkward and it became like speakers were getting blown out and you know people ears were bleeding and now alan's making machine gun sounds that's close to a drum so so yeah so i won't say drum roll but i will let alan announce the winner how's that or joe you want to do this yes um i'm looking up the last name right now because i don't remember if he put it in the comment but uh the the winner is all right odvar uh i'm sorry about your last name.
Starting point is 00:26:46 Tengizdal. I'm sure I butchered that. And you should email us your address or your email address if you prefer to have the e-book. And we'll get that to you. Congratulations. Yeah. Congratulations. And so, all right.
Starting point is 00:27:01 So, we're going to be talking about clean code again. And again, giving away a copy. Or are we doing PostSharp 2? Did we decide? I don't know. I didn't think so. Okay, so we're just going to do the copy of clean code this episode. But you should follow us on Twitter or Facebook or whatever your preferred social media platform is because we do have lots of other stuff to give out that we don't necessarily mention on the show and you should
Starting point is 00:27:28 follow us there for chances to win um really expensive nice prizes yeah like a copy of yes totally like almost 700 worth of a nice prize so i before we get into this particular episode i want to ask you guys like so this is my first time reading through clean code because I've always written clean code. Now, wait a minute. I take offense to that because you have definitely read my code more than once. Nicely done. So here's the thing that I'm curious if other people have thought that. Like, I'll look at the title of a chapter, like this one, formatting, and I'm like, really?
Starting point is 00:28:08 This seems kind of like a boring, not really all that meaty topic. And then I look at it and I'm like, you know what? There was good stuff in here. Oh, there's better than good stuff. I feel like I have accidentally stumbled upon another VAR Wars. Yeah, I know we're going to go toe-to-toe on this one again. But I know what you're saying, Alan. And actually, for me, it goes both ways.
Starting point is 00:28:35 So I see chapters like this and I'm like, I don't want to read this. And I love it. But then there's times that I'll buy a book on, say, machine learning. And I'm asleep by page two. Yeah, I mean, I've actually found every chapter that we've hit so far. I'm like, man, there's, there's really useful, good takeaways from this. And I was surprised. I really wasn't being completely honest. I didn't think that would happen like that.
Starting point is 00:28:57 So, so is it fair to say that you're starting to see why this book is as popular as it is? Totally not. It's like not it's like totally oh you see why it's okay well you don't okay tough crowd no it truly is it's so uh uncle bob i guess you're going to try harder next time with your next book that's right um alan is apparently not impressed no i mean totally like i'm i'm happy that we decided to do this one i'm i'm looking forward to in the future picking up a code complete also because i i mean from all the good things I've heard about that one, I have to imagine it's sort of the same type, you know,
Starting point is 00:29:29 things going on here. Wasn't the next one to this one, like clean coder. Yeah. And I didn't know that one existed until fairly recently. So I'm looking forward to reading that one. I actually just got a new book on, um,
Starting point is 00:29:41 you know, best practices. I'll have to look up what it is and, and share it but i was going to read that one but i'm really excited about that one because it's really short actually i'm going to look up the name right now it's called really clean code right super clean no code it's an o'reilly book i got it and uh you know i i kind of opened the package i'm like yes my book's here it's got you know a picture of a monkey or something on it and i looked it up
Starting point is 00:30:01 like wait it's like a magazine what the and then i so first i was like upset you know because i like i'm used to coding you know coding books you basically buy them and you know just huge like 600 pages each right but then i was really happy i was like oh my gosh you could use them to lift up your car yeah well i got this when i opened it i was like oh my gosh i'm actually gonna read this anytime you're changing a tire and you run out of a jack stand you just grab your coding books and yeah lift them up it's like python definitive guy 9 000 pages i mean in fairness it did say definitive yeah so i feel like you know you you knew what you were getting into yeah i guess when you go back in the day, you go to the bookstore
Starting point is 00:30:45 and you look and you're like, okay, I need to learn PHP or something. And so you look at all the books and you see PHP for dummies and O'Reilly books, whatever. They're all roughly around the same price, but one of them is 9,000 pages. What are you going to get?
Starting point is 00:31:02 Because you know you're going to be stuck on some stupid problems that are going to be keeping you up all night. So, you should get the bigger book and you can, you know, probably find your problem easier. Actually, you'll never find it in that big book. No, never. Right. The index in this thing sucks. When's the last time you used an index instead of Google?
Starting point is 00:31:18 Never. Man, exactly. It's been a long time. I mean, I guess if on a paper book, though, yeah, sure. Right? I don't know. All right, so let's go ahead and jump into it while Joe's looking for the name of the book. So this one we're talking about formatting.
Starting point is 00:31:34 Like this, again, seemed really unexciting, but then at the very beginning that I thought was so true is if your code's a mess, then people assume that your attention to detail in the app is also a mess. Like that's so true. If you look at it, if you look at a pile of code and you're like, Oh, a pile of code, you've kind of already like drawn judgment there.
Starting point is 00:31:59 It is right. Like if you look at something and you can't make heads or tails of it, just looking at it, like it's not pretty, you're going to assume that they missed other things, right? Like if they look at something and you can't make heads or tails of it, just looking at it, like it's not pretty, you're going to assume that they missed other things, right? Like if they didn't care about how their code looked, then they didn't care about how it operated either. I've seen lots of piles of code.
Starting point is 00:32:14 Right, totally. So I thought that was a good way to start it off. Like it truly, just your perception, it's the whole don't judge a book by its cover type thing, right? I mean, you can't help it. You see a book with a really garbage cover, and you're like, man, I bet that's terrible. But you can judge a book by its many pages. Yeah, and the book I was talking about is Programming Beyond Practices.
Starting point is 00:32:36 It's got a really cute picture of a monkey, and it's 132 pages. That's really short. And it's a monkey. And like 70 pages are the index. And then 30 for the table of contents. So one of the things that they jumped in is they said, teams should adopt formatting rules and follow them. What do you guys think about that?
Starting point is 00:32:59 Yeah, that sounds nice in theory. Totally. I mean, it really does. I'm sure you guys work somewhere where there have been line-ending you know someone's using a different editor and they don't want to change you know because you know that's how linux does it that's how windows does it or that's what it was before i didn't even change it you know and this stuff goes back and forth so i think that having standards is really good because sometimes you'll get that one person who just decides to do it their own way and honestly i think that's where pull requests come in.
Starting point is 00:33:25 I mean, seriously, if somebody's going to stray that far outside the lines of what the team has adopted, you have the absolute right to destroy their pull request and just deny it, in my opinion. But this made me question, though, maybe this is more of a thing outside of a C sharp or a visual studio world, right? Well,
Starting point is 00:33:49 there's not standards that everybody uses kind of, well, no, I wasn't going there. What I was going with is that, um, because up until, you know,
Starting point is 00:33:59 the last, let's say 24 months, right? If you were going to write in c sharp you were more often than not you were going to be locked into visual studio yeah so there were the defaults that visual studio would apply and that's what it was right so you know uh in regards to things like tabs versus spaces you know one of the other holy wars, right? Whereas take a Java environment, for example, and, you know, you might have one guy who prefers IntelliJ, you might have
Starting point is 00:34:33 someone else that prefers Eclipse. And so in those worlds, they actually have, and Visual Studio has this too, but it came out way after, you know, know, the Java world had this, but, uh, they, and their tool chain have, uh, plugins and configurations where you can add in a configuration that the IDE will understand and it'll enforce those. So like when you hit new line, uh, and, and you tab over, does it, you know, insert tabs or does it insert spaces? How many spaces does it insert for each tab that you press? Things like that. So maybe I guess where I'm going with this, though, is this teams should adopt formatting rules and follow them.
Starting point is 00:35:18 I've never been in a situation at any employer where we've sat down and we're like okay guys this is how we're going to format our c-sharp right that's just that's never happened i've never had that but maybe in javascript java world that javascript in picture the editor that i use it changes depending on which computer i'm at what which employer, which project I'm working on. I use multiple different editors. I think JavaScript's a good example, but yeah, I don't think we've had that either, though.
Starting point is 00:35:54 There's definitely been times, because some people do their JavaScript in Visual Studio. Some will do it in WebStorm. Yeah, I mean, I get that there's a lot of JavaScript editors that we could iterate through, but I'm saying, like, I still don't recall having a conversation about, like, hey, guys, we're going to standardize on how we're going to format our JavaScript, and here's the configuration for your given tool.
Starting point is 00:36:18 Wait, JavaScript, you mean in a separate file at the top of the page or at the bottom of the page? Is that what we're talking about? Uh-oh. That's a old-school way of thinking about JavaScript, man. It's come a long way. In the body, in the head. Oh, the good old days.
Starting point is 00:36:32 Yeah, I don't know. Like, I usually follow the idiomatic type guides for most of them. So C Sharp, you know, the brackets are always on the following line from the method definition. In JavaScript, it's usually on the same line. Like, I usually just follow whatever the practices are. And half the time, it does do it right in the IDEs. Well, that's what my point was, though, is that that's Visual Studio doing that for you because it's just a default, right?
Starting point is 00:36:59 And it even has, like, by language defaults, too. So it's making some of those decisions for you. Yeah. So I guess my point though is that like in his comment about, you know, this team's adopting a formatting standard kind of made me think like, okay, well the team's then sat down. And even I think later at the end of this chapter he mentioned like, you know, for the given project that he was working on at the time, you know,
Starting point is 00:37:24 they spent a whopping 10 minutes, and then a decade later that's still the formatting that they're following. Yep. And again, if it's something that, you know, you could take the time and there's some kind of like tool, some part of your tooling where you could like, okay, you know, everybody gets this config file, then you could see that happening. Because you brought up WebStorm, for example.
Starting point is 00:37:44 And I know that WebStorm has it, so what you could see that happening. Because you brought up WebStorm, for example. And I know that WebStorm has it, so what you could do is you could just commit that file as part of the repository, that configuration file as part of the repository, WebStorm would pick it up, and now everybody can have that formatting best practice. But I don't think this has historically been a thing in a visual studio world yeah probably not what's interesting is uh will one of the guys that we talk about on occasion he and i got into oh wait this is the guy i heard something about there was a race yeah he lost it you oh wait
Starting point is 00:38:18 dang it he wants to race me again ever since that by the way that's fine um he was like man let me work out for like six months first and then i'll then i'll race you so bring it on dude whenever you're ready i'm gonna eat some brownies between now and then but i think you're doing it wrong uh but we actually got into a debate over this for like an hour one afternoon because he likes to put spaces between his parentheses and his arguments passed into a method and i was like no dude wait say that again so if you are calling a method or a function and when you open the parentheses he wanted a space before the first argument and he wanted a space after the last one i was like i can't i can't get behind that dude like i straight up can't do that.
Starting point is 00:39:05 He's like, what is that about? But it's so much easier to read. And I'm like, no, dude, that messes my eyes up. It doesn't work. So let's give an example here. So we have a customer object that has a method called get first name. Or no, because that would be getting something. And you're saying you had to pass something in.
Starting point is 00:39:24 Like a Fibonacci sequence, and it takes a number. Yeah, something would be getting something in you're saying you had to pass something in like fibonacci sequence and it takes some orders yes okay you pass something in and he would have open paren space argument space close paren and i hope i'm not butchering this i'm pretty sure this is what the argument was and i was like i can't get behind it he's like no but there should be space and i was like you know what if that's what you want then there should be an automated tool that when you check this code in automatically does it because i'm not writing code that looks like that yeah i agree i actually hate that by the way i do too like i don't like when i see that i i instantly remove it um and if i don't formatting tools will do it for me and that's what i told him and it was funny so and this isn't a bash on him because i mean mean, we all have our things that we like.
Starting point is 00:40:05 Well, not to bash on him. I'm not saying it that way, but there was actually a similar point made here about formatting. Like, if you start doing weird formatting, things like that, and I don't want to say it weird, but, like, there's a later section where they're talking about, like, block formatting, variable names, and, you know, the declaration and the assignment if you're doing a big group of them. And you might think that it reads pretty, but it's kind of pointless. And as soon as anyone uses any tool to refactor, then it's immediately going to go away. So why bother? And so one of the points that they brought up in the book
Starting point is 00:40:38 was automated tools help with the process. So I feel like if there are certain things that you want to enforce, then put it in something that cleanses it when it goes in, right? Yeah, and that's where I was thinking from a Java world, man, what was that tool? There was a tool,
Starting point is 00:40:58 I want to say it started with a P. It wasn't Python though. It was like a Java tool that you could give it your formatting. Oh, maybe it was like a java tool that would you could um give it your formatting oh maybe it was actually oh that's actually what it was it was called like formatter it was like ph uh man i'm going to go back and look for it resharper will do this too while you're coding right yeah and you can actually run out on the whole project. Oh, nice. Yep. For a while there, people were basically checking out C Sharp projects on GitHub, running it through the ReSharper formatter, and then submitting a pull request like, here, fixed.
Starting point is 00:41:33 That's ridiculous. People were getting mad. I would deny that. Maybe it wasn't formatter with a PH. It was something like that, though. But it was after the fact, though. That's what i'm saying this this wasn't like like joe mentioned resharper where it would do it in line as you're
Starting point is 00:41:51 typing it'd be like oh i think everybody gets for free right when they check in their code type thing it was definitely it was it was definitely something that would go and modify your your code after the fact after you've already which is kind of a scary thing if you think about it but on save like boop no not on this was like on the repo right like in your build process or or when you're committing to your uh source control place but you know something in that pipeline go ahead i will say you know we mentioned we talked about um not taking 10 minutes in order to uh you know save uh 10 years of struggle. But what about when the standards are obviously bad, like the conventions for writing SQL? You know, imagine if
Starting point is 00:42:32 10 years ago, they spent 10 months and 10 minutes and said, you know what, it just should be capitalized. And that's how we're going to do it. And then for 10 years, people will be writing these screaming snake, horrible looking queries that are screaming into your eyeballs for no reason. Select top one! I feel like you don't like SQL. No. I feel like he's definitely got an opinion there. But, I mean, think about it.
Starting point is 00:42:59 If there are really strong opinion conventions, then you're kind of suppressing possible new conventions that might come up. Maybe that's kind of a false argument because it doesn't really happen that often. But setting standards, setting processes around the way you code does kind of stifle innovation a bit. It does, but it also makes it where people can jump into it easier. So, yeah. Yeah, but think about Ruby. Ruby looks totally different from any other language,
Starting point is 00:43:24 just the way it does little underscores, and you can use punctuation, but think about like Ruby. Like Ruby looks totally different from any other language, just the way it does like little underscores, and you can use punctuation. Things like parentheses are optional. You know, these things are all kind of crazy if you're from like a C background, but it really reads pretty nicely, and it's a big influence on later languages. But in fairness. See, now, when you were talking about like reads crazy, I immediately thought of Perl, right? But then you said that it reads nice, I immediately thought of Perl.
Starting point is 00:43:50 But then you said that it reads nice, and then I was like, oh, wait, you're not talking about Perl. But hold on. In fairness, Ruby was a brand new language, right? So they had control over what they wanted to do there. So let's say that you created Ruby cool, right? You did that. You could make it look however you wanted. So I think that's different. Once you're in a language, you should follow its standards for how you do it.
Starting point is 00:44:08 I mean, just thinking out loud. But one of the – I mean, I agree with that though. Yeah. So going to the SQL that Joe seems to hate, I mean, like if you're writing T sequel, Microsoft has a published recommendation of like, this is the, um, you know,
Starting point is 00:44:30 our, our, how we recommend that you should format your sequel. Now here's, what's crazy is we were just saying how visual studio has its opinions and, uh, you know, we'll automate some of that for you,
Starting point is 00:44:44 right? It'll automatically make some decisions for you. But SQL Server Management Studio does not. So you start writing some SQL and it doesn't automatically start reformatting things for you based off of its opinions of what your SQL should look like. Yep. So one of the key takeaways from this particular opening, though,
Starting point is 00:45:04 was code formatting is actually important. It matters. Totally agree. Yeah. Yeah, I actually like the point that they made that you thought that your first order of business was to make it work, right? But it's really not. You need to communicate effectively what's going to do based off, and the formatting is a good part of that communication, right? And that the readability of your code will have a profound effect on future changes
Starting point is 00:45:36 or all changes that will be made, right? And it will set the precedent that will continue to affect its maintainability and extensibility. Yep. Yeah, I realize you're right. You read it like 100 times more frequently. So then it actually jumps into vertical formatting. And this was kind of interesting. Like they took several popular projects, Java projects,
Starting point is 00:46:02 and compared them to kind of get statistics on some of these things. So there was some really cool stuff in here. So one of the things was, what's the max length that a file should be? Right? And they started looking through them. And you guys have heard us whine about, you know, I was working in a file that was 10,000 lines long. It's nearly impossible to work in a file like that, unless you split that file into three different tabs in your editor. And then that way you can just scroll to various different places and keep certain things in scope. Oh, man. Yeah.
Starting point is 00:46:33 This just reminded me of something like really disgusting where we found. What was it like? It wasn't a class. It was like a store procedure or something. It was 17,000 lines long. Like that was disgusting. It's painful. Like you can't,
Starting point is 00:46:51 you can't possibly keep that track in your head. No, no. The C sharp debugger used to skip over lines greater than I think it was 10,000. So if you would set a break point, it just would not even do it. I didn't know that.
Starting point is 00:47:04 That's awesome. Yeah. Was that a feature? I learned I didn't know that. That's awesome. Was that a feature? That's Joe's tip of the week. That's Joe's tip of the week. If you want to not have to debug your code, you should just put it all into one giant file so that you can only debug the first 10,000 lines. That's awesome.
Starting point is 00:47:18 Makes you wonder, what else is the debugger skipping? It's like, oh, man, I'm not touching this mess. Seriously. So one of the things that that he pointed out in the book that was kind of interesting was try to keep the max length around 500 lines long and smaller is better well um yeah yeah yeah and well but i kind of wanted to to put some context around that though yep because um so there were these different uh java projects that that alan mentioned and the projects were j unit uh fitness or finesse uh test ng time and money
Starting point is 00:47:56 j depend ant and tomcat and so they took the uh file length distributions of all of these different projects and then try to decipher, okay, like what does this data tell us, right? And so what they came out of was, okay, it's possible to build very significant systems with files that are around, typically around 200 lines with an upper limit of 500. So the point is that you could build a really awesome app, a really full-featured app or library or whatever.
Starting point is 00:48:39 You don't have to go crazy with your file sizes. Yep. Because they said one of the things that was crazy to me was Tomcat and Ant had files that were several thousand lines long. And those are extremely popular Java libraries or applications. And they said at least half of them were over 200. But then that Finesse one was like most of them were extremely short and it was also a very big application. And they were saying it's possible to do it.
Starting point is 00:49:14 You just have to be aware of it. You have to be cognizant of the fact that you're not going into these crazy file sizes. Now, in fairness to those open source projects, though, this book was printed like what, what did we decide? Like, 10, 9 years ago, something like that? It has been a little while ago. I want to say it was, oh, well, this says copyright 2009. No, first printing was 2008.
Starting point is 00:49:36 That doesn't sound right either. I thought it was older than that. So I just looked up Roslyn to see how many lines of code it has. Well, sorry. Go ahead. Well, just to finish the thought, though, I was just going to say in fairness to these open source projects, though, they may have changed that by now, right? Although we do know that a lot of times take old bugs that are found in code that was never changed, right? It's quite possible that if it still works, it still works, and they didn't
Starting point is 00:50:03 bother to refactor anything because why bother? It i'm sorry go ahead joe yeah i was just looking at i just picked uh rosalind kind of randomly and looked at the uh the number of lines of code and it's 2,355,000 um so i just did the math in my calculator and lost it but uh oh yeah it basically ended up being uh if we kept to under 500, then you would need over 4,700 files, which is, you know, it's a bit on the mind. It is, but it's also easier to navigate file structures, I think, than having to go through that much code in a file, I think. Yeah, I think so.
Starting point is 00:50:46 Yeah, I mean, it's two million lines no matter how you slice it, right? Exactly. Better organized, right? It's like the difference between throwing a pile of paperwork into a drawer in your desk and then having to go find it later. You're never going to, right? As opposed to throwing it into a bunch of different filing drawers or folders or something. I mean, you just need junk drawer one, junk drawer two, junk drawer three. And hope you didn't put a knife in the middle of there somewhere when you're
Starting point is 00:51:12 reaching for the paper. Yep. MongoDB, basically 1,200,000 lines of code. No, 1,200,000 lines of code. So, yeah, that's quite a few classes there if you uh divvy things up 500 lines roslyn is more than mongo yep that's shocking yeah wow cool um so the next thing they said was the newspaper metaphor like your file should read sort of like a newspaper. Yep. Here we go. And this is where Joe's feeling victorious already. No holds barred.
Starting point is 00:51:49 Yep. So your headlines are up at the top, and then you get more detailed as you go down. All right. And this, by the way, before this war starts, actually it's not going to be a war because I think Joe has the author on his side here. Oh, he can have the author on his side. He's still lost. Not just the author, Uncle Bob. the author on his side here oh oh he can have the author on his
Starting point is 00:52:05 side he's still lost not just the author uncle bob uncle bob on his side that's fine whatever but this is just the first part this whole reading like a newspaper then we get into the other sections that yeah yeah we'll get to that about so yeah here's the thing okay so so we talked about this uh a little bit in a previous episode where we had talked about basically the newspaper metaphor was to have your methods sorted so that the caller is above the callee. So if you have method one calls method two, the method two is sorted below that. Right. calls method two, the method two is sorted below that, right? And, you know, you continue, you continue formatting all your, your methods like that to where the caller is always above the callee, right? But, and they were referring to it as this newspaper metaphor, right? And the problem
Starting point is 00:53:00 that I have with this is that it sounds great in this utopian universe where you write this thing the first time and you write it in this format and fine, everything's being called one time, right? But we don't read code like we do a news story or a newspaper, right? So when you read a news article or any story, you read it linearly from top to bottom. There's no need to go back to a previous paragraph, assuming you were paying attention the first time, right? So there's no need to go back. However, with code, our intent is reusability, okay? So skipping around within a file is a thing within code that is not a thing within a newspaper right and we don't necessarily read our code linearly the same way that we would a newspaper assuming that our methods are used more than once which oh by the way that's part of the reason why
Starting point is 00:54:00 they're supposed to be you know separate is is so that you can increase the reusability. So I get that you're going to take issue with that, right? You can be like, no, no, no, no, no. Definitely, because I had mentioned, well, if trying to sort them by caller versus callee is just one arbitrary method, then why not just do it alphabetically? Because if they're both going to be arbitrary, at least from a, from a readability point of view, it's a lot easier for me to go to find that other method that I'm looking for, depending in the editor that I'm in, because if I know that the methods are in alphabetical order, then I know how to scroll up. I know whether or not I need to scroll up or down to find the next method. And I know Alan was saying, oh, but in my tool, I can just F12 that. And that's very true in a
Starting point is 00:54:50 C sharp world. But what if I'm in JavaScript, for example, and I'm in some other editor, or maybe I'm not even in a, an IDE, but just literally raw text, right? Then I don't have those tools, right? At my disposal. So if I just, uh, have it to where I can read, you know, reason about that. Oh, okay. These are in alphabetical order. Let me just scroll up to find that. Then fine. Now the argument is going to come in. Oh, but if you refactor that and you change its name, then it's going to be out of order. So then what do you do? And I get it. And I said, even at the time that this originally came up, I don't even have a good answer for that. I'm not even going to try to deny that that's a thing. Right. And sadly, you know, but at least, you know, if you really wanted to be particular about it, then,
Starting point is 00:55:40 you know, you could, we talked about the, the idea of, uh, about the idea of the two pull request idea. The first pull request is you fix the bug, right? And then the second pull request builds off of the first one. And the second pull request is, you know, any kind of code cleanup stuff so that that way, whoever's reviewing your pull request sees the cleanup separate from the bug fix. Right. So maybe that's the answer to keeping these things in order if you really wanted to. But, uh, you know, cause the other thing that, that, okay. And one of the huge problems that I have with this newspaper thing, uh, metaphor is that it's so inconsistent. it's what if okay because i know i can see joe's like chomping at the bed yeah i'm dying over here ready what if what if in the scenario
Starting point is 00:56:36 you have a class that let's say maybe you just have some kind of utility class right some kind of a class that's meant for the rest of your library and maybe it doesn't uh call anything it just has a bunch of static methods right what order you put those in it has methods that are that well it's not pattern already okay fine whatever you want to call it you don't want to call it that but this is the real world example where you know we've each done it we've each seen it done and so it's a thing what's the answer oh we're not talking about real world man we're talking about clean code this is how things should be i should go into a class i should see the one public method that's in there i should see it broken down into little sub methods that do
Starting point is 00:57:21 you know different hierarchical things like fetching the data performing some operations and maybe formatting and i can skip into whichever one i want to you know see what's going on because it should be organized well and okay so fine so you want to go back to this utopian example yes all right and and not live in a real world example so now now i'm going to blow your mind what about unit test then because in a unit test a unit test is exactly what i just described it's a class that has a bunch of methods that should not be calling each other they actually answer that so they know they didn't yeah they did so actually um if we skip down a little bit they have what's called conceptual affinity and basically if you are using the same type of
Starting point is 00:58:03 methods those should be grouped together. So if you don't have the flow in the newspaper format like what you were talking about. Okay, yeah, yeah, yeah. Okay. So that is where you do your unit test. Now, going back. So I actually do want to hold on. Hold on, wait.
Starting point is 00:58:15 I wanted to say that's a good point about the conceptual affinity because I hadn't applied that to unit tests. But they still don't say what order they should be in within that. There's no. They should just be grouped together. They should be in within that there's no they should just be grouped together they should be proximity so now they're just so now so now you have a class of 50 unit tests right they should be close they're just randomly yeah they're all close together because they're testing the same thing no not testing the same thing they're testing the same class so they're testing the same class so you might be testing different functions in that class or different methods in that class the Let's say you have 50 unit tests
Starting point is 00:58:46 for one method in a class. It depends what order they're in. They're randomly sorted is what you're saying. It doesn't matter. That's what I'm saying. I think that's horrible. I feel like the alphabetizing is useless. Because you said,
Starting point is 00:59:02 what if you don't have an editor? I feel like that's a cop-out because honestly, honestly, other than looking and get online, when are you not going to open up code in an editor? Seriously. Okay. But just because you're in an editor does not mean that you have the capability of zooming around through function. So no, but I mean, how's that any different one way or the other?
Starting point is 00:59:22 Like, I don't care. You can do control F and find the method name. Like, I guess my point with that is like, well, then that's even, I mean, how's that any different one way or the other? Like, I don't care. You can do control F and find the method name. Like, I guess my point with that is like, well, then that's even, I mean, still then that's, that's, I'm not going to search. I'm not even going to scan up and down a file. I'm always going to do control F and try and find generally what I'm looking for. I mean, almost every developer I've ever seen does the same thing. Like we don't want to scroll around.
Starting point is 00:59:42 We think it's about two thirds of the way up. No, nobody does that. We do a control F we find it regardless whether you're in notepad or in get online or whatever. So, but going back to the static method thing. So I actually have a feeling on this one, like the affinity rule there sort of applies to me. If you're doing, if you have a static class, it only has static methods in it, I would feel like, okay, if there's a bunch of things all doing something similar, they should be close together. Like you said, they don't operate off each other, but they all go together. The alphabetizing thing just never has done it for me. Like even the newspaper flow thing, I just do it by nature.
Starting point is 01:00:19 That's kind of how I do it. Now, if I'm adding something to a static class, I'm definitely guilty of just adding a method to the bottom because I'm not going to go through and look at the other 50 in there. I'm not actually going to order anything. Let me let Joe have a chance. I was just thinking
Starting point is 01:00:38 when you're, say you're working with somebody, you're doing a little bit of pair programming, debugging an issue, you're looking at the method and you're like, something's not right here the natural inclination is to scroll up and let me see what happened or you want to see what happens next so you scroll down to me it's just a natural evolution and i think most programmers just kind of end up doing that anyway and it just hurts my soul to think about a private method being the first thing i see when i open up the function or open up a class and that even counts for constructors like i you
Starting point is 01:01:04 know to me i want to see the constructors up at the top and so even counts for constructors like i you know to me i want to see the constructors up at the top and so i don't like the idea that there's methods that are some are uh in alphabetical order and some aren't and it's just uh i feel like that just kind of falls apart so it i do think it's good for like static classes stuff like that unit test like if there's no other way to sort them then yeah you might as well alphabetically do it okay but going back to the newspaper example this is another one of the issues that I have with it. Because I felt like this was one of the inconsistencies of the book, right? Was that we just talked about the idea of the block formatting, the variables, and you
Starting point is 01:01:42 mentioned the spaces before your argument list and after your argument list as, as, uh, in your parentheses for your method call. And then like doing either one of the things, it's like, well, why bother? Because the, um, the book specifically talked about the block formatting for your, your variable declarations. Like why bother? Because, you know, any refactoring tools automatically going to go away with that, right. Or tools that you could do refactoring. And guess what? what those same tools they will blow away your newspaper metaphor as well so why bother to do the newspaper metaphor no tool supports the newspaper metaphor even the clean code even the code made that you talked about will sort it will sort it
Starting point is 01:02:23 different but hold up the block formatting wasn't, what he said wasn't that formatters would blow it away. The reason he said not to do the block formatting on your variable declarations was because it detracts from the meaning of the file. Yeah, yeah, yeah. That was part of it. But later on in that section,
Starting point is 01:02:41 it was kind of like, oh, hey, by the way, automatic, here's the sentence. To make matters worse, automatic reformatting tools usually eliminate this kind of alignment. So he was making the point that why bother, right? It's meaningless. It's going to be done away with if you run it through any kind of automatic formatter. So you're right. You're absolutely right.
Starting point is 01:03:02 That was the main point that he was getting at is like, hey, you're emphasizing the wrong thing, right? You got the wrong emphasis on the wrong syllable, right? But, you know, also part two of that was that, well, it's going to be done away with and part of a refactoring tool. And so that's my point it's like this feels inconsistent because if you start using refactoring tools too or any kind of cleanup tools too then you lose that newspaper uh metaphor but generally speaking i don't think it's a great practice to just go run reformatting tools on your code anyways right like because that's again going back to what we talked about before when you're using source control it it really confuses things, right?
Starting point is 01:03:46 Like all of a sudden your methods all got rearranged. So now you can't even make heads or tails. You're looking at a pull request and you're like, I don't know what changed here. So that's, I don't really like that. I would rather you physically go in and make the modifications that you want. If you're trying to clean up a file.
Starting point is 01:04:01 I mean, we've seen some really bad code bases to where maybe you just run the formatter on the entire thing before you ever get started possibly i'm not saying i've ever done that right and i'm also i don't recall ever i mean i'm i probably have knowing how particular i am i've probably uh changed the order of something but i don't recall doing that so Specifically? Yeah, I don't have a for instance where I've submitted. So I'm not that crazy about
Starting point is 01:04:32 this, but I'm just saying that this newspaper metaphor just seemed like this unicorn. It's this utopian example that I'm like, oh, come on. That's not real world, man. I totally do it. I mean, I definitely do it, and I'm not even being facetious.
Starting point is 01:04:48 No, you don't. Absolutely. Like, if you look through my files, they absolutely do that. Yeah, I always have my constructor at the top and my properties, and I've got my public methods right at the top, and then everything else kind of flows out of this. Here's another problem with the newspaper metaphor is that not all languages will even support this some languages you have to the method has to be defined before it can be called so it's like
Starting point is 01:05:13 this isn't even right depending on your environment now granted those are probably you know you're probably like wait who's still writing in pascal yeah man header files come on yeah yeah seriously like okay you could take that argument but you can always change anything for that but i would say generally speaking like if i can i try and do a flow of you know it starts here then it goes here then it goes here i definitely try and do that i'm not saying i'm perfect at it but for the most part i want to be able to visually follow what's happening so i think okay because I think where you might be thinking of is you're talking about like code where you're the original author. You're starting on it.
Starting point is 01:05:51 So it's green filled. Totally. But that's not the case if it's new stuff. And in fact, you even in the previous episode said, no, I just throw it at the bottom. I even said it a minute ago. I will. Like if I go into a static file that is static methods and static class or whatever, I'll just put it at the bottom.
Starting point is 01:06:09 Like web API or something, right? It doesn't have to be static. It doesn't have to be static. Like a web API thing. I will literally throw the controller at the bottom because I'm not wanting to jack up anybody else's source control looking stuff when they're going into their pull request, and it's not relevant to anything else on the page.
Starting point is 01:06:24 And I've done it on stuff that i've changed or added to that you've had where literally i stuck it at the bottom and you were like oh but i had them in alpha i was like you know all i'm saying is that the the that it seems like it's if one is they they both seem equally arbitrary to me and if your whole point for going with the newspaper metaphor is readability, then my argument is that, well, if that's your concern, then from a consistency point of view, alphabetical should win. Because no matter what the caller situation is, alphabetical can still be alphabetical, whereas newspaper can't. And then there, cause then there's other weird scenarios where, um, that, that, and we talked about this in the Slack channel where let's say you have one method that gets called by three others, right? And you know, you could get into this weird chain, this weird call chain where that method is at
Starting point is 01:07:26 the very bottom of the file. And yet the, the first caller to it, maybe, you know, uh, let's say it's a 500 line file. Cause they said that that was about the max ish, right? So it's 450 lines up, right? But because of this weird call chain, you know, there's other methods that are using it because again, the whole part of the whole reason for it being in a method is to make it reusable. Right. So then it's like, that doesn't, this, this newspaper metaphor starts to fall apart. It sounds nice for certain situations, but then you start running it through its paces in real world scenarios.
Starting point is 01:08:04 You're like, uh, yeah, it doesn't apply here. Right? Yeah, you'll always have edge cases, but I don't know. For the most part, I think that it works out pretty well. Like, I mean, so here's the thing. Are you going to sort all your methods alpha even if they're private or public? Are you going to mix them together?
Starting point is 01:08:21 I mean, because if you had a formatting tool, who knows what it's going to do, right? No, I mean, it could keep the privates. You could keep them together by accessor. And when we talk about that, I'm cool with that too. I'm just saying. I actually do do that. In most cases. I keep my public stuff at the top and private stuff towards the bottom.
Starting point is 01:08:38 So going back, if you're refactoring something, like if you're going in and you're having to inject something into the flow, typically I will also try and do that in newspaper style now like I said if it's a web API call or something that's literally just another static method in a file I just throw it at the bottom because I don't care like I know nothing else relies on it it doesn't rely on anything else so it's there right but if I'm trying to if there's a flow that that I know that has to happen then i do try and keep it somewhere in the mix right so that it's easy to follow i get what you're saying if they're arbitrary then the alphabet should win the alphabetizing one should but i don't feel like they're that
Starting point is 01:09:17 arbitrary well i guess what i'm saying that um sorry joe i was saying it sounds like they both have their place and you know you just got to kind of take it with a grain of salt and make the right decision for your code base. Well, I guess my point though, is that if consistency is king, because we've talked about this before, right? As it relates to this book, right? Is that, you know, consistency in your formatting, consistency in your naming, you know, if you're going to, if you're going to call something a controller, then it should be, you know, it should live up to what we think of when we think of like a view model, uh, controller. Um, and then, you know, like if you're going to, if you're going to name things that mean things to developers like a visitor, then it needs to live up to the visitor
Starting point is 01:10:00 pattern. Consistency is King, right? And with the newspaper metaphor, I feel like there are not just edge cases, but a lot of scenarios that are not edge, okay? That the newspaper metaphor starts to fall apart, right? And that's why I'm saying like, okay, if you have to pick some arbitrary way to sort your stuff, fine. I would rather you just be full-on random, right? And just say, you know what? It's 2016. Just Command-F and find it, right?
Starting point is 01:10:37 Or if your IDE has F12 or Command-B or whatever, right? Whatever your IDE has to navigate year round. Fine, just complete random. But if you're trying to tell me to format, to particularly list them in a particular way, then I feel like alpha should be the one because that's the only one that can be consistent every time for every situation, no matter what.
Starting point is 01:11:03 Unless you have constructors, properties, or, you know, know public private protected methods no you can why can't you alphabetize those because i i will deny a pull request if you got private at the top come on that's terrible if you have your properties mixed in with methods come on no no no i mean you could you can definitely put we talked about like having your publics above your privates and things like that or you know i mean we've talked about that before yeah but now you're starting to make these uh these cases to deal with you know edge cases that aren't such edge cases you know these are really common things when we're talking about putting regions now and banners in there no i didn't talk about anything
Starting point is 01:11:37 about regions and banners it's basically the same thing except you're just uh getting rid of the dividers you're separating code that is logically meant to be grouped together. No, because the formatters can group by accessor level all your publics together and all your privates together. That's already a thing that can be done. I don't know, man. I like the newspaper thing. I don't think we're going to come to a consensus on this. I get that people like it. I just feel like it's a unicorn. And it'll work great on your first iteration of your Greenfield application.
Starting point is 01:12:11 But five years from now, when that thing's brownfield and you come back to it, it is not going to be in a newspaper metaphor format any longer. Yeah, maybe not. And that's the real world. Well, same with alphabetical. How many times have you seen a file that's 90% alphabetical and then a year later it's like 56% alphabetical because people just add to the bottom? Again, like I said, then yeah, but fine. Then go full random.
Starting point is 01:12:35 But if you're going to tell me to put it in a particular way, you can't tell me that newspaper is the one that's going to win every use case. No, I'm not saying that, though. I feel like it falls apart. You got to make the right decision that's going to win every you know every use case every no i'm not saying that though i feel like it falls apart you had to make the right decision that's right for your case but yeah we could totally do this all night so we should probably head on all right well wait what so joe's right all right so now moving on to the next part it's like there were some other things in here other than just the ordering of things. And one of them was like separating concept with blank lines. I'm a huge fan of this. Like if you've got a section of code doing,
Starting point is 01:13:09 so these two really go hand in hand. There was the separate concept with blank lines and they keep closely associated code group together. So it was very dense so that when you're just scanning a page of code, you see a line break and you see, Hey, this is the next logical thing that happens after it, right? I love that. Yep.
Starting point is 01:13:28 Same. Yeah, I'll do that a lot. I'll say like var something equals get something in the next line. I, you know, use it. So something dot do something. And it's so nice to have those with no line separation in between. But if you go on and use the next variable after that, it's unrelated. You should definitely have a space in there.
Starting point is 01:13:44 Yep. And it's really easy to see and in the book they gave several examples and showed the difference between you know poorly formatted code with no lines or ones that were all blocked or whatever and it it definitely makes it harder for your mind to just quickly adjust to what's going on another thing that they had was and we talked about this in one of the previous chapters, I believe, is variable declarations to be as close to the usage as possible. And if the method isn't too long, then that means it should also be at the top of the method.
Starting point is 01:14:15 Yeah, that's a little weird with JavaScript and hoisting and JavaScript is so popular now. But no, I really like this too. Yeah, I was actually going to mention that too. Especially pre the current, was it ECMAScript 6, 2016? Yep.
Starting point is 01:14:31 Or no, ECMAScript 5. Yeah, using the let methods. Yeah, forget about that. Well, now with the let, yeah, you can place it everywhere. But before, as Joe mentioned, with the hoisting, the idea was really it's the compiler, the JavaScript compiler was going to put it all at the top, you should too because that's really technically what's happening and you're just lying to yourself if you mix it in elsewhere yep yep so that was for a long time that was like standard
Starting point is 01:14:53 devices for javascript with the bars at the top and that's what that's the way it was at the time that this book was written so do you feel like that he's just kind of like spitting in the face of JavaScript and be like, you know, put it in line with where it's as close to its usage as possible? And who cares? Let the compiler do its thing and don't worry about it. Well, not really, because he also says down below that control variables for loops should be defined within the loop. So that's kind of a similar thing. Like you could have always done var i equal something in your loop. Now, granted, if you had an i defined up above it,
Starting point is 01:15:30 it was going to kill it. It was going to stomp all over it. But at least it was being defined within the loop. You don't want to be stomping all over it, right? There would still only be the one i. So yeah, even though you tried to double declare it, it's not going to blow up be stomping all over it. There would still only be the one I. So yeah, even though you tried to double declare it, it's not going to blow up.
Starting point is 01:15:49 You walked all over it. You're only going to have the one assignment at that time. That ejected it. Whatever assignment was in the beginning would remain that until you got to that loop. But yeah, so I mean, kind of like what Joe was pointing out there, I kind of questioned, was it that maybe at this time he wasn't really a JavaScript guy, didn't care about JavaScript,
Starting point is 01:16:14 or just didn't like that JavaScript standards were kind of like, hey, declare all your variables first. It's 2008. They're like, oh man, this web's never going to take off. Everything's going to be applets and DirectX. Well, back in the day, you also couldn't do the same thing with, like, C Sharp, right? Like, you couldn't put, there was,
Starting point is 01:16:33 you didn't really have an anonymous function or a lambda or whatever, so you couldn't really define the same variable twice. So, I mean, when this was written, it was basically if you had done I at the top and you did I in a loop down below, it was going to blow up. You totally lost me. What? So kind of what he's talking about is when you define your variable up at the top, right, or when we said in a loop,
Starting point is 01:16:55 if you define your variable in a loop and you varred the same var that was already done above it, really you're just reusing the same variable is what we said. However, using the let in JavaScript is similar to what you could do in C Sharp if you had a lambda or some anonymous function and you define the same variable within that function. So what I'm getting at is you can do similar things. Now, I don't know that those were necessarily available back when this was written. Well, no, let definitely wasn't.
Starting point is 01:17:20 So that's exactly my point. Or anonymous methods in C Sharp, right? I don't think you could have done that either is what I'm saying. Like you couldn't have done a four each. You could definitely do four loops. Not a four loop. Four each in C Sharp in 2008. Would you have stomped all over the variable if you used the same definition in your four each?
Starting point is 01:17:41 You would have, right? You couldn't have done the var. You wouldn't have been able to redefine it. That's what I'm saying. It would have broken. Like couldn't have done the var. You wouldn't have been able to redefine it. That's what I'm saying. It would have broken. You would have messed it up. You were saying an anonymous method, though. If you take
Starting point is 01:17:53 an enumeration, a list, and you do a foreach on it, using the lambda. For each var myString in list of strings. Then it would actually closure that type thing right so you wouldn't be stomping over my string outside it i don't think or does it still blow up it might still um i'd actually have to code it but what i'm saying is i don't think these type of
Starting point is 01:18:20 of things were around back then so he couldn couldn't really, you know, there was nothing else he could have said about it that would have made much sense. But I would have to code that C-sharp thing out to see if it would actually break. I mean, it might just blow up in the compiler. I think, yeah, I got lost somewhere in that. But, okay. There were only two more to close out this section.
Starting point is 01:18:45 One was instance variables should be declared at the top of the class totally agree with that uh by the way they call those fields in visual studio i don't know why i don't like that um i don't do that sometimes there's been a few times when i've put the field like there's some sort of you know method that deals specifically with a property but uh i can't really remember uh why i would do something like that i just know that i've done it before um so it's probably me doing something i shouldn't do and wanting to keep my shame you know as close together as possible and alienated from the rest of the code yeah i definitely like them at the top because then you just go look like you're talking about earlier with the private, you know, or your getters and setters.
Starting point is 01:19:27 Like I want those in one place like that kind of stuff. If I have a field that's specific for like a property, then I'll go ahead and put that field right above the property rather than a separate section for fields and properties. Oh, me too. I do that. Yeah, I'm bad about that too. I don't think that's bad. I think that's clean. Well, this is where I say it's bad is that if we're going back to, well, if a reformatting tool or refactoring or whatever was to come in,
Starting point is 01:19:51 then it's going to totally blow that away. And even related to summary documentation, summary documentation would put in spacing between that as well in the case of a public API scenario. So bad in that sense but i do feel like this is one of those acceptable times where it's like okay you know because these things going back to uh what did you refer to it uh something with a c word conceptual affinity yes the conceptual affinity um you know because they they, because they relate, then I'll put them together.
Starting point is 01:20:26 But, you know, he talks about, you know, instance variables declared at the top, but variable declarations, as you mentioned before, inside of your function should be declared as close as possible. So, you know, you know, it's kind of like a difference there, right? Because, you know, if you do have some instance variables that are only used in a couple functions, right? Like how, how are you going to do that?
Starting point is 01:20:48 Right. You can't, you can't have it declared twice. So rather than picking one, you just put it at the top. Yeah. Yep. So dear listeners,
Starting point is 01:21:01 it's now time for us to beg you for reviews. And we do this because they're really important for us they help us find new listeners and pretty much actually the only way we find new listeners so it's really big um itunes stitcher wherever else you can find but those are kind of the two big ones particularly itunes because we get a huge percentage of our listening listeners uh from itunes so it's really big i know it's a big pain in the butt um yeah I mean, just interacting with iTunes in general is a big pain in the butt. So we really appreciate everyone who's done it. And if you haven't already, then we would love that too. So please consider it. And thank you.
Starting point is 01:21:36 And how can they do that, Joe? If you go to codingblocks.net slash review. Boom. There it is. Yes. review boom there it is yes all right so it's uh my favorite my favorite section of the show survey says so in our last episode survey says all right so in our last episode we talked about uh stickers because we've got coding block stickers now. And if you would like one, send us a self-addressed stamped envelope. And you're like, but where do I send that, Michael? So, uh, hit us up on, uh, DM us on Twitter or, uh, if you're in our Slack channel or you want to send an email uh you know send us an email and uh comments at
Starting point is 01:22:27 codingblocks.net and we will send you a sticker or more uh to the address of your choosing but since stickers are now a thing i'm of the opinion that i like to have stickers on my laptop because you know my opinion is hey this mac is uh is got this nice metal casing on it that, you know, you can't tear off with a sticker. So let me put a sticker on it because then if I don't like it, I can easily just take it off and you'll never know it was there. Right. So the question is, do you put stickers on your laptop? Now, Alan, you're not over there cheating, are you? I have not looked at this.
Starting point is 01:23:04 I already know the answer. What? I have not looked at this. I already know the answer. What? I have not looked at any of them. All right. So your choices are no. I've got class, and I'm an adult. Stickers are for kids. Or your other choice is stickers!
Starting point is 01:23:23 Stickers are the things. All right. And you got to say it like really excited like that. All right. So Alan and Joe, let's see. I think Joe might have gone first last time. He did. All right.
Starting point is 01:23:38 Alan, 65%. No stickers. I got class. Peace out. 65%. All stickers. I got class. Peace out. 65%. All right, Joe. I was going to say 60%. What do you think it is?
Starting point is 01:23:50 So I'm going to go 66%. 66%? Yes. For which one? No stickers. Come on down. Both of you? Wait, Joe.
Starting point is 01:24:02 I've been to conferences, man. It's mostly not stickers. It's all shiny, man. Especially with people's work laptops. What? Yeah. No, it's mostly stickers at the conferences. I don't know what kind of crazy kid conferences you're going to.
Starting point is 01:24:19 Well, I'm going to the sticker conferences. You're going to those hipster conferences. That must be what it is. All right, so don't leave us hanging here. What do we got? Well, by Price is Right rules, you both lose. I was going to say, you've been to the most conferences of anyone I know this year. So I should have trusted your hints. Yeah, man, stickers.
Starting point is 01:24:43 Why would you not? There's no way they were more than 50 why would you not pick stickers no definitely stickers are on laptops that's totally a thing what was the percentages i mean even in our own work environments you see more stickers on laptops than not i i need the percentages all right all right so right. So, but the no's won. Yeah, I told you. What was it, 55%? 64.
Starting point is 01:25:11 No, it was 62%. I wasn't going to say 60, but Alan ruined it. Yeah, yeah. Well, that's when you should have just said like one percent joe and that way you know man i was just trying to prove a point i knew that most people don't want stickers on i can't believe that dude that is mind-boggling i have two on mine and it's only because i love them both it has nothing to do with the fact that i wanted stickers on my laptop that is insane i did not want any but it's needed to be no i this is you know what
Starting point is 01:25:47 i should have there should have been like more classifications like no because i'm really old or no because i'm really boring or because like why i feel like i feel like the the fun people were like oh yeah i want stickers stickers stickers on my laptop and like you know boring people are like no i feel like people who put stickers on things are trying to hold things together or cover up holes yeah i put stickers on things just not on a laptop yeah man and somebody asked about cars today like what do you feel about bumper stickers on cars and i'm like man that's even worse than a laptop no so i think if i was like a samurai i would have put a sticker on my katana you know my instrument of death no no no no i'm with you on the car my katana
Starting point is 01:26:35 i i don't have stickers on my car and uh so i'm i'm with you on that. That's not to say that I never have, you know, but, uh, yeah, definitely not in, you know, recent years. I definitely haven't. Hey,
Starting point is 01:26:52 by the way, for all, all of, uh, everybody that's gotten stickers, definitely tweet us a picture of it when you've stuck it on something or you get the note in the mail because, uh,
Starting point is 01:27:01 it's fun. We're, we're getting a lot of them. People seem to be excited about it. And so it makes us excited. Yeah. I want to see some stickers on some laptops so that alan and joe will be like oh michael was right that does look no man i actually took one of the stickers and stuck it on the back of my phone case now i'm down with that because that case is disposable right see this is where you did it wrong You should have put the sticker on the phone because the case was clear.
Starting point is 01:27:26 So for those who don't get to see Alan's phone, it's in a clear case. If he had put the sticker on the phone, then the sticker would always be perfect, and the case would make it look shiny. But then I would have sticker residue on my phone when I pulled it off. I can't have all that. Okay, now here's a thought. Here's a thought. What if you hadn't stuck the sticker on the phone?
Starting point is 01:27:50 You just placed it in between the phone and the case. Then it would be round. Yeah, it wouldn't be straight. That would drive me crazy. I couldn't take it. I like the low maintenance, man. It's particularly things that thrive on negligence. And yet you have dogs and cats.
Starting point is 01:28:09 Oh, yeah. Maybe that's why I want to simplify so badly anything that I can. These little monsters. Oh, that's awesome. Well, all right. Well, we had talked about setting up a survey for this one. We totally didn't, did we? Yeah, I know Joe threw out some ideas, though.
Starting point is 01:28:30 Yeah, you guys didn't like my survey ideas? I don't think I heard it. Okay, well, you want to hear one right now? Please do. Throw it out. This is what it's going to be. All right, so the new MacBooks, right? They've got this little smart bar in place of the function keys.
Starting point is 01:28:45 Oh, the track bar. Yeah, the track bar. So is this the death of the MacBook Pro as the primo dev laptop? Or, you know, is this just how it's going to be and it's still going to reign supreme? The beginning of a new awesome era? Yep. The future of the changing keyboard or type surface.
Starting point is 01:29:08 Yep. Because I really do think, like, if you go to a conference now, I mean, you probably see, like, at least 60% MacBook Pros, right? Yep. Right. It's very common. Especially, you know, like, Microsoft, not so much. But if you go to, like, a JavaScript conference, forget about it. Ruby on Rails, definitely.
Starting point is 01:29:22 Like, don't even think about it. But I wonder whether it's going to be, like, you know, a few few years from now it's gonna take some some time to kind of phase things in but yeah i'm kind of worried about like i love my macbook pro but there's no way i'm giving up my function keys yeah same here dude i'm not excited about this at all like it really has me debating a surface book and seeing if i can hackintosh that baby at some point i don't know why you'd want to bother i really like os x or cr or whatever you want to now it's mac os yeah mac os i really like it man i really do but this really bugs me i hate i hate the direction but i mean if you're going to take the time to buy a surface just leave it with windows 10 i want. Well, that's why you have the
Starting point is 01:30:05 anniversary update 1607. You know, install your Bash, the Windows subsystem for Linux. I like Mac, man. I really like the OS. So that's why, I mean, that's why I've got my phone. But the things that you like about it, I think you're not going to you're going to be frustrated with that
Starting point is 01:30:21 Hackintosh. Possibly. Yeah, I've heard. I've heard. So, yeah, at any rate, I am curious what the outcome of this will be. I have a feeling I know which way this is going to go, especially with a bunch of developers, but we'll see. Yeah, I've seen ads for it. It's got like checking the email, and there's like the bright red send button or something. Why don't you just hit enter?
Starting point is 01:30:39 I don't need that. Yeah, command enter. Done. I guess you know how I'm doing. Or, you know, you could have multipleter. Done. At least you know how I'm running. Or, you know, you could have multiple screens to look at now, you know, so that you could see the waveform on one surface and the actual video or audio on the other surface. That's why I have two monitors. Yeah.
Starting point is 01:30:59 Although, speaking of editing audio, then made me think about the – what was the new – we're off topic, but the audio, the new editor that Adobe is coming out with, what was that thing called? Oh, yeah. That was pretty cool. Where it could replace – you could replace audio that hadn't even been spoken. So basically the idea was a lot of people have probably edited audio at some point and you've seen this waveform of what of the representing the voices right and it gives you kind of like a visual cue of like what's where and you know you could use to edit it but Adobe took that concept a step further and
Starting point is 01:31:38 they said hey well what if we also transcribed what was actually said since you could actually read the words there right and what if instead of moving the waveform around, instead if you were to just like copy the – cut the words and reorder the words around, and then that way it would reorder the wave – the corresponding waveform with it, right? So in the example that I gave, this guy says something to the effect of, before I went to bed, I kissed my dog and my wife. And everyone laughed. I was like, oh, he probably meant to kiss his wife first. So let's change that. So they just
Starting point is 01:32:17 select the word wife that was transcribed and cut it and then paste it in front of dog and, you know, reorder dog and wife and, you know, and the software fixed that. And then he was like, well, what if we just want to change this to where he just says, you know, he kissed his dog. So they take out the part about him kissing the wife altogether. And it sounds, you listen to this, you listen to the audio, it sounds great. And then he's like, oh, well, what if we want to add text to it? Like he didn't say that he kissed the dog, you know, how many times he kissed it. But what if we said, and I kissed my dog three times. And so they start typing in new words and based off of the audio that it already knew, right, it was able to make new waveforms that matched the previous spoken things that that person had said. Right.
Starting point is 01:33:13 And so then, you know, the final product was and I kissed before I went to bed. I kissed my dog three times. And actually they changed it to and I kissed Jordan three times. If I remember that. That's amazing. So so they basically completely changed the, basically completely changed what was being said. It was a really neat presentation, but it really made you think about the future of being able to edit podcasts.
Starting point is 01:33:35 So maybe in the future, we'll just be able to type this out, and we won't even have to record it. We'll just type it into some Adobe product and away it goes. There's some TV show where they were making new episodes of Seinfeld by splicing together old ones. That show is... I can't remember now. I'll bet that's awesome.
Starting point is 01:33:55 I think the world needs more Seinfeld. That sounds fantastic. I think in the show, the real Seinfeld was upset about it. He was like, come on, let me get money. Yeah, I think in the show, the real Seinfeld was upset about it. He's like, oh, come on, I'm not making any money. All right, so I guess we got to get back into this stuff, right? Yep. And before we go on to horizontal formatting, though,
Starting point is 01:34:16 there was one section where, talking about the vertical distance, that he says that, well, we want to avoid forcing our readers to hop around through our source files and classes, right? And I get the want part of that sentence. I feel like he's not letting this one go. No, no, no, no, no, no, no, no, no, no, no, no, no. Why you got to hate? Don't be like that.
Starting point is 01:34:44 But I even wrote this down. I'm like, man, maybe I've, no, no, no, no, no. Why you got to hate? Don't be like that. But I even wrote this note. I'm like, man, maybe I've just had bad luck. Okay, maybe that's my thing. Maybe I just haven't had the good fortune of working in these utopian code bases because he says that we want to avoid forcing our readers to hop around. But I'm like, man, that has just been inevitable in my career. Like it's just like you're going to hop around but i'm like man that has just been inevitable in my career like it's just like you're going to you're going to bounce around like that's just going to happen man yeah sometimes i wonder people listen to the podcast and they hear us talk about you know the
Starting point is 01:35:14 way we you quote unquote should do things like oh man the place i'm at sucks so bad none of this stuff applies it's like no man it's we're we're talking about very pie in the sky like how we think should things should be someday when we finish all our tickets and have no more client demands and get all the time in the world to just make clean, pure code. That is true.
Starting point is 01:35:36 Yeah. This is the direction we want to go, right? This is what we want to strive to be. This is the things that we want to think about when we're writing new code, but this is not very practical stuff. Yeah, we definitely strive to put things in alphabetical order but oh wait oh sorry ah i wouldn't messed it up all right so let's get into horizontal yes let's do this so how wide should the line be anybody any tak? I know I've hated it when I've run formatters and it's like bump stuff after 80. And so I've got all these like strings broken in half.
Starting point is 01:36:11 So I'm not a big fan of doing this. And I feel like most of the time when things go over the horizontal width, it's usually because it's some sort of, you know, messaging or string or something that I don't really even care about. Anyway, it's not really code to me. It's data. And you can say that, you know, maybe that data should be broken out. But for the most part,
Starting point is 01:36:27 the horizontal formatting thing is just not a big deal to me. I would much rather just have that stuff be scrollable if it's a string. Okay, but like, are you going to make it a thousand characters wide? Like, where do you stop? I don't care if it's a thousand. If you want to put like a big paragraph in a
Starting point is 01:36:47 string you know and code that i don't really care okay let's let's let's take out the the hard-coded string examples though and let's just say it's like pure code like you're you're doing some method chaining oh yeah don't do that yeah it was like dot dot dot. How wide do you go? No more than two methods in a row. Okay, well. Dot something parentheses, dot something else parentheses. Like anything longer than that, you should have each one on its own line. So you're talking maybe 60 characters.
Starting point is 01:37:19 Yeah. Okay. Wow, that's even shorter than. That's like really really short then have you seen some of my method names well so long as the stat well here was a stat from the book that was kind of interesting was in the popular projects examined it appeared that 40 of lines were between 20 and 60 characters yeah but i feel like that's 40 between 20 and 60 characters because they were already going to be not because uh you they were uh how did you just word that where it's data well data is different right like that's that that's not code that's literally just a representation
Starting point is 01:37:59 of some information in there you're not doing doing anything. I mean, yeah, because for so long, 80, which is really a very dated number, but for so long, 80 has been the thing, right? Yeah. So that's what I'm saying. Like, it was, you know, their percentage came out to be 20 and 60, between 20 and 60,
Starting point is 01:38:22 not because they didn't want to go out to 80 out to 80 no no it had nothing to do with that this was just examining that's how it like percentage wise worked out yep so that was the popular one 70 of all the lines were under 60 characters is what it boiled down to which was a little surprising and really wait how can how can It was between 20 and 60. And then below 20... And 70, you said 70 was below 60. No, 70% of all lines are under 60. So 30% of lines were less than 10 characters. So if you combine the 30 and the 40%, you're at 70.
Starting point is 01:38:59 I got you. So that said, it already looks like just by default, most of them were pretty short anyways. So is that because, is that 30% then for the less than 20, you know, you got to believe like, is that just because it was one line for a. Var I equals zero. Or, or a curly brace, you know, the beginning of a curly brace, beginning or end of a method for a curly brace.
Starting point is 01:39:24 Good call. Or parentheses or something like that. Could be, yeah. I mean, I'm sure they just did a static analysis of it. Yeah. And Uncle Bob Martin basically said that if you're going over 120, then you've kind of gone overboard. I would agree with Joe. If it's just a string, whatever.
Starting point is 01:39:43 You know, who cares? If it's data and it's not code then it's not a big deal but yeah if you've got an actual line of code that's over 120 characters you're probably pushing the limit so I tried to think of an example sentence that we can kind of figure out where 80 characters is exactly so I tried to think of the most
Starting point is 01:40:00 iconic you know kind of words I could think of I thought maybe about the constitution or something. Well, what I ended up with was Bohemian Rhapsody. So 80 characters is... Is this the real life? Is this just fantasy? No, no, no, no, no, no.
Starting point is 01:40:17 You got to sing this. It's very high. We're listening. It's just fantasy. Caught in a landslide, no escape. That's where it ends. No escape? That was it?
Starting point is 01:40:32 No escape. That's 80 characters. Nice. If you wanted 120. Wait, even better. Even better. I think Joe owes it to the audience. Joe, you should restate that Bohemian Rhapsody verse, but do an impression of me doing it.
Starting point is 01:40:55 Okay, I can do that. I'll step, I'll get back from the mic a little bit so I don't blow out your speakers with my awesomeness. I can do that, he says. All right, I'm going to stop at 120 characters this time all right let's do this this is outlaw singing baby rhapsody wait no not me singing i just no is this the real life is this just fantasy caught in a landslide no escape from reality open your eyes look up to this that's it so and all i really had there was just starting out real strong and then kind of fading down a little bit which you know james has called you out on many times oh man really really all right All right. That's awesome.
Starting point is 01:41:49 So what we got to here really is 120 characters. If you go much longer, it's probably bad. Yeah, he says it's careless. It's careless. And I would agree with that. I actually like what Joe said, although I don't do two methods. Usually I'll do one method per line, right? So if you're changing a bunch of them, then I'll come down and indent the next line and do dot something
Starting point is 01:42:06 and then go down the next line, dot something. And then that way it's just really easy to follow. But, you know, if your language doesn't support that, I could see how it could get longer. And if I actually look at my monitor, which is ultra wide to be fair, but if I look to see how far I can actually get, how many characters,
Starting point is 01:42:23 I'm looking at over 335, which is well into the Mama just killed a man section. It's all based off of you, dude. It's the standard, man. I like the metrics, man. That's actually how all things should be done in business from now on. If you got to mama, you've gone too far. Yeah.
Starting point is 01:42:48 I mean, even if you are on an ultra-wide monitor, though, and you might be tempted to think like, well, who cares? Because it's just me. I'm the only one looking at this. I've got this ultra-wide monitor, so I'm going to make the lines as wide as I think makes sense so that I So, you know, I'm going to put it, I'm going to make the lines as wide as I think makes sense so that I can, uh, you know, get this done. Well, you might be thinking
Starting point is 01:43:13 short-sighted because then you can't, you know, if you wanted to like split screen that ultra wide monitor and look at two files at the same time in that editor, you know, then you're going to find yourself scrolling back and forth in one of those windows because you made this really long, you've reached mama. Or then you shrink the font, which he also said, right? Oh, God. If you have to shrink the font to read the file. That's a problem. I mean, you've passed Ludicrous and you went to Plaid.
Starting point is 01:43:44 Yeah, actually, I keep finding myself shrinking websites. Like, I'll go to them, and they'll be so big, I have to turn my neck to read the sentence because I guess it probably scales out, you know, mobile first and all that jazz. It drives me crazy. I shrink it down. Yeah, I do the same thing.
Starting point is 01:43:59 Command minus minus. So another thing they said was put spaces on both sides of an assignment operator like an equal sign now i have to say i do this on equal signs i do not do it for colons like if i'm writing json i do not like putting a space before the colon yeah after it but i hate it before it that was the correct answer yeah i think Will and I actually argued about that one too. I can't tell you why I would get that way. You know what? I can't either.
Starting point is 01:44:33 Honestly, I don't know why I don't like the space before. If it's not there on the equals, I'll go crazy. But if it's there on the colon, I absolutely lose my mind. I can't take it. A space before it. Yeah, I don't like it. Yeah, he talks about doing this same kind of thing though like um trying to set some sort of uh order of operations related to math yes and and your use of spacing there to try to signify you know the things that are going to happen before
Starting point is 01:45:02 and after and i'm like he even you know he even later formats or comments on it that his exact quote was, unfortunately, most tools for reformatting code are blind to the precedence of the operators and impose the same spacing throughout. So subtle spacing like those shown tend to get lost after you reformat the code. They do, but I will say this and i've always felt this way even when i was doing math i don't like this whole thing of it so what he was doing what he was explaining right there is like let's say you have a times b times c and then minus he would put a space for the minus in a space after the minus and then c times d times e
Starting point is 01:45:42 so the multiplication comes first obviously and the minus is next i C times D times E. So the multiplication comes first, obviously, and the minus is next. I don't like that. I've never liked that. I would rather group it with parens, so it's super obvious. Oh, no, he did do that in his example, but he would have, in parentheses, no spacing, okay? Open paren, A times B, close paren,
Starting point is 01:46:02 and there's no spacing in any of that. All five of those characters are one right after the other. Space, minus, space, parentheses, C times D. Did he have the parentheses in there? You looking at it? Yeah. I could have sworn he didn't have the parens in it. I mean, I can hand you the book, but yeah.
Starting point is 01:46:21 No, he did. Yeah. All right. Well, yeah, in that case, I mean, I would put the space before the minus and all that. I was just saying, I like the grouping. Like,
Starting point is 01:46:28 well, but he goes even further. Like, you know, in, in his example though is actually division. So he had, he had space before and after the divide symbol.
Starting point is 01:46:37 I typically do that. And it's like lost in parentheses, right? Like you, you can't really see it. It does. But to his point though, if you, if you hit that
Starting point is 01:46:45 thing with a reformatter, it's going to put spacing in between your A times B. It's going to make it's going to reformat it as A space times space B. I definitely like this.
Starting point is 01:47:02 You like the spaces? I'm indifferent on the spaces on the multiplication type stuff, but I don't know. I could go either way with that one. I guess this was just like one of those examples that were kind of bothered me where it's like the suggestion is inconsistent with your tooling that's out there. So it's like,
Starting point is 01:47:20 why bother to make this suggestion? Right. It's inconsistent. You're going to be fighting it. Yeah. And that, I mean, not to harp on the newspaper, but I kind of feel if you're going to be fighting it yeah and and that i mean not to harp on the newspaper but i kind of feel like you're going to be fighting that too right i don't know so never reformat the code so i'm good yeah okay newspaper is correct and this feels right this this will be a dead horse by the time the show is over i'm pretty sure like our new is newspaper even a thing anymore, didn't it?
Starting point is 01:47:45 The internet killed it. Magazines do the same. Therefore, newspaper metaphors should die because the internet killed it. We have Kindles. They do the same. I think we just call it normal now. Oh, God. He also said he doesn't put spaces
Starting point is 01:48:03 before a paren after a function name. I agree with that. I don't like seeing function space, open paren. Like, that drives me crazy. Yeah, you don't call it that way, right? Right, you don't. So if you had a public method called get name, right, you wouldn't say get name space, open paren, close paren.
Starting point is 01:48:25 Correct. And that's fine. Now, if it was a declaration. I still don't. But if it was a JavaScript declaration and it was anonymous. Oh, then you just do function space. You should, although JavaScript will take anything. But going back to the JavaScript of good parts, the author, I can't remember his name off the top of my head.
Starting point is 01:48:53 Douglas Crockford. Douglas Crockford, thank you. you should make it as part of your anonymous function declaration, function space, open parentheses, and then any arguments, close parentheses. Because what you're trying to signify in that scenario is that function isn't a method, right? There's no name on that. Function is a keyword to say, hey, I'm about to define a method. Right.
Starting point is 01:49:23 Right. The new ES6 stuff's pretty cool. It's like the Lambda kind of syntax, maybe like parentheses, hey, I'm about to define a method. Right. Right? The new ES6 stuff's pretty cool. It's like the lambda kind of syntax, maybe like parentheses, arrow, function. Yep. You know, the fat arrow. Yep. I do like those.
Starting point is 01:49:33 There was another one here also to do with methods was putting spaces after individual arguments. So if you have argument one, comma, put a space. Argument two, comma, put a space. I agree with that visual separation. I do not like the space before the parentheses or before the first argument or after the ending argument. I think that's crazy talk.
Starting point is 01:49:55 Yep. So multiple variable declarations, though, of the same type on the same line, like, do you like that? No. What, like string A, comma, space B? Well comma because that's what you were just describing right is like yeah like string string a comma space b comma space c semicolon right yeah or string space a comma new line b comma new line C semicolon. I like new line on those.
Starting point is 01:50:26 So these were arguments to a method. You don't like that either? No. You have to have the word var on each line. Oh, no. If you've got so many variables to cut at the top there that it's distracting, then maybe your function is doing too much. No, no, no.
Starting point is 01:50:42 I don't think three variables would be count would count as distracting right yeah three is fine if you've got 10 then there's something else going on i don't know 10 is not unreasonable either depending on what you're doing 10 with 10 variables in javascript man you could do just about anything you can like go to youtube and download something i mean you can you can do a lot of crazy stuff in j. I feel like we should have a whole hacker con about how many variables can you use to hack this environment? What's the biggest theory you use to win? In JavaScript, 10 lines. It's like the opposite of a name that tune, right?
Starting point is 01:51:21 Except hack that environment. And hack that environment in one line. Oh, we just hit the place where they were talking about the block formatted variables. And if you've seen this, you probably have. If you've ever done any database stuff, you'll see that the column is on the left. Then they'll tab over a certain number
Starting point is 01:51:37 of spaces and then do the type. And then they'll tab over and do something else. And he was saying, don't do that. It's distracting from the story of the code i agree i don't like it yeah i like that in sequel but after reading this again i was like oh wait crap you're right i'm not okay i don't care about these types in vertical order i don't care about in daytime in what i care about is the horizontal association so why am i making that harder just to make something look pretty vertically which i'm not even using yeah i don't like the lining up i never have but it is very uh prevalent in sql yeah sql is terrible man
Starting point is 01:52:11 and even the word declare like you know declare i just talked about how i'll do in javascript i'll do var a equals var b equals var c in sql man i do one declare because declare is such a monster word generally it's even longer than the variable I'm declaring. I don't want that thing three times in a row. You can't even remember what's going on. How many characters is declare? That's like a good chunk of that 80 right there. A good chunk of the 80.
Starting point is 01:52:37 That's seven right there. On your Bohemian Rhapsody, that is this. Yeah, you have a daytime in there in there man you're at 17 already no variable name uh the next part was lining up your code code is hierarchical never really thought about it like that but it totally is as you get into a scope whether it's an f block or a while loop or something like that, you just indent, right?
Starting point is 01:53:07 You should always do that so that people can look at your code and understand what in the world is going on. Now, however, I did have a question or a thought on this one, and this is actually SQL-based. So if you've ever gone in to do a function or a stored proc in SQL, and there's no good way to trace your progress. So you might do a print, and you might be indented over four levels because of all your logic in your proc.
Starting point is 01:53:33 But to print, you want that thing to show up on the line all the way to the left. And so I'll do a print and then go down a line and put my message on the left. And so it just looks nasty in the code yeah i do that so i don't forget to remove it after oh okay yeah i mean i i don't know a way around it like if you want to start at the next line is there a better way i feel like this is already a code smell like the fact that your your stored procedure is so complicated that, one, you're indented to four levels. And then, two, it's so complicated that you need to have print statements in there to see what it's doing. That's a code smell already.
Starting point is 01:54:17 I wouldn't even say a code smell. You ever had a trigger and you needed to check the nest levels? Please. I mean, seriously. At that point, you will thank yourself for having those print statements in there. Oh, man.
Starting point is 01:54:31 Modulizing SQL is just a joke anyway. SQL is such a terrible language to work with. There's so many just little sugary bits that have not been added over the years that just drive me crazy. But I'm sure there's really good reasons. And believe me, I couldn't do any better. But man, there's some things about SQL that just eats me crazy but i'm sure there's really good reasons and believe me i couldn't do any better but man there's some things about single to eat me up as you know i'm really not trying to hate not trying to join joe's hater wagon for uh sequel though but i mean
Starting point is 01:54:58 i really do feel like we've talked about this about like there's so many good coding habits and then when it comes to sequels like oh oh, you know, all bets are off. Nobody does that. Yeah, totally. If anybody's listening and you're trying to do good programming habits and SQL, you're probably doing it wrong. And I'm not being facetious. If you try and go the OO route because you're a programmer and you think, hey, we should make this thing modular, you're probably going to kill performance by going that route. So stop thinking like that and start thinking more about how do I work with data sets? Because you will absolutely shoot yourself in the foot as you start breaking
Starting point is 01:55:31 things apart and they start working on a row by row basis. So, uh, and, and I mean, sadly that's not, uh, yeah.
Starting point is 01:55:39 I mean, you, you have to think about sets. You can't think about modularity. No, you really, I mean, you will absolutely destroy your performance. So, at any rate, that was a little side tangent.
Starting point is 01:55:50 Oh, one other thing the dude said... So, are we saying that... Is it that SQL sucks then? Or is it that working with sets sucks? SQL. It's the SQL. Yeah, I mean, if I could just order something dynamically. Dude, you just need to work in MongoDB and call it a day.
Starting point is 01:56:07 MongoDB is pretty fun. If you've never messed with it, I think you would love it, Joe, because all your complaints are answered. But I want to release data. Well, first, MongoDB, that's a DocumentDB. It's a NoSQL database, right? So, like, automatically, it's a win for Joe because he hates SQL. So this is no SQL.
Starting point is 01:56:25 Yeah. I do hate the SQL language. But they've got their own query language, which is probably way better. It's pretty easy though. No, it's more like OO type stuff. It's pretty easy stuff. Yeah, I mess with it a little bit. Just kind of mess around.
Starting point is 01:56:36 But for the most part, like I want to relate data. I want to join things and deal with data in sets. It's just the actual syntax of sequel drives me crazy and it drives me crazy that was set like in the 80s and there's still not ways to do things that are really common and that just seemed like no brainer things to add to me maybe they just got it right you know the 80s i mean think about it you. You had Back to the Future, Reaganomics, DeLoreans. I mean, come on, DeLoreans. Joe's a closet sequel lover.
Starting point is 01:57:10 That's all there is to it. I think that's really what it is. He says all of this, but all of this hate about sequel, and it's really so that he can feel it's to counteract how much he actually loves it. And he doesn't want to you know hipsters to be like oh my god that guy's like way too much in the sequel so he has to like throw out the sequel hate there yeah two words man paging and sorting okay you got you got two good points yeah actually it's like one of the most common things you ever do and like you have
Starting point is 01:57:41 to jump through some stupid stupid hoops for it drives me crazy you only ask for two words so you get paging and sorting's gone so back to the yeah back to the it was an off by one error as always so the other thing he mentioned and and i've done this i know we all have like you'll have a bunch of like public properties in c sharp and you'll have your getters and setters and really they're just doing a get return something and you'll be like oh man i don't want 500 lines for this i'm going to collapse it down so that the get and the set are all on the same line and he said i'll usually go back and split them back out so that visually you can see what's going on. I don't know how I feel about that.
Starting point is 01:58:28 Usually what ends up happening is I'll have a bunch of those properties and I'll have the gets and sets on the same line. And then there'll be one that needs actually a private property. And I'm like, oh, I can't in good conscience only do this one this way. Well, I thought, though, I'm trying to find that that exact part though wasn't he talking because because his context or frame of mind for this section was coming from a java world which doesn't have the get and set auto properties that you're referring to in c sharp his were more like getters and setters so was it i thought it was more like if statements like uh you know it could have been that if something If something's true, then you would immediately have a return,
Starting point is 01:59:07 and it's all on the same line. Yes, something very similar to that. If I recall. So as it relates to the getters and setters in C Sharp, if it's simple auto properties that do nothing, then fine. I mean, I'm all for just keeping it simple on the one line uh you know you're right as soon as you break out the first one then you know you got to break out the second one too yeah because you just start feeling like it's wrong i think syntactically that you can't you have to syntactically you can't i'm not talking
Starting point is 01:59:39 about breaking out the get and the set individual i'm talking about like the ones that you had done before like the auto properties that were above it. No, no, no. Auto properties, you don't need to. Auto properties you're getting set are defaults by the compiler, so they can be empty. So I'm saying like, okay, so you have one auto property, and then you have a second property in your class that is not an auto property,
Starting point is 02:00:03 so you're going to provide the get and setter right i have no no problem with mixing that letting the auto property be you know uh you know using the default auto property and not bothering to break that out on a separate line because what would you have like get semicolon new line set semicolon because it's an auto property. So maybe not an auto property. If you're thinking about like, so you have a private backing variable, so it's not an auto property, but it's, you know, one of these public properties that you're just getting. So you might be literally just saying set this equal value, get, you know, property. Like typically I'll have that on one line because i'm like man that's such so so you're saying you'd have uh like let's go back to we've we've talked about get name as the canonical reference during
Starting point is 02:00:52 this episode so you have a auto property for name and uh you want to have a getter for it so and you have a private backing field for it called underscore name so you would have get uh curly brace yeah curly bright well semicolon no uh yeah get get curly brace return uh return underscore name semicolon curly brace yep set semicolon value or uh underscore name yeah curly brace underscore name equals value semicolon curly brace yep and in that simple example yeah i would be okay with that too yeah but then the thing is is then you'll get one that's got more complex business logic behind it and then you're like man i broke that out into five lines maybe i should do the other one for the five lines you know it's just, oh.
Starting point is 02:01:46 Here's the thing. Like, because I'm kind of indifferent about that one. Like, I would probably, in the one-line examples, I would probably write them out there, and if the IDE or, you know, a re-sharper or whatever, you know, plug it, and if I had some plug-in, and it was like, no, no, no, let's, let's be consistent and format this, whatever. I wouldn't care though. The one example where I am more, uh,
Starting point is 02:02:13 let's say, let's say that you have an if statement in a return statement. So like, let's say, um, you know, you have some method and you say like, oh, well, if this value is null, then just return early, right? And you would have the return on the same line. I can't stand that. I don't like that either. Cannot stand that. Not only – and I take it a step further. extremely i'm not saying i never have because there are like extremely rare instances where i might have a return statement on the same line as the if right but like one in a billion right like
Starting point is 02:02:55 i don't think i've ever done it i can think of one example where i have and and the whole method was three lines long i I love it. Right? No, you don't. I love it in Ruby return if condition. One line. Well, that's different, man. Yeah. Yeah.
Starting point is 02:03:15 Perl has some similar kind of syntaxes like that. But where I would take it a bit further, like let's stay strictly in a let's confine this to Java, C Sharp, JavaScript, C, and C++, right? Not fancy languages. So, well, those because four of those are strongly typed. Right. Um, in that, in that, in that case though, what, uh, I take it a step further and I like to include not only the return on the next line, but I like to go ahead and put the curly braces around it because even though I might not need it in that case, because it's only one line more often than not, I'm going to need, I'm going to want to add a second line to that if statement. And so I'm going to have to add the curly braces eventually anyways, whether like
Starting point is 02:04:13 maybe it's a debug statement that I want to add or some new logic that I need to add, or maybe I need to log and add some logging in because I'm doing a return in this particular scenario or whatever. Eventually, inevitably, I'm going to want to add one or more additional lines to that. If so, go ahead and put the curly braces there to protect myself in the future so that I don't end up in a Apple go to fail. Yep.
Starting point is 02:04:41 You know, error, right? Yep. That's my thinking. I agree i i feel like it should be on a separate line so it's obvious that's pretty much it and they actually talked about something similar in the book for while statements don't don't do a cute while statement with the semicolon at the very end of the line because people won't see it they won't realize that it's not actually
Starting point is 02:05:02 doing anything put it on the next line make Make it obvious. Make it jump out. You know, he mentioned that, and I was like, whoa, I have never written a while statement like that. It was referred to as dummy scopes. And so, like, you know, he's reading a buffer. He's doing a buffer read in his while statement, but there's no body to the while, so he just puts a semicolon in there. I've never written anything like that.
Starting point is 02:05:31 I've never even stumbled upon somebody else's code that was written like that. If I did, I would strongly slap them. Like, what are you doing? Why would you write that like that? That's horrible. Have you guys ever written a while loop like that no i've infrequently written while loops infrequently written while loops or do wiles haven't done those much either um i mean they have their place, but I just felt like that's...
Starting point is 02:06:06 You're just kind of asking for it. Yeah, you really are. Yeah, really. Even his suggestion of putting the semicolon on the next line and indenting it. So basically, you have the semicolon in his example. His spacing is that the next line would start three characters over so in his example here the semicolon would be below the i in while just hanging out there most people would be like somebody screwed up let me delete that line exactly yeah exactly which goes
Starting point is 02:06:39 back to joe's point about you're asking for it because when that guy deletes something now suddenly that while loop is going to be doing something else. Yep. Yep. Right? Why would you do that? Why would you write a while loop? That's the bigger problem here. This whole dummy scope thing that he's talking about like, oh, hey, just put this your semicolon on the
Starting point is 02:06:57 same line is going to be lost. Let's put it on a new line so that someone else can see it. But it's like, like well the bigger problem is why are you writing while loops like this i've never seen one done that way like an infinite loop could be the least of your problems depending on what the next line is seriously uh so to cap all this off basically he reiterated again follow team's formatting rules don't go vigilante I mean that's kind of how he
Starting point is 02:07:28 ended it and he showed his own formatting stuff at the end of it which I mean it was all pretty and you know we agree on most of it did we? not all of it there's some things that me and Joe were right about were you?
Starting point is 02:07:43 as far as books go though we we're a pretty opinionated bunch, but I think that we can all agree that we agree on 90% of this book. Yeah, which is surprising. As much as we've all programmed, I think that's saying something. Well, okay, here, I've got a better way to phrase that. We can agree that we agree on some percentage. That's the very program we're saying this. We just some percentage that's the very percentage is right i'll take it and we'll have a link to the book in the uh show notes yep and if you happen to win it awesome you can also figure out whether you agree or disagree with
Starting point is 02:08:22 us on some of these things and uh now it's time for the tip of the month this time. Oh, no. Week. Definitely week. All right. Week. All right. Here we go.
Starting point is 02:08:32 What you got? All right. All right. So I found this. This tip was mentioned to me by a peer, and I was like, oh, my God, this is going to change my world. I've never, I never thought to even try this or knew that you could do this. Um, this is a Chrome tip and you know, actually I should have tried this in like a fire bug or edge. And so maybe it exists there. So you know what, maybe it's more than a Chrome tip, but you know, this is going to be specific to Chrome
Starting point is 02:09:04 and you can try it in other browsers and see if it works there as well. But, um, I was trying to debug something and what was happening is I had this, this div and it looked great momentarily. And then as I would step through my JavaScript, suddenly it was getting set to display none. And I'm like, what is happening? Why would anyone display none this beautiful div? That's why I made it, because it looked so amazing. Why would someone else just randomly decide, oh, no, it should be hidden?
Starting point is 02:09:42 And so I was like, where is this coming from? And it took me forever trying to figure this out until a coworker showed me this most beautiful tip in the Chrome DevTools. You can break on an attribute modification. Did you know that? So you choose your element in the console. So you inspect your code, right? You find whatever your element is.
Starting point is 02:10:09 You right-click on it. There's a break on, okay? You can break on subtree modification. You can break on attribute modifications or node removal, right? So what will happen is it's not necessarily like a JavaScript break because you're not putting a break in a particular JavaScript file, right? But as soon as something
Starting point is 02:10:32 happens to that element, the page execution stops and you can see in the JavaScript's call stack, you can see what's happening and what's changing your element. That's awesome. I never knew that and it changed my world when i found out about it i was like that is amazing that just changed mine a
Starting point is 02:10:52 little bit i believe yeah you could have done it like old school you could have created an event with a debugger statement but this just kind of takes away all of that yeah as soon as i found that as soon as he mentioned that to me i, I found out what was display nutting my div in 30 seconds. All I did was a refresh, and boom, there it was. And it was like, oh, yeah, there's the stack trace. I can see exactly what was happening. That's killer. Yeah, it's nice.
Starting point is 02:11:17 So break on attribute modification is exactly, well, break on attribute modification is what I'm going to title today's tip of the week for me but like i said you could do subtree modifications or you could do node removal right in addition to it's awesome that's a biggie i i will be using and and you know what yeah uh because so i'm hoping that a lot of listeners get a lot of love out of that one. A lot of people seem to like the feedback, the tip that I gave. Was it last time? On the actions for Visual Studio.
Starting point is 02:11:57 That one seemed to get a lot of feedback too. A lot of positive feedback. It's those little gems that make your day so much easier, right? I mean, it really does make a huge difference. So this one is kind of apropos for the topic we have here. And Gustav Carlson from Slack had mentioned this eons ago, like he was one of our first slackers, which was awesome. And he had mentioned this particular one, and I had forgotten to bring it up, but it goes perfect with today's discussion. And it's called editorconfig.org.
Starting point is 02:12:29 So we were talking about, you know, the problem with setting up teams with different editors is, you know, they all have like their own defaults. config.org does is it allows you to take an editor config file, set up how you want it to do your format, your curly braces, your line space, and all kinds of things, right? And the beautiful part is this thing works with a ton of different editors without any plugins. So BBEdit, Builder, Cline, GitHub, Goggs, IntelliJ, RubyMine, SourceLayer, TortoiseGet, and WebStorm. Well, it also supports other IDEs as long as you use a plug-in. AppCode, AtomBrackets, Coda, CodeBlocks. Interesting. Eclipse, Emacs, Genie, GEdit, JEdit, Komodo, NetBrains, Notepad++, PHP, Storm, PyCharm, Sublime Text, TextAdept. Vim, Visual Studio, Visual Studio Code, and Xcode.
Starting point is 02:13:34 So basically, there are a slew of editors out there that this particular format works with so that what you were talking about earlier, like with WebStorm, right? You have a config file out there. Everybody that's using WebStorm, they automatically get that same type thing. Well, now you can take it a step further with Editor Config. You can literally set it up for your entire team that you've agreed upon. And then everybody could use this thing across whatever IDE they choose. So pretty awesome stuff.
Starting point is 02:14:01 It allows you to work a little bit smoother without everybody having to worry about how everybody else is coding. Very cool. Yep. Thanks to Gustav on that one. Yeah, that's very nice. So,
Starting point is 02:14:13 uh, my tip of the week is actually a YouTube channel. So we call it, uh, something you can subscribe to called coding math. And what it is is, uh, it's a guy who makes these,
Starting point is 02:14:24 um, kind of mathy programery videos but don't let the mathy scare you um they do really cool things like um he'll kind of program through uh generating a fractal or doing some tree type stuff like you kind of talked about and the link we've got in the show notes alan and other just cool stuff like um easing functions that you can use to kind of make you know like you'll see in browsers when elements kind of slide towards each other and slow down as they get closer. Just all sorts of kind of like little mathy things that you see in programs.
Starting point is 02:14:51 They're just kind of neat. And you can go watch a 15-minute video. He'll demonstrate something in just a, you know, a little simple algorithm that has actual, you know, a visual effect. And you can take the code and play around with it. And especially the fractal stuff is just really cool. And he explain how the algorithm works he'll give you the code and it's you know usually like the one i'm looking at here for drawing a fractal is like i don't know 70 lines so it's not real big it just does some cool stuff so it's neat to get a to kind of play with that stuff and just i mean nothing else just watch the videos and be inspired very cool all right well that will wrap up episode
Starting point is 02:15:30 five zero we didn't even talk about that that this is the 50th episode like that's a i feel like that's a milestone that went on undiscussed it's pretty pretty crazy, right? Yeah. It's like 10 years is the rate we release episodes, right? No. Seriously. This is like three years. Yeah. We're almost right at our three-year anniversary, and we're 50 episodes in. That's pretty awesome.
Starting point is 02:15:58 Yeah. So not quite like 17 episodes a year. Yeah. Yeah. Yeah. We've gotten a little bit better this year about it. I think we've tried to step it up a little bit. Maybe sometimes we've gotten better about it this year.
Starting point is 02:16:11 Yep. But, yeah, that's awesome. Thanks, everybody, for hanging out with us the entire time. I mean, like, we get awesome feedback all the time, and it really is amazing. Our listeners are amazing. Yeah. And it makes it to where it's fun for us. And we keep wanting to do it.
Starting point is 02:16:26 Right. So, you know, keep the comments coming. Keep slacking. And it really does make it so it's fun for everyone. So we hope you've enjoyed another episode of Clean Code as we talked about Chapter 5 formatting and why the newspaper metaphor sucks. Be sure to leave a comment at www.codingblocks.net slash episode 50 for your chance to win a copy of the book.
Starting point is 02:16:58 Subscribe to us on iTunes, Stitcher, and more using your favorite podcast app. And be sure to leave us a review by visiting www.codingblocks.net slash review. And you can find all the show notes, examples, discussions, and more there as well. And you can send your feedback, questions, or rants to our Slack channel, codingblocks.slack.com. And follow us on Twitter at Coding Blolocks or on Facebook or pretty much anywhere else. You can join the mailing list and enter into contest contests because we give away really awesome stuff pretty often. We really do.
Starting point is 02:17:33 How come we never get any of that stuff? I know. Yeah, but we're getting the short end of the stick on this deal. Always the giver. Oh, happy Thanksgiving, everybody. That's coming up. We'll all be eating too much. But Thanksgiving
Starting point is 02:17:52 isn't a thing outside of America. It's also the worst holiday. No presents. No candy. We've got Black Friday. Yeah. True. Cyber Monday Black Friday. Yeah. True.
Starting point is 02:18:06 Cyber Monday. We have Cyber Monday. Yeah. It's coming. All right. Whatever. All right. Enjoy your shopping weekend coming up.
Starting point is 02:18:13 There you go. Now there's something we can get excited about. Yeah. We picked a side in the world. All your future sales on Newegg and Amazon. Yeah. All right. That's a wrap.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.