WEBVTT

0:00:00.000 --> 0:00:08.680
<v A>Hosting provided by HostTornado. They offer website hosting packages, dedicated servers, and VPS solutions. HostT.net.

0:00:15.380 --> 0:00:21.180
<v A>Programming Throwdown, Episode 41: Node.js. Take it away, Patrick.

0:00:22.240 --> 0:00:42.758
<v B>So recently, the FCC came out with their long-awaited net neutrality ruling, and they've tried several times to effectively get net neutrality to be able to be enforced and gotten. I think this is such a complicated topic. I feel like you need to be a lawyer to really understand it.

0:00:43.020 --> 0:00:46.260
<v A>Or maybe just someone who knows more lawyer-ese than me.

0:00:47.300 --> 0:01:55.219
<v B>So the way I understand it is they tried several times to be able to basically enforce net neutrality and got told by the courts they couldn't do it that way. And so their most recent attempt was to do it by saying that broadband is essentially a utility, and that, therefore, the FCC has the right to be able to regulate it. But, of course, this is interesting because some people are opposing the fact that the FCC is even getting involved at all. So people in the tech industry generally support the idea that net neutrality is a good thing, but that it may be bad to have the government somehow having to defend the rights of the Internet in that way may just be asking for trouble, that they'll start putting their hands into other things on the Internet. And, of course, other people are complaining because of what they had to do by saying that broadband was a utility. Some people are complaining that's not... Well, I guess that becomes a political right-wing versus left-wing complaint about that—that's anti-company or... Yeah, some such

0:01:55.219 --> 0:03:52.240
<v A>Problem. I'm going to try to explain net neutrality and then you can correct me. So I think... So net neutrality means... So a neutral Internet is one where... So, okay, just step back. So the way the Internet works, right? You say, 'I want to go to Yahoo.com.' And what happens is your machine... So there's a bunch of machines that resolve Yahoo.com to an IP address. So those are called Domain Name Service machines. So you contact one of these Domain Name Service machines. There's typically one for your ISP. And you say, 'Okay, what is the address for Yahoo.com?' And they give you a number. And then you start sending packets to that number. And each machine along the way kind of knows where that packet needs to go and also knows what machines it's connected to and tries to get the packet a little bit closer to its destination. And so there's all of these hops where you're bouncing from one machine to the other until finally you reach Yahoo.com, one of their front-end machines. And then they, you know, fill that packet. They create their own packet which has the Yahoo.com site on it, like a bunch of packets which have that site on it. And then they send those packets back to you. But along the way, it bounces through all these machines. And a neutral Internet is one where all those machines along the way, including your ISP, just forward the packets without any discrimination. So if we didn't have net neutrality, then what they could do is they could say, 'Oh, you know, here's a packet containing Netflix movie,' like a piece of a Netflix movie.

0:03:52.600 --> 0:04:06.140
<v A>So I'm going to charge Patrick, you know, a fraction of a cent for this packet. But then if the packet doesn't have a Netflix movie, if it has something else, maybe it's free. Did I, does that kind of explain it or?

0:04:06.140 --> 0:04:34.680
<v B>Yeah, I mean, this is where it begins that I, the mishmash of not understanding the politics of it. And then the, you know, the peering arrangements is another thing that comes into play here. That certain websites, certain computers send a lot of traffic and others receive it or, you know, source it or sync it, I guess is the equivalent. Like Google doesn't generate a lot of traffic, but it receives a lot of traffic.

0:04:34.680 --> 0:04:38.600
<v A>Wait, really? Wait, isn't it the other way around?

0:04:39.920 --> 0:05:01.000
<v B>Well, if you, so the, like who's requesting it? Like Google.com doesn't ask for a lot of traffic. Like it doesn't cause traffic to be generated. It's sending lots of packets in reply. Like you go to YouTube, right? So if I go to YouTube, I send a small amount of packets, but I'm the one that is initiating. YouTube isn't sending me stuff without me asking.

0:05:01.452 --> 0:05:02.363
<v A>Oh, I said

0:05:02.363 --> 0:05:03.865
<v B>YouTube stuff without it asking. Gotcha.

0:05:04.900 --> 0:05:09.670
<v A>I see. So you ask YouTube for information, and then they just like fill you full of information. So,

0:05:09.670 --> 0:05:18.760
<v B>Yeah, I send a small amount of data, and they send a large amount of data back, but it matters because the, you know, who like essentially they're acting in response to a request from me.

0:05:19.020 --> 0:05:19.960
<v A>Got it. Got it.

0:05:19.960 --> 0:05:29.700
<v B>So there's something there too. And like, so my ISP has to, you know, bring in a lot of data and doesn't send out much data.

0:05:30.659 --> 0:05:31.607
<v A>Right. But the

0:05:31.607 --> 0:05:34.611
<v B>data it does send out is the cause for all the data that's coming back.

0:05:35.840 --> 0:05:57.747
<v A>Right. That makes sense. Yeah. So, I mean, you have to do a search to get a result, or you have to, you know, click play on a video to start getting the video. So it's always your—the causal nature is always you, but then the effect is that Google or YouTube or whoever just dumps a bunch of data on you. Yeah. So

0:05:57.747 --> 0:06:24.340
<v B>Then the belief is that, you know, Google/YouTube or Facebook or insert any large website should pay because they don't, you know, it's their traffic isn't symmetrical, right? Like it because of this asymmetry that there's some—there's something there and they're not sharing their fair burden or something versus an ISP probably also has people who host servers there. And so they actually are sending out traffic as like, they are doing both ways.

0:06:25.000 --> 0:06:25.793
<v A>Yeah. So

0:06:25.793 --> 0:06:27.220
<v B>their traffic is more balanced.

0:06:28.140 --> 0:07:37.748
<v A>Yeah. I mean, part of it is, you know, to argue, to play Devil's advocate. I mean, people who argue against Net Neutrality, they say that basically, you know, there's some people who consume, you know, I think Netflix consumes like a third of the internet or something like that during peak hours. And so they have no—Netflix has no incentive to, you know, be judicious and responsible with their bandwidth because it's, excuse me, because it's basically free. I mean, they pay, you know, they might pay their ISP to, you know, push out all of that traffic and have the infrastructure, but then all of those hops in between, they're just kind of freeloading in a sense. And so there's this idea that kind of the people who are using all of this traffic and requiring all of this infrastructure should also be financially responsible for it. And that was kind of the—that's the anti-Net Neutrality argument. The Net Neutrality argument is like, this is very complicated and difficult to enforce. And I mean, if there's a

0:07:37.748 --> 0:07:51.840
<v B>lot of Net Neutrality is slightly more subtle is that not that Netflix should be more or less responsible, but that it doesn't matter if you're a Netflix, a Facebook, or a small startup—that they should all pay the same rates.

0:07:52.700 --> 0:07:54.500
<v A>Right. That's right. Yeah. Right.

0:07:54.719 --> 0:08:03.719
<v B>So, you may pay more. Netflix will pay a lot more than a tiny startup, but the amount they pay divided by the amount of traffic is the same.

0:08:04.400 --> 0:08:05.719
<v A>Yeah. Yeah. You're right. You're right.

0:08:05.960 --> 0:08:08.059
<v B>Sorry. Sorry. It's like a subtle nuance, but it matters.

0:08:08.500 --> 0:08:22.960
<v A>Yeah. That makes sense. You're right. Because yeah, you're right. If it's like a toll road, right? Like if you have more vehicles in your fleet going on that toll road, you're naturally going to pay more. But everyone gets charged. But you can't say,

0:08:23.080 --> 0:08:33.820
<v B>Oh, your truck is a Walmart truck, and I don't like Walmart, or Walmart, you know, trucks are worse for my business in some other way. And so I want to discriminate against Walmart trucks and make them pay twice as much.

0:08:34.039 --> 0:08:35.480
<v A>Yeah, exactly. Yeah.

0:08:37.039 --> 0:08:50.310
<v A>So yeah, we both kind of—I don't know about you, but I'm kind of foreign at neutrality. I never really understood the idea of charging different people different amounts, but I also haven't been keeping too up to date with it. So

0:08:50.462 --> 0:09:01.180
<v B>Yeah, my opinion is hard because it's—yes, the idea is good. I want the internet to be neutral, but like, how do you enforce it? Who enforces it? Yeah. Right. This becomes where the problem, where it gets sticky.

0:09:01.900 --> 0:09:04.420
<v A>Yeah. That makes sense. So,

0:09:04.420 --> 0:09:14.140
<v B>We have a correction from last episode, Episode 40. And this is by Andy. Andy wrote into us to say that we've made a mistake.

0:09:14.140 --> 0:09:17.024
<v A>No, I was giving

0:09:17.024 --> 0:09:18.711
<v B>You time to recover from passing out. First.

0:09:18.711 --> 0:09:19.699
<v A>Time ever.

0:09:20.900 --> 0:10:18.219
<v B>I'm okay. Yes. First time ever. So we were ranting about pre versus post increment and we weren't being very careful or I wasn't at least being very careful and how I was stating it and saying that it kind of doesn't make a difference and how I prefer doing post increment, for instance, cause that's the way I was taught. And it does actually matter a lot. And especially in the case where you have like classes in C++, not basic native data types because doing the post increment requires a copy operator because it needs to invoke it, use the before value and the after value. So it needs two copies of the object, which does add overhead. And so you have to be careful when you're using post increment that you really need it and that there is could potentially be a non-trivial cost to it.

0:10:18.300 --> 0:10:26.802
<v A>Yeah. Especially with iterators. Yeah. I mean, if you're using it with an end to the compiler, we'll probably just optimize it for you. But yeah, that

0:10:26.835 --> 0:10:43.500
<v B>was my integral type. There we go. That was the word I was. Yeah. A primitive type or into a primitive integral type, right? Something that is kind of native. Like I don't, I don't know that it makes a big difference, but to be fair, it's better to adopt a habit. That's good for everything. Then try to remember the nuances.

0:10:43.980 --> 0:10:45.980
<v A>Yeah, that makes sense. Makes sense.

0:10:46.080 --> 0:10:49.720
<v B>So I stand corrected. All right. Should have been more specific.

0:10:49.920 --> 0:10:52.000
<v A>First time ever. We can make a mistake once.

0:10:53.740 --> 0:12:53.660
<v A>News. So this is a total cop-out news, but I'm really proud of this excited about it, but I made a wiki, a wiki engine. So basically, you know, there's Wikipedia. I'm sorry, they're on Wikipedia. There's MediaWiki, which Wikipedia is based on. There's Twiki. And there's a couple others that kind of dominate the wiki engine market or space, mind share, if you will. And these are good, especially for like public environments. But they don't really, they never really worked well for corporate environments. You'd always see people like try to have a meeting on Wikipedia, like try not Wikipedia, but try to have like meeting notes and a wiki. And then, you know, two people can't edit it at the same time. Most of them don't allow that like collaborative editing. Also it's too hard. Like if you see a typo in a wiki, like your internal wiki, it's such a huge pain in the butt. You have to like click edit. You have to go find the typo in the markup language, correct it, then click save. And then each time it's like a page load. So it's maybe like five seconds. So it takes probably 30 seconds to fix a typo in a normal wiki. And so what ends up happening is like, as code is evolving and processes are changing quickly, people are just not keeping the wiki up to date. So I created a wiki where it's very simple. It's very simple to update and it's collaborative. So, it's a Node.js and JavaScript on the browser. I'm talking about this. I know spoiler and MongoDB for the database. So if you can get MongoDB and Node.js running, you're good to go. And everyone on Twitch saw that Angry YOLO is following me on Twitch. Thank you, Angry YOLO for the follow.

0:12:53.660 --> 0:13:35.319
<v A>So anyway, if you have all of that, not too bad. You can get it set up on Heroku or something pretty easily. And you can get this wiki up and running. It's pretty cool. When you go into edit mode, it turns into like this Google Doc thing where like several people can edit at the same time. So if you have like a meeting, one person can project the wiki and everyone else could be editing the wiki and kind of filling things in or making corrections. And it just kind of naturally works. Then it's also permanent, has a full text search and things like that. So, I think it's pretty cool to give it a shot. Let me know what you think. If you if you hate your wiki at your company or you haven't started one yet, try this one. And yeah, let me know how it goes.

0:13:35.320 --> 0:13:42.164
<v B>Very nice. I really want to run this and try this, but

0:13:43.699 --> 0:13:51.614
<v B>Yeah, we have other things we use. And so I'm not sure it'll go over that well at my company. So I'll say I'll do it in my spare time. Yeah.

0:13:51.681 --> 0:13:57.807
<v A>Could always ping somebody and say, you can run the demo. I'll actually change the link. This

0:13:57.807 --> 0:14:01.900
<v B>We need to talk about Software as a Service. You need to offer this as a service.

0:14:02.620 --> 0:14:08.880
<v A>I could totally do that, but I don't know. The thing is, most companies are kind of private about their data.

0:14:09.180 --> 0:14:09.579
<v B>Yeah.

0:14:09.800 --> 0:14:16.622
<v A>So, but yeah, check this out. It's a little demo, and you can go and edit it and, you know, and

0:14:16.622 --> 0:14:19.880
<v B>I have no friends, so I wouldn't ever be able to see anyone editing it with me.

0:14:23.360 --> 0:15:07.100
<v B>All right. I'm just being sad. Okay. My link of the week or link of the week. Oh man. My link to talk about is the eight CC small compile C compiler. So I ran across this the other day in a news story, and I thought it was interesting because I'm constantly wanting to learn more about kind of compilers and compiler theory. It's one of the things I think everyone—I don't know, maybe not everyone—but I feel like many people in computer science or doing software engineering get interested in compilers at some level, but everyone kind of just has this belief: and to be honest, I've never looked at the GCC code, so I have no idea how complex it is, but I've heard it's really complex. And I just assume it must be really complex. Yeah. Same here. So, but I've never, to be fair, I've never looked at it. So I don't know. That's a bad assumption.

0:15:07.480 --> 0:15:09.340
<v A>It's gotta be just total nightmare. I've

0:15:09.981 --> 0:15:54.818
<v B>heard that. I heard that, but I, you know, I've never looked, so I can't say. And then there's things like Clang LLVM, which are, you know, part of—their goal is to kind of clean that up. Right? Anyway, leave all that aside. HCC is just a compiler for the C language, trying to support all the modern C11 language features. But it also has a goal to be very readable and simple and small. So I don't think they're trying to be the most optimal one, but they are trying to be complete, like not implement a C subset, but actually implement all of the C language. And so I was reading through little bits of the code just to check out. And I have it on my, you know, infinite to-do list to like go through this and kind of really read through a lot of it. But the parts I read through were like, 'Oh, I know what this is doing.' I

0:15:54.818 --> 0:15:55.544
<v A>need to kind

0:15:55.544 --> 0:16:16.400
<v B>get more into understanding how it's hooked up and you know how it flows. And, you know, so here's something parsing an Abstract Syntax Tree node. Okay. I can follow what it's doing, but how is the tree built? Where does it go to? You know, those kinds of stuff that I didn't get into, but if you're interested, I would check it out. And they have some links to other projects that are similar that may be of use as well.

0:16:17.040 --> 0:16:20.220
<v A>Yeah, this would be totally awesome. I've always wanted to

0:16:21.800 --> 0:16:46.780
<v A>Things like, I had this one crazy idea. Oh yeah. Like if you could turn C code—there was this project, GCC XML that turned C into XML so that you could do crazy things like, kind of automatically delete all the comments and things like that. Oh, and, yeah, this would be good to read just to see if you could do like kind of these front-end things.

0:16:46.780 --> 0:16:52.260
<v B>Or like you want to add that one feature to see that no one will let you do. No one ever seems to want to support.

0:16:52.960 --> 0:18:01.280
<v A>Yeah. Yeah. Cool, man. It's awesome. All right. My news is, our link, I guess is total 50 totally free lessons in graphic design theory. Is this BuzzFeed? No, no, so I'm totally interested in graphic design. I've been doing a lot of drawing in my spare time. And I've been really interested in sort of like this psychology behind it. Like there are all these rules, you know, like the don't put something in the middle of the page—you know, the golden rule. It's like the two-thirds rule, all these things. But, you know, I wanted to see something like a little bit more formal that tries to codify them or at least explain like the intuitions behind them and things like that. And so, yeah, I've been going through a bunch of these and some other resources and trying to do a lot of drawing and things like that. And this—this was one of the ones I found particularly useful. So, if you're interested in that kind of stuff, if you're building a website, drawing a picture, any of that kind of stuff, this will help. It's very broad kind of topic in graphic design. So check it out.

0:18:01.860 --> 0:18:04.220
<v B>I have comments about this, but I'm going to save them for later.

0:18:04.820 --> 0:18:05.220
<v A>Okay.

0:18:06.340 --> 0:18:08.820
<v B>Cause I think we'll talk more about this topic soon.

0:18:09.020 --> 0:18:09.860
<v A>Really? Okay.

0:18:11.159 --> 0:18:12.349
<v B>Okay. Never mind. All

0:18:12.349 --> 0:18:14.040
<v A>right. Yeah.

0:18:14.480 --> 0:18:24.989
<v B>We'll just have to wait and see. My next link is OpenGL from zero to hero. Sounds like something I need to read. And this

0:18:24.989 --> 0:18:32.280
<v A>Is you doing OpenGL? Like is that a thing of yours now? No. Oh, okay. You just want to read it because it's cool.

0:18:32.720 --> 0:18:39.957
<v B>Yeah. I don't know. It's game graphics. I don't know. It always seems interesting to me. I do do graphics stuff sometimes. I wonder.

0:18:39.957 --> 0:18:44.240
<v A>How many people got into computer science to make video games?

0:18:44.564 --> 0:19:01.260
<v B>I bet it's probably 50%. I have very low desire to make a full-fledged video game, but I have more like demo scene inclinations. Yeah. I want to like make like demo of some cool thing and just like, you know, just play around like toy programs, but with graphics.

0:19:01.460 --> 0:19:10.500
<v A>Yeah. That's the thing. I don't want to make the content, but I just want, same as you, I just want to make something that's kind of cool, but yeah, I don't want to spend the time like writing the story and all that stuff.

0:19:10.960 --> 0:20:00.320
<v B>Yeah. That's for people who have more time than I have, or it's their job. But this is a series of tutorials—it looks like there's going to be more—but even the parts they have now take you from the parts I always find really difficult, like getting OpenGL set up or even installed in this case in Visual Studio, even which can sometimes be a harrowing experience, to how do you draw a triangle, you know, shading the triangle. And then it goes into basic parts of a game engine and like, you know, shaders and scene managing, and all these things and how they fit in. And I didn't go through the whole tutorial, but the parts I clicked through seemed really interesting and on point. And so if you're interested in it, check it out. And like I said, for most people, 'cause I think a lot of people have this thing in the back of their head that one day they're going to make some awesome video game or OpenGL 3D thing.

0:20:01.680 --> 0:20:37.660
<v A>Cool, man. Yeah, that's awesome. Yeah. Now there's like a ton of these. Well, we talked about Unity actually. That's right. Yeah, we did. But still, you know, a lot of the if you want to do something kind of really out there and like the coolest, you know, one-man video games or like, you know, indie video games are the ones that have some crazy kind of mechanic. It's just very hard to get right with one of these high-level things like Minecraft. For example, you can't write Minecraft in Unity. You have to do something kind of low level, right? And so it's really important to know OpenGL and the fundamentals.

0:20:38.560 --> 0:20:58.264
<v B>Yeah. For me, it's more like two, and it sounds I guess it's kind of weird. Maybe it's, I don't know how you phrase that, but the fact that okay, you go to some tutorial, like how to make an Android app, but then they actually don't do any of the interesting parts. It's just like you take some framework and then you like edit some XML and then like, okay, you have an Android app with a button. Okay.

0:20:58.360 --> 0:21:02.520
<v A>But like, that's not what I wanted to learn. Like I wanted to do something, you know,

0:21:02.520 --> 0:21:23.000
<v B>like I want a framework to get me almost there, but then I can do the interesting parts. So for me, you know, getting something like Unity, if you're going to actually try to make a game is really good. But if you're just trying to play around, sometimes it hides what may be the parts that are interesting to you. And in my case that, you know, that would be kind of the lower-level stuff of, you know, actually rendering the graphics.

0:21:23.560 --> 0:21:24.720
<v A>Yeah. Yeah. That makes sense.

0:21:25.540 --> 0:21:27.711
<v B>But maybe I'm a strange kind of weird person. So

0:21:27.964 --> 0:21:32.680
<v A>Yeah. Well, yeah, that's a given, but given all of that, the other stuff you said makes sense.

0:21:32.920 --> 0:21:35.963
<v B>Yes. Time for book of the show. Boo.

0:21:36.180 --> 0:22:12.008
<v A>Book of the Show. My Book of the Show is You Can Draw in 30 Days: The Fun, Easy Way to Learn to Draw in One Month or Less. So I have to confess I haven't read this yet, but I have ordered it. I love drawing, but I'm not great at it. I'm good at doing like, I'm good at being kind of a perfectionist in a sense of like making sure, you know, spending a lot of time on it until it kind of looks good. But then I feel like the people who are really good at drawing are the ones who can like,

0:22:13.580 --> 0:23:14.300
<v A>They have a certain tolerance for quality. And then within that tolerance, they can just generate a lot. Like for example, it's the same as writing code, right? Like the code that I write on day-to-day basis might not be the cleanest code ever. I mean, I'm sure if I spend more time, I could write better, like cleaner code, but I can write a lot of it in a day. Like I have sort of a well-oiled machine where I just can kind of turn out a bunch of code. And so that's what a good artist can do. A good artist, you know, might not be as perfect as he wants, or is that he can be, but he can get 90% of the way there in one tenth of the time that it takes me to get there, right? To get done. So yeah, so I'm trying to read through these books, especially the ones I'm kind of doing things quickly. And yeah, I'll let you guys know how this goes, but yeah, I'm looking forward to getting in, taking a look through.

0:23:14.440 --> 0:23:18.394
<v B>So I'm a little up on you. I'm like seven days into this book. Really?

0:23:18.560 --> 0:23:19.640
<v A>You actually have this book?

0:23:19.780 --> 0:23:26.444
<v B>Yes. This was saying, I was going to talk about this later and you just had this like blank sound. And I

0:23:26.444 --> 0:23:29.820
<v A>was like, okay, what are the odds that we both have the same book?

0:23:30.620 --> 0:24:11.440
<v B>So everything you're describing except for the fact that I can't draw, even if I take a long time. So I'm just terrible at it. So I learned, I got the roundabout story is there's this thing called urban sketching. I don't know if you ever checked this out. There's a website, Urban Sketchers, if you search it and they have like a very particular art style, which is exactly describing is exactly described by the words you were using, where the idea of urban sketching is you're out in the world. Like you're sitting on a bench, you're in a Starbucks and you're drawing fast. You're drawing just something that you're seeing, and you can't take forever. You can't be a perfectionist. You're not making a gallery piece. You're making something very loose.

0:24:11.880 --> 0:24:12.700
<v A>but I'm just something.

0:24:12.880 --> 0:24:35.100
<v B>So the style I've learned is kind of called like the ink and wash style. So you kind of draw with a pen and then they'd use some splattering of color from watercolor. And this is kind of like a very specific style that they tend to be very similar. A lot of them. And cool. That this is like, got me into, I wanted to do this. I didn't know why, but that style just stuck with me and this quick loose drawing.

0:24:35.320 --> 0:24:36.000
<v A>Yeah. It's great.

0:24:36.480 --> 0:25:16.435
<v B>And so I got in a series of weird tangents. So I now actually, I kind of gave up the drawing a little, except then I came back to it because actually got into watercolor painting. And so now I've been doing watercolor painting for about two or three weeks now. And it's been really interesting. And so I learned to need to draw again because you need to draw to be able to paint. So blah, blah, blah. So I'm back and working on drawing again. And I hadn't painted since like elementary school. So I don't know how many years that is, many years. And so I got stuff like just doing it and it was actually like, wow, this is really relaxing. I don't know what about so different than coding it is, but I was really enjoying it. So,

0:25:16.688 --> 0:25:28.340
<v A>like, I never really thought to do watercolor. Like I have pencil crayons and then I have, you know, like drafting pencils, but what made you think to do watercolor?

0:25:28.860 --> 0:25:30.659
<v B>Specifically the urban sketching stuff.

0:25:30.719 --> 0:25:32.415
<v A>Oh, so these are all watercolor? So

0:25:32.415 --> 0:25:35.120
<v B>The color you see there is almost universally watercolor. Yeah.

0:25:35.280 --> 0:25:38.219
<v A>Oh, and then they add the, they do pencil drawing on top of it.

0:25:38.320 --> 0:25:53.460
<v B>No, no. Well, so there's two ways. One is like you spill some color across the page and then you just draw something on top of it for like effect. But then others are where you draw a sketch in pencil or pen, and then you kind of just loosely color parts of it with water.

0:25:53.680 --> 0:25:54.707
<v A>Oh, I see. Got

0:25:54.707 --> 0:26:07.701
<v B>It. And the reason watercolor is because it dries much faster than like all the, a lot of the other kinds of paints. And it's much more portable because you can have the dried pucks and a little, you know, cup of water, and you can be able to paint. Yeah. Yeah. Oh,

0:26:07.940 --> 0:26:09.321
<v A>That's awesome. Yeah.

0:26:09.660 --> 0:26:17.580
<v B>So now I've been doing like a little bit of watercolor stuff. I won't say I'm great, but I'm doing better than I thought I would be able to; I can paint things that you can recognize.

0:26:18.160 --> 0:26:19.140
<v A>Wow. That's awesome.

0:26:19.500 --> 0:26:24.036
<v B>And so that's made me happy. So, and there's tons out there—tons and tons of videos on YouTube about how

0:26:24.036 --> 0:26:27.120
<v A>to do like any of this kind of stuff. So,

0:26:27.512 --> 0:26:42.880
<v B>And I find it easier than drawing with a pencil because I feel like by nature, painting and specifically watercolor is very loose in nature. So you can paint precisely, but it wants to kind of run all over the page. And so it forces you to be more interpretive, which is something that I don't do by nature.

0:26:43.980 --> 0:27:25.959
<v A>Oh, I see. Yeah. That's my flaw too. It's like if something doesn't look realistic, like if it doesn't match and I have to fix it. And so certain things, there are certain things that are just always kind of drawn comically. Like for example, the fur of a tiger, like the outside, like the border between a tiger and whatever's behind the tiger, like to actually draw that correctly is just insanely hard. But you know, so to draw it the way that you would see it, like the iconic drawing of a tiger, is kind of more abstract. And I think that's where I have the most trouble.

0:27:27.100 --> 0:27:57.743
<v B>Yeah, to your point earlier, I don't know if you guys check out anyone, guys or gals listening, check out like this urban sketching. To me, what you were saying earlier about kind of psychological, almost how that you can recognize something to be a person when it's almost just like a couple loop squiggles and little hashie lines and a little bit of paint. And you'll be like, Oh, right. Like here, there's a picture I'm looking at right now, like a picture of a marching band. And it's like, I can tell this is a marching band, but there's so little detail here. It's kind of crazy that I'm able to tell that that's what this is.

0:27:58.300 --> 0:27:59.667
<v A>And then I can actually tell this is

0:27:59.667 --> 0:28:03.939
<v B>almost looks like a St. Patrick's Day, whatever. Like, but I don't know why I'm able to tell that. Like,

0:28:04.740 --> 0:28:06.060
<v A>Yeah, it's just mind-boggling.

0:28:06.800 --> 0:28:30.447
<v B>So, yeah. Learn to draw. But I did enjoy the book. I kind of put it back down because I started doing the watercoloring stuff, but yeah, I was enjoying it so far. So I'll recommend it. Cool. But you have to stick with it. It's practice. People just think like I'm going to sit down and just draw, but that doesn't happen. Like it's just very hard for your, even if you know in your head what you want to draw, your hand won't be able to do it initially. Yeah.

0:28:31.700 --> 0:28:33.670
<v A>Seriously. So

0:28:33.839 --> 0:28:39.760
<v B>It takes more practice than I, everybody just chalks it up to talent. I did too. And so,

0:28:40.020 --> 0:28:40.240
<v A>Yeah.

0:28:40.920 --> 0:28:47.642
<v B>My book is completely unrelated as a science fiction. Go surprise. Patrick's recommending a science fiction book. Wow.

0:28:47.879 --> 0:28:49.160
<v A>I didn't know you read science fiction.

0:28:49.680 --> 0:29:49.000
<v B>I only talk about science fiction books or fantasy. Every single episode. This one is a book that was released last fall: Abyss Beyond Dreams. This is Peter F. Hamilton's newest entry in the Commonwealth saga, of which I believe there are five or six books now. Okay. And I guess this would be like the seventh. And I really enjoy his style. I was really hoping this book was going to have—so he writes about kind of crazy future science. And it's, I guess, considered hard sci-fi and a lot about how humans modify themselves in the future. And there is a good amount of it in here, but not as much as I was hoping, but it's still a really good story. I really enjoyed it, so I would recommend that: Abyss Beyond Dreams, or any of Peter F. Hamilton's Commonwealth saga books. I don't know that you really—there's two books and then a trilogy. And now this one, which is set in between the previous. So I wouldn't read any in the sets out of order, but I think you can read any of the sets in either, in any order.

0:29:50.603 --> 0:29:53.067
<v B>Cool, man. Did that make sense? That was confusing. Anyways, check it out.

0:29:53.067 --> 0:29:56.040
<v A>Totally made sense. So on a—oh, go ahead.

0:29:56.280 --> 0:29:57.269
<v B>Oh, no. I

0:29:57.269 --> 0:30:03.580
<v A>Was going to say, on a related note of books, Terry Pratchett just passed away like a week ago.

0:30:05.300 --> 0:30:18.460
<v A>Yeah. And so he had Alzheimer's. And for a while. And so he was kind of fading, but yeah, he passed away about a week ago, and yeah, the world will miss Terry Pratchett.

0:30:18.919 --> 0:30:28.437
<v B>Discworld series. We've had at least one, I know, or maybe two books as books of the show. It was—yeah, he wrote that one.

0:30:28.437 --> 0:30:37.870
<v A>Other stuff. There was this pretty epic image of that someone hand-drew of him shaking hands with Death. I can't seem to find it though. Yes.

0:30:38.040 --> 0:30:40.320
<v B>Which is one of the characters in his Discworld series.

0:30:40.419 --> 0:30:46.360
<v A>Oh yeah, that's right. Yes. He's shaking hands with—yeah, one of his most famous characters. Let me see if I can pull it up.

0:30:46.439 --> 0:30:54.199
<v B>I think also his—I believe it's his—I want to say his daughter, when she tweeted that he died, also made a reference to his Death character.

0:30:54.200 --> 0:30:58.740
<v A>Oh really? Nice. So, anyways,

0:30:59.040 --> 0:32:02.970
<v B>I was going to say the secret to me being able to listen to this, Bist Beyond Dreams is another quite long science fiction book, as many of mine are, because I have a quite a long commute. And the way I'm able to do that is by listening to audiobooks. And this week we have an announcement that we now have Audible as one of our sponsors of the show. So, you can go to audibletrial.com/programmingthrowdown. And they have an offer where you can get a free month, which is Audible credits. You can either just buy the audiobooks, kind of like for a flat fee, or you can pay a subscription per month. I believe it's $15. And then you're able to download one book a month, essentially. And they have plans that have more books a month, and then you can keep them even if you cancel your subscription. So what I do is I have a subscription for a little while, you know, get a couple of books built up, and then I cancel my subscription. And then when I make it through those books, I get it again because the subscription works out to be cheaper than just buying them directly off of their thing. And they

0:32:02.970 --> 0:32:10.880
<v A>also run great sales. So while you're, as long as you're disciplined to get a book every month, then you can just continue to build up a queue of books. Yeah.

0:32:10.980 --> 0:32:19.140
<v B>Oh, and your credit, you get a credit, and a credit is good for a book, and the credits don't expire until you cancel. So you can let them build up and then like use them all at once and then cancel.

0:32:19.640 --> 0:32:20.940
<v A>Oh, cool, cool, cool.

0:32:21.000 --> 0:32:54.800
<v B>Yeah. Yeah. So they're pretty good about that. I've actually been pleased. And then I am able to listen to it for however long, you know, after I've canceled. And while you have the subscription, they also run sales, which are even cheaper. Or they also run deals where if you buy the Kindle version of the book and the Audible version of the book, sometimes it's cheaper than just buying the Audible version of the book. And so I do that sometimes. So you can get a lot of good listening material/reading material for a pretty decent price. I feel like it's a good deal. And so I'm glad that we can now have them on our show.

0:32:55.560 --> 0:33:04.500
<v A>Yeah, definitely. So yeah, if you use the link that we'll provide in the blog, then that helps us out. So we appreciate it.

0:33:04.500 --> 0:33:15.680
<v B>Hope out the show and check it out. And if you're always saying, man, I really wish I had more time to read, and you're in your car or in a long commute, you first, you can listen to this podcast and then you can listen.

0:33:16.100 --> 0:33:20.520
<v A>That's right. Oh man. Are we encouraging our competition?

0:33:21.740 --> 0:33:25.574
<v B>So I listened to both podcasts and a science fiction book. So

0:33:26.181 --> 0:33:34.440
<v A>Yeah, yeah. There's definitely enough time for that. I do the same thing. I listened to, well, I listened to just podcasts, but I have like a ton of podcast, like five different podcasts.

0:33:34.956 --> 0:33:39.040
<v B>Only five of my commute is much, much longer than yours.

0:33:39.220 --> 0:34:32.420
<v A>Okay. Fair enough. Cool. So to do the tools of the show, my tool of the show is JaCoCo, which is a Java code coverage library. So what this means you integrate it into your test environment. Well, specifically integrate into your build system. So if you're using, you know, Maven or Ant or Gradle or any of these things, you integrate JaCoCo into one of those. And then whenever you run your tests, this will actually tell you what lines of code are covered in your unit tests and which ones aren't. And so, it's pretty cool. Like it'll give you a high-level overview, like, you know, 6% or 70% of your project is unit tested. Only 70% lines.

0:34:32.420 --> 0:34:33.400
<v B>Yeah.

0:34:35.159 --> 0:35:12.440
<v A>But you know, you can drill in and say, Oh, I totally missed this class. You can exclude some classes. Like if it's just like a main loop or something like void Main or whatever, just in its own class, you don't want to unit test it. So it has a bunch of options like that. It's pretty slick. I've been using it for not too long, just a week or so, but it's pretty cool. And it really kind of helps you to reduce the entropy. Like if there's some code that's not unit tested, maybe it doesn't need to be there. Right? And so, it kind of can really help improve the code quality.

0:35:12.440 --> 0:35:17.040
<v B>What do you have as your code coverage target?

0:35:19.120 --> 0:36:19.977
<v A>I don't know yet. So I ran this. Basically what happened is we had this kind of—I don't want to use the word sprint because that reminds me of Agile and all that, those things that I kind of hate. But we had just sort of a rush where we had a deadline that we were rushing to meet, and we were able to meet the deadline, but I mean, we were here at the eleventh hour, just banging out a ton of code. And so, the code coverage is really bad. Really, really bad. In fact, we hadn't even started writing unit tests until this week. So the code coverage was zero. So I have to—I don't really have a set target, like a certain percent. It's more just like I want us to write unit tests until things look good. You know, until like we're happy with it. And then I'll try to figure out, it's hard for me to have a target when I've never really done this before. No.

0:36:20.319 --> 0:36:29.439
<v B>That's fine. Some teams have like a, you know, like 90% is the desired goal or a hundred percent, which can be very difficult.

0:36:30.080 --> 0:36:41.120
<v A>Yeah. I mean, I'm assuming if your goal is a hundred percent, then you're excluding like void Main or whatever. I mean, you could test it, but at that point you're just kind of wasting time. Right?

0:36:41.720 --> 0:36:46.340
<v B>Yeah. I mean, but you could get to essentially 99.99, nine, nine, nine, nine, nine percent.

0:36:46.840 --> 0:36:47.905
<v A>Yeah. Right.

0:36:48.120 --> 0:36:50.420
<v B>And then that doesn't even get into talking about branch coverage.

0:36:51.980 --> 0:36:53.140
<v A>Yeah. Yeah, that's right.

0:36:53.360 --> 0:37:03.480
<v B>Which is not just every line of code, but each path. So if there's multiple ways to get into an if statement, you exercise all the permutations.

0:37:03.860 --> 0:37:04.900
<v A>Yep. Yeah.

0:37:05.200 --> 0:37:06.760
<v B>That's much, much harder.

0:37:07.340 --> 0:37:09.977
<v A>Yeah. That's brutal, man. Okay. Um,

0:37:10.040 --> 0:38:17.511
<v B>My tool of the show is relatively limited, but I've been using a lot and thinking about it. Anyways, that's ThinkOrSwim. So ThinkOrSwim used to be a stock platform that was its own investment company, but now it's part of a brokerage called TD Ameritrade. And it's one of the options for interfacing with it. And so I have some stock investments with TD Ameritrade and I've been using ThinkOrSwim. But I really want to just use an opportunity. First of all, say I actually do like the interface and I almost exclusively do it from the phone. So I don't do tons of stock trading. It's more just investing. But I do it like exclusively from my phone and my tablet. I don't go on the website except to create the account. Like I manage everything from like on the go whenever I have a, you know, like some money gets auto deposited and I want to invest it in a, you know, indexed ETF or whatever. I just handle it, you know, wherever I am. And I just think it's kind of crazy to think that would have been me phoning some guy sitting behind a desk to execute an order, not even what like five years ago. And now I

0:38:17.511 --> 0:38:18.287
<v A>just like do it

0:38:18.287 --> 0:38:29.054
<v B>from like a tablet or my mobile phone. The trade prices are reasonable. And there's ways to get even better deals than what they have posted. Not me endorsing TD Ameritrade, but just

0:38:29.054 --> 0:38:31.340
<v A>saying, so what are the what are the fees?

0:38:31.340 --> 0:38:37.559
<v B>It slips my mind now. I think it's $5 for a stock trade. Oh,

0:38:37.800 --> 0:38:39.700
<v A>That's better than E-Trade. E-Trade's $10.

0:38:40.460 --> 0:38:47.420
<v B>So I have like a special, like there's like, like I said, if you shop around, there's like other ways, like referral links basically where.

0:38:47.560 --> 0:38:50.991
<v A>Gotcha. You'll have to refer me, hook me up. Okay. So,

0:38:51.259 --> 0:38:59.859
<v B>So yeah, I'm not specifically like far be it from me to give investment advice. Although I'll tell you my opinion.

0:39:00.060 --> 0:39:03.394
<v A>Oh no, we will never, we will let's not get in there. Yeah.

0:39:03.700 --> 0:39:24.977
<v B>Yeah. So, but, um, I'm just saying like for me, it's just about that. This specific one thing or something, I really liked the way it's designed and the way it operates. And, uh, also I think it's just crazy that we can do this now that like, I don't have to even be on my laptop or yet much less the phone, which I hate, calling people. Um, and so instead, instead,

0:39:25.220 --> 0:39:41.127
<v A>This is amazing. Like you can just take your phone out of your pocket and say, Oh, look, I think this looks pretty interesting. Yeah. I'm sitting here like, you know, waiting for a doctor's appointment or something. And you just have some time to study your financial situation. Yeah. And it really takes away

0:39:41.127 --> 0:39:56.160
<v B>Like the procrastination ability because it's like, Oh, well this weekend I'll get on and I'll, Oh, but the markets close. I'll wait till I'll set up or, you know, whatever, blah, blah, blah. You just do it. So it's $7 is my rate for flat stock.

0:39:56.240 --> 0:39:59.335
<v A>Oh, okay. Yeah. You'll have to add me to the fund or do it. Okay.

0:39:59.560 --> 0:40:00.160
<v B>All right. All right.

0:40:00.360 --> 0:40:09.764
<v A>I like how they're one of their, you know, bullet points here is they add zing to my ding ding. Oh,

0:40:10.320 --> 0:40:13.120
<v B>I think that's because it's the noise it makes when you execute a trade.

0:40:13.520 --> 0:40:17.160
<v A>Oh, okay. Okay. Well, I mean, who doesn't want that?

0:40:17.600 --> 0:40:30.700
<v B>Anyway, so the only thing you gotta be careful with all these things is there's an incentive to try to make you trade more. And I'm a firm believer that I think trading more just gets you into more trouble.

0:40:30.980 --> 0:40:35.760
<v A>Oh yeah. I don't. Yeah. Can you do like can you schedule things in advance?

0:40:35.760 --> 0:40:46.500
<v B>So you can set like a good to cancel order. So yeah. So like a good to cancel limit order. Like I want to buy Tesla at this amount or this ETF at this amount. And I want it to be good until I cancel it.

0:40:46.740 --> 0:40:54.380
<v A>Well, can you do like say, I want to buy Tesla, you know, the 15th of every month. Oh, I don't know. Kind of stuff.

0:40:54.800 --> 0:41:04.776
<v B>I've, I haven't tried doing that. It's possible. There's a lot of really like crazy stuff in the program. So, okay. Uh, so yeah, more, not an endorsement to, to trade or not. You heard it.

0:41:04.776 --> 0:41:07.860
<v A>from us by Tesla. Don't do that.

0:41:08.020 --> 0:41:45.020
<v B>But the amazing moving of also the other one, a lot of people use, what is that called? Oh, why is the name? Interactive Brokers. Interactive Brokers is another one. People recommend a lot. That's like, I guess, relatively low cost. And they also have a mobile one that I've used. And what I was going to say, Thinkorswim also, even if you don't open an account, they have like the paper trading one. And if you're just into like stock trade, like checking stock charts and stock prices, I think it's 20 minute delayed if you don't have an account. But for most people that shouldn't be a big problem. I don't write anyways. And so that just even using it to check stock prices and stuff, I find it to be a useful application.

0:41:45.600 --> 0:41:48.465
<v A>Cool. So it works on the phone or the iPad or both, or I?

0:41:48.465 --> 0:42:01.220
<v B>don't know if it's on Android, but for sure I have it on my iPhone and my iPad and they're both beautiful and nice. And I like them. Very cool. So that was way too many caveats for a tool of the show. Okay. Moving on. Time for Node.js.

0:42:01.540 --> 0:42:04.560
<v A>Node.js. So,

0:42:06.240 --> 0:43:08.440
<v A>Yeah, so Node.js is pretty cool. We talked about Node.js very briefly when we covered JavaScript a long time ago. I don't remember what episode that was, but at the time, you know, to confess, neither of us had ever written any big projects or anything like that in Node. And since then, you know, Node has come a long way. We've come a long way in terms of what we code day to day. And so we have a lot more to say about Node.js. It's pretty cool. The basic premise by Node.js is that JavaScript is the language of the browser. So if you want to do something interactive on the browser, you're almost certainly going to have to write it in JavaScript. And Node.js is a JavaScript-based engine for desktops. And so it's kind of nice because you can stay to just one language. And we'll talk about that more later. Why that's convenient.

0:43:08.880 --> 0:43:17.220
<v B>Yeah. So to give the one line summary, because sometimes it's frustrating to figure out what something really does is basically to allow you to run JavaScript not in your browser.

0:43:18.140 --> 0:43:22.440
<v A>That's right. It's just think of it as like a command line JavaScript engine, right?

0:43:22.640 --> 0:43:29.640
<v B>Yes. It took me a while to actually figure out what it was supposed to be. Nice. Not for this episode, but when I first heard about it.

0:43:29.920 --> 0:43:33.840
<v A>Yeah. Right. Do you want to cover some of the history? Sure.

0:43:34.180 --> 0:44:24.820
<v B>So, in Node.js, like we said, is a just JavaScript engine to run on a PC outside of a browser. And the thing that led to its development was that in 2008, Google released the V8 JavaScript engine, which is what they use for executing JavaScript inside of Google Chrome. But they released it as a standalone. So you could kind of compile JavaScript and run it. And in 2009, Ryan Dahl working at joint, which is a cloud services company. And so he released this thing called Node.js onto the scene, which was essentially kind of like a framework, encapsulation of V8 inside of it in a platform to allow you to even more easily run, essentially JavaScript programs as if they were almost native executables as it were.

0:44:24.980 --> 0:45:03.140
<v A>Yeah. Like what Node.js does is it connects job. Cause you know, like JavaScript ran on the command line with the V8, but it didn't have access to the OS. Like someone had to go in and write the read a file function or the send a byte over the network, you know, fun. Well, I guess that one's in JavaScript, but like, but like the read a file function or the control your mouse function or the read from the keyboard function, like these low level, you know, C operating system functions, someone had to connect them to the JavaScript engine. And that's what Ryan Dahl did with Node.

0:45:04.860 --> 0:46:44.299
<v A>Yeah. So, some of the pros. So one pretty cool thing about this is, it's all JavaScript, which is pretty cool. JavaScript is weakly typed, if you remember from the episode. So what that means is, the advantage of that is basically in JavaScript, everything is either a dictionary or an array or a primitive, like a string or a number. So everything's a bunch of dictionaries and arrays. You know, you have dictionaries of arrays, so on and so forth. And then that maps very well to JSON, which is not a coincidence. It's called JavaScript Object Notation. And so JSON is a, you can think of it as like a serialized form of a JavaScript object. So you can take some JavaScript object, maybe it's a dictionary, and, you know, it has a key called user, and the values, someone's name, and it has a key called friends, and the values, some list of friends' names, right? And you can have this JavaScript object and say, you know, user.name, print user.name, print user.friends, and then you can say, hey, take this object and turn it into a JSON string. Once it's a string, you can, you know, send it across the network, you can serialize it to disk, you can do whatever you want. And then at any point, you can say, JSON.parse, and it turns your string back into a JavaScript object, where you can like run functions on it and stuff like that.

0:46:45.080 --> 0:46:46.917
<v B>So this is pretty cool, right? Because you see where this

0:46:47.035 --> 0:48:46.060
<v A>is going. Like you could be on the browser writing what's your JavaScript, and you can say, hey, take these objects and turn them into strings, then send them to the server. The server's running Node.js, it says, hey, take these strings, turn them back into objects, and then just start accessing them. Just like, keep, resume where I left off doing the server side. This is especially useful for validation, right? So right now, a lot of people don't know this, but if you go in your browser, and like, you try to log into your bank, or something, and you don't put a password, you just hit enter, or you put the wrong password, like your bank, like, or if you put a, if you put no password, it won't even let you log in. Like, before you even go to click the login button, like, the password box will turn red, or maybe, like, right when you click, immediately it'll turn red, and your browser will just tell you, look, dude, you didn't put a password, this isn't gonna work, right? And so, or, you know, if you, if you try to sign up on a website, and it says, put in your email address, and you put A, and you hit enter, or even before you hit enter, it might say, look, that's not, A is not an email address, it's not gonna work, right? But that validation that's happening on the browser, is, it's impossible to enforce. Like, I could always go in, and like, hack the JavaScript on any website I want, on the browser side, to let me make my email B and A. But that's why you have to duplicate it. So, on the browser, on the client side, you check, just to keep things easy, and keep the flow going, and make it convenient. But then when you hit the server, you have to check again, to make sure that someone isn't trying to be malicious, right? Or have a broken browser, or something. And so, if you're gonna be checking twice, it'd be pretty cool, if you could reuse the same code that does the checking, right? And so, Node.js gives you that. So, you write the validation code in JavaScript once.

0:48:46.100 --> 0:49:30.240
<v A>and then you can use it on the client and on the server. And you know, it's gonna work exactly the same. Like, you're not gonna type some email address that the browser thinks is okay, but then the server doesn't think is okay. So, yeah, so especially for validation, but also for other reasons, Node.js is pretty awesome, especially for a front end. It also has some great MVC frameworks, that's Model View Controller frameworks. I personally prefer Express. I think Express is pretty awesome. There's also a bunch of other ones. But basically, what these do is, they just make your life easier. If you want to get a website up and running quickly, you need things like templating, you need to compile your CSS,

0:49:32.240 --> 0:49:42.879
<v A>you need to have a model, right? So you need to connect it to a database, and Express, you know, handle login authentication. Express does all of these things for you, and it just makes it super easy.

0:49:44.000 --> 0:50:43.080
<v B>Another pro is that, all the blocking calls, and Node.js aren't really allowed, that would normally be blocking, aren't really allowed to block. They are handled with a callback. And so this keeps your code able to scale a little bit better. So normally, you know, what the way we work is like, if you have a server, and a request comes in to initiate a connection, you would spawn a thread to service that connection during the life of that connection. But, this is fraught with all sorts of resource problems, and the number of simultaneous requests you can handle. Versus in Node, Node.js, the concept is that, when that request comes in, and you do some work, and then you're waiting, for instance, for a response, instead of having a thread there, it goes and does something else. And when the server itself, the Node.js framework, understands that the response has come in, it'll kind of call the callback you registered, and then stuff can progress. And that way, it can juggle a lot more simultaneous things happening at once.

0:50:43.839 --> 0:50:44.920
<v A>Mm-hmm. Yep.

0:50:47.200 --> 0:51:07.112
<v A>So, yeah, some of the cons, it's weakly typed. So, you could push bad code, right? I mean, unless you're doing your own sort of type checking with some kind of other library, like, unless you're using TypeScript or something like that, which we talked about in another episode. But, you're going Some people would say this

0:51:07.112 --> 0:51:07.680
<v B>is a pro.

0:51:09.200 --> 0:51:20.880
<v B>Really? I mean, this is a JavaScript thing, right? Like, a lot of people, I don't want to say, really like it, but, I mean, there's always this thing that, yeah, I don't know.

0:51:21.520 --> 0:52:02.783
<v A>Yeah. So, to Patrick's point, right? The whole like being able to go from the JSON string to the object and back only exists because it's weakly typed, and we called that a pro. So, like, one of the pros that we even mentioned wouldn't have been possible if it wasn't for this con, right? But, at the end of the day, like, you can get burned by this, right? So, it's like anything, there's no silver bullet. We wouldn't be on our 41st episode, 41. That's our second mistake ever. English. We wouldn't be on our 41st episode if there was just one language that was a silver bullet, right? But, I mean, it's free

0:52:02.783 --> 0:52:05.880
<v B>For something, it's fine for something to be a pro and a con, but, yeah.

0:52:06.380 --> 0:53:33.300
<v A>Yeah, right. But being weakly typed, I mean, I've definitely gotten burned by it. And one other thing about Node.js in particular, and I don't know why, I think actually you can configure it to be differently, to be different, but by default, if any of your web service requests crash, the entire server crashes, and it's just gone. So, in other words, like, if you have what's called a query of death, which means there is some particular use case that can cause, you know, your server to crash. Like, for example, let's say you divide by the number of characters that someone put in an input box, and someone puts it empty, and you don't check for empty. And so, when they hit submit, if they didn't fill in a box, under those conditions, you divide by zero and bomb out, right? In Node.js, if you do that, like, if you have a million people hitting your website, and one person does that, it kills the website for everybody. So, it's kind of got this thing where it's weakly typed, it's easy to get kind of runtime errors, and when you do, they're totally catastrophic. I do think there are ways to fix it such that, you know, if it bombs out, it's only for that session. That's kind of like how Java and some of these other servers work. But by default, it doesn't do that. And so, that's one thing to be aware of.

0:53:35.060 --> 0:54:09.240
<v B>So, we also said that a pro was the asynchronous nature and how that sometimes can help performance. But now we're gonna have two cons in a row that talk about some of the possible problems with it. And the first is that you can end up with just crazy amounts of callbacks nested inside of each other. Because every time you want to try to do something that would be blocking, you need to come up with a callback. And unless you're disciplined as a programmer, you can end up with just code that is a nightmare to read and follow and trace and see where problems are occurring. And you have to be really diligent to avoid that.

0:54:10.520 --> 0:55:08.319
<v A>Yeah, and I mean, in some languages, like Java, for example, most things are synchronous, but then you can do things asynchronously. Like, in Java, for example, you know, you could have a class that implements Runnable. And you could just call the dot run function and synchronously run that class. Or you could spin off a thread or assign it to a thread pool. And then it'll run asynchronously, right? But here it's fixed. So that's why, like, if you look at the Node.js API, there's read file, read file synchronous, you know, there's a bunch of these, like for almost any function, there's a synchronous version of it. And that's because there's no way in the language for you to handle both cases without duplicating all of your code. And so what ends up happening is most people just write the asynchronous version of everything. And then you end up with just every single function has a callback and it gets pretty ugly.

0:55:08.940 --> 0:55:21.220
<v B>Yeah. Cause you know, most of the time you can be really thin. And so it ends up being oh man, why does the name escape me? Anonymous callback, which is also very difficult. So it's just kind of like right there in line.

0:55:22.240 --> 0:55:26.680
<v A>Yeah. Right. Another con is performance.

0:55:27.680 --> 0:55:29.000
<v B>It's so it's interpreted,

0:55:29.299 --> 0:57:28.420
<v A>you know, as you guys know, interpreted languages are naturally kind of slower. So, you're not going to use this for doing some heavy image processing and things like that. It does have a lot of great support for libraries like ImageMagick and things like that. It has a lot of C and C++ libraries that it wraps that you'd use for something like that. But by default, you know, you're not going to do anything with, you know, that does any signal processing or anything like that in Node. It's also single threaded, which is kind of wild, right? Like you'd build a server where it only runs on one thread. But, as Patrick said, because of this asynchronous nature, it's just that one thread is busy all the time. Whereas in other languages, that thread might be just blocked on disk IO or it's blocked on waiting for a network packet or something like that. But in Node, everything is so asynchronous that that thread is always doing something useful. Like if it's, if you're reading from a file, then there's some callback that gets fired when it's done. And in the meantime, something else is happening. So, yeah, that's Node.js. I'm a big fan. I think it's awesome. I think if you want to get a website up and running quickly, this is the way to do it. But it has a lot of great frameworks and things like that too, for building professional, professional stuff. So I do think, if you want to do something more sophisticated, like write some kind of game server or something, you could still use this, but then this Node.js would be kind of your front end. It's like, you'd have your browser, you'd have Node.js that talks directly to the browser, and then it would write information to a database. Then you'd have some other program in Java or something that's, you know, maybe pulling that database and then doing the more like heavy duty work. Right? Like,

0:57:28.460 --> 0:57:37.280
<v A>I don't think you would want to write some very complicated project in this. So this is mainly meant to be pretty lightweight.

0:57:39.020 --> 0:57:51.779
<v B>Although I think people do write complicated things like Uber. I believe writes their view that shows like where all the Uber cabs are in a given city, they track out using Node.js.

0:57:52.720 --> 0:58:06.034
<v A>Oh yeah, that makes sense. So for things like if it's complicated in the sense, like it's a lot of data and things like that, Node.js works well, but like, for example, like the routing, like routing the cars, I'm pretty sure that Uber has

0:58:06.034 --> 0:58:11.859
<v B>something in C plus. I just remember hearing anecdotally one time talking about like large users of node.js.

0:58:12.379 --> 0:58:51.380
<v A>Yeah. Right. You can definitely scale Node.js very well. So I did talk about the single-threaded, but of course you can have multiple processes, right? So you can have, instead of one Node.js server per machine, you could have a thousand per machine, or you could have the number of threads times two per machine. And then you're, you're maxing out, you know, that machine just as you would with a single Java server. Right? So yeah, you could definitely scale it up, but with the weekly typed and other things, you know, you definitely wouldn't want to do machine learning or something like that. And Node.js would kind of be a nightmare.

0:58:54.380 --> 0:58:56.520
<v B>All right. Well, I think that's a wrap for Node.js.

0:58:57.220 --> 0:59:27.140
<v A>Yeah. Check it out. It's really awesome. You know, a lot of people say, 'How do I get started in programming?' And there's basically two pieces of, two paths you can go. Like one, assembly, brutal. One is like, most people want to either make a game, in which case you could get started with, you know, all the things we talked about on the Game Engines episode, or make a website. And if you're of the latter kind and you want to make a website, I definitely recommend using this. It's pretty slick.

0:59:27.140 --> 0:59:31.620
<v B>HTML blink tags for the,

0:59:31.740 --> 0:59:54.591
<v A>Oh God. Yeah. And yeah, everything should be blinking. Everything, everything, the entire document. Always, always. So yeah, this is pretty cool. So a couple of things to mention: one, in the past, like four or five months, the bandwidth has doubled, which is pretty awesome. It means that there's a lot of people following. Oh, that's why we're concerned

0:59:54.591 --> 0:59:55.420
<v B>about Net Neutrality.

0:59:56.260 --> 1:00:14.031
<v A>Yeah, that's right. We're the beneficiary of Net Neutrality. Yeah, we're using—I don't remember what the number is, like three terabytes or something, like two and a half terabytes. We're using like a ton of bandwidth per month, but it's great because it's a service that a lot of people are taking advantage of. And so we appreciate you guys. So there are a lot of

1:00:14.031 --> 1:00:18.000
<v B>new listeners out there, but they may be listening to old episodes, but if you're listening to the new episodes, welcome.

1:00:19.040 --> 1:00:19.971
<v A>That's right. And

1:00:19.971 --> 1:00:21.400
<v B>you made it all the way through your first one.

1:00:21.800 --> 1:01:15.040
<v A>Welcome. By the time you hear this, you're already a veteran, and it's wasted. It's sort of like a paradox, but you know, if you are listening for the first time and you get to this episode or you're going backwards or something, we have the Facebook page for Programming Throwdown. We have the Google Plus page—sorry, the Google Plus Community. We're on Twitter. We have the Neural Nets for Life Twitter handle. So, you know, stay in touch with us, communicate with us. We definitely, if we get some user mail, someone asked me about unit tests. So my tool of the show, not coincidentally, was a unit test tool. So if you have any feedback or anything like that, anything you want to ask, don't hesitate to ping us on those forums or send us an email.

1:01:17.540 --> 1:01:21.260
<v B>That was very well said. You've done this 41 times. You're a pro.

1:01:24.560 --> 1:01:25.820
<v A>All right. Till next time.

1:01:26.300 --> 1:01:27.220
<v B>Cool. See you guys later.

1:01:27.720 --> 1:01:49.200
<v A>The intro music is Axo by Binar pilot. Programming throw down is distributed under a creative commons attribution, share alike 2.0 license. You're free to share, copy, distribute, transmit the work to remix, adapt the work, but you must provide, uh, attribution, uh, to, uh, Patrick and I and, uh, share alike in kind.

