WEBVTT

0:00:00.000 --> 0:00:21.500
<v A>Programming Throwdown Episode Number Six: Assembly, take it away, Jason.

0:00:22.500 --> 0:01:15.850
<v B>Hey, so I'm here in the Valley now, which is Silicon Valley. It's an amazing place. I mean, you anywhere you drive, you're surrounded by tons of tech companies, and it's really weird. It's sort of like if I was driving through the internet. It's like I drive on the road, and it's like, oh, there's Intel, there's Microsoft, there's LinkedIn, there's all these different websites. So it's kind of a—I don't know—it's sort of a really cool feeling, but sometimes it can even be kind of eerie, you know? Overwhelming. Yeah, yeah. I guess it's sort of like you don't think that these websites need a bunch of people. You think it's maybe like a few people in a basement or I don't know. Somehow, like I didn't connect websites like LinkedIn with corporate America, but I mean, this makes it all very opaque.

0:01:15.850 --> 0:01:21.047
<v A>So now when you go to those websites, do you think of their actual building instead of the—

0:01:21.554 --> 0:01:41.804
<v B>Website? Yeah, yeah, exactly. Like now it's almost like there are two faces. There's the physical manifestation and there's, you know, still, you know, the website. Like there's the LinkedIn building, which is like this red brick kind of old-looking building with a bunch of oak trees, and then there's the website, and you can't help but conflate the two concepts.

0:01:43.305 --> 0:01:46.866
<v B>Huh. Yeah, it's pretty nuts. So what have you been up—

0:01:47.339 --> 0:02:08.770
<v A>To lately? Yeah, um, pretty much the same stuff as always. It's been really hot here, so you left just in the nick of time, I guess. And it's been really brutally hot and terrible outside, and so that's been kind of interesting. It's doing a number on my grass. So oh yeah, um, but I shouldn't complain anyways. It's nice to have a yard, but it's a pain, a lot of work, and yeah.

0:02:08.770 --> 0:02:25.060
<v B>When we got here, it actually rained, and it was overcast for the first week or so. And people are just in shock because I guess it doesn't rain between, you know, April and November or something like that. But yeah, now it's starting to get sunny, which is kind of nice.

0:02:25.060 --> 0:02:49.810
<v A>Yeah, awesome. Yeah. All right. Well, I guess we go to the news. So the first news item I see here is that Netflix is now the single largest source of internet traffic during prime time in the United States. I guess that is so—that would be what like six to ten, which is when most people sit down and watch TV. Instead of watching their TV, they're watching cable, or instead of watching cable, they're watching Netflix. Yeah.

0:02:50.181 --> 0:02:55.362
<v B>Yeah, exactly. Something like what? 30% of the entire traffic on the internet is Netflix. Yeah.

0:02:55.581 --> 0:03:19.712
<v A>That's pretty crazy. Now a while ago my wife and I canceled our cable, and we just have our internet. And we do this—we don't even—we just get the few basic network channels that are local, and other than that, we watch all of our video online. And I've tried to encourage people; this is a great way to save money, and most of us watch a lot of video on the internet anyways. So right, yeah, I'm a big proponent.

0:03:20.168 --> 0:03:47.978
<v B>Of this. Yeah. I just—you know, as part of moving, I made a commitment to, you know, you've always been telling me to switch to Netflix, and you know, I really had no argument against other than being lazy. But with this move and everything, I decided to give it a shot. I love it. I mean, I love the on-demand. I like, you know, renting the or getting the DVDs in the mail. I noticed that there's a lot of—especially newer movies that you can only get on DVD. Do you know why that is? Yeah, so it has to—

0:03:47.978 --> 0:03:59.588
<v A>do with the licensing so that the studios don't want to let Netflix carry it right away or as soon streaming, like releasing DVDs because they don't want it to hurt sales.

0:03:59.588 --> 0:04:00.820
<v B>Whatever. And then also they're

0:04:00.820 --> 0:04:05.700
<v A>hesitant to let Netflix have some movies because of, you know, they don't think they're going to make as much money or whatnot.

0:04:07.317 --> 0:04:08.970
<v B>But there's yeah, getting more and

0:04:09.021 --> 0:04:10.202
<v A>More. Yep. Sorry. Oh.

0:04:10.624 --> 0:04:24.293
<v B>No, I just feel like, you know, we really have to sort of redefine like art and the value of art, and the value of like artistic contribution in light of technologies that can duplicate said art for free. Yeah, well, um.

0:04:26.166 --> 0:04:51.209
<v A>The only thing that I really miss going this way is between, you know, Netflix for, you know, movies and older TV series. And then using a website like here in the United States, we have Hulu, which has a lot of the big networks shows on there. Um, the only thing really missed live sports. It's sometimes if you're a big sports fan, it's hard to get those sports games that would appear on a premium sports channel if you

0:04:51.209 --> 0:05:18.107
<v B>have um if you have cable internet, you know, you automatically have some cable channels, right? Even if you don't have cable television. Like I think you get a small subset of the channels for free. That's right. That's right. I wonder can you pay the however much it is a year to get the sports channel like, like I know you can get the NHL channel for like $100 a year. I wonder if you can get that without cable television? Um normally,

0:05:18.175 --> 0:05:48.145
<v A>No, they—that's called à la carte pricing. And at least in the United States, uh, the cable providers have been hesitant to go to all the cart pricing where you can kind of just choose I want this channel and I want that channel and I want the other channel. And part of that is because the channels themselves are sold as packages to the internet or to the cable providers. So they have to deal with the fact that uh those companies don't want to sell them just one channel; they want to sell them a package of channels because that's how they make more money. That.

0:05:48.449 --> 0:05:49.360
<v B>Way. Oh, gotcha. So yeah.

0:05:50.946 --> 0:06:00.632
<v B>So I see that Amazon has actually reached that threshold, that crossover point to where they're selling more ebooks than hard copy books. I think that's fascinating. Yeah, there was

0:06:00.632 --> 0:06:43.360
<v A>a lot of buzz about this on the internet when this story first hit and people were kind of confused about, you know, exactly what did this mean? Oh, and Amazon must be, you know, counting not counting all of their physical books, like just counting paperback books or just counting hardback books. Um, and then they must be counting on the Kindle side the free books that people download on the Kindle, but Amazon came out and said this does not count. Um the free books that are downloaded—these are only people who buy books, who pay for books. And then also that uh it includes all physical manifestations of books that they sell, so paperback and hardback. So it really is an astonishing number that they have; they sell more ebooks than regular books.

0:06:44.237 --> 0:07:05.140
<v B>Yeah, I mean this is—I don't know. I mean what do you think this means for publishers? I mean, I can't help but feel like the people in the middle, and this is both for what we talked about earlier with Netflix, you know, with the movie industry and with the, you know, with the book publishing industry, that the middle people are sort of getting completely cut out of the loop.

0:07:06.479 --> 0:07:09.668
<v A>You mean the middle men, the people who like right like

0:07:09.668 --> 0:07:25.902
<v B>In the case of Amazon, the people who you know publish and buy the books. And in the case of Netflix, you know the cable companies who broadcast, you know, the video content. Both of those people are getting cut out of the loop in the

0:07:25.902 --> 0:08:21.859
<v A>modern internet era. Yeah, and actually they're very quick to point out that fact, and that's bad because they're going to lose jobs or whatever. And I guess that comes to an economics thing, but you know, I hate to be harsh, but we can't really be responsible for trying to carry along what amounts to dead weight, you know? Right? If they don't have a place, it's kind of like when we—and this is probably cliched and probably not actually accurate—but you know, when automobiles first started coming about, and the people who sold whips for horses, you know, when the car nobody needed to buy those anymore once everybody had cars and nobody kept horses anymore. But it's like we shouldn't. Why should we feel bad for them? They have are some of them adapted and took on new industries and new ways to make money. And that's what these companies need to look to do instead of defending so staunchly their existing ways of making money. They got to find new ways to make money and new ways to provide benefit, not just screwing over their customers to try to get every last penny out of the

0:08:22.197 --> 0:09:16.129
<v B>Few who stay with them? Yeah, exactly. I remember reading something in historically in the 1940s, 1950s as women were beginning to get suffrage and become part of the workforce and things like that. People were complaining that oh, now you have this surplus in the workforce and it's going to force wages down for everybody and things like that. But looking back on it now with our advance in sociology, no one would take that away and say that women shouldn't be allowed to work as was the case 100 or 150 years ago. So I think that it's similar here where we're getting this pushback because there's this dogma, or people have been entrenched in their core business, but 50 or 100 years from now, we'd probably just—we wouldn't want to look back to this day. Yeah.

0:09:16.214 --> 0:10:09.319
<v A>And I mean it's one of those interesting things where it's a few people shouting very loudly to be heard because if you're in those industries, you care a lot and you're going to scream very loudly when somebody tries to basically get rid of your job or cut you out. Like it's going to happen in some of these cases where authors can sell directly to consumers, but the authors win, the consumers win. It's a more efficient market. So from an economic standpoint—which I'm not an economist, but that's a better thing—you want markets to be more efficient. You don't want inefficiencies, which is what the middlemen represent. And so they're screaming loudly because they're getting ready to lose their jobs. And then everybody else kind of doesn't really care either way; they just want to be able to buy what they want cheaply and quickly when they want it. So that's why it doesn't seem like they're shouting very loudly, but they actually do care. They just don't know that they care. Yeah, yeah, definitely.

0:10:09.319 --> 0:10:27.105
<v B>And there's in this case there's just a gigantic amount of wealth on the line for. Yeah, I mean you know book publishers, I mean, and the cable companies. I mean, the UCF University of Central Florida arena is called the Bright House Stadium for a reason, you know, which I guess we should

0:10:27.105 --> 0:10:32.100
<v A>explain to people who don't live in the region that that is because they're a local cable provider. Right? That's

0:10:32.522 --> 0:10:52.600
<v B>right, cable company. And so they charge you know I don't know what their advertised charges, what their advertised prices are, but they charge you know a substantial amount of money per month to essentially just move electrons across a wire in which the capital costs have already been paid.

0:10:53.380 --> 0:11:01.210
<v A>Yeah, yeah. Well, everybody's got their right to if people are willing to pay that, there's nothing to stop them from charging that. So yeah, yeah, people

0:11:01.632 --> 0:11:02.695
<v B>seem happy to pay.

0:11:03.184 --> 0:11:06.930
<v A>That. So you put an article in here about Apple trying

0:11:07.032 --> 0:11:07.977
<v B>to go

0:11:07.977 --> 0:11:09.664
<v A>after individual app developers.

0:11:10.120 --> 0:11:11.689
<v B>Or not other people.

0:11:11.689 --> 0:11:14.102
<v A>Going after individual app developers, right?

0:11:14.710 --> 0:11:28.024
<v B>So basically, you know, one thing that's been sort of pervasive in the news recently has been patent trolling. And even people who aren't patent trolls. Well, first let's explain what a patent troll is. What is a

0:11:28.024 --> 0:11:37.035
<v A>Patent troll? Is that a person that is very tall and hairy and carries a large club made of patents? It's yeah, and lives under a

0:11:38.031 --> 0:12:18.362
<v B>Bridge. Basically, a patent troll is somebody who—a business, a corporation—who does not have a profitable endeavor, does not typically isn't a big player in any particular arena, but has acquired either through their own developers or through purchasing it from another company, has acquired many one or several patents that are of use and essentially hires a strong legal team to sort of go after companies who they feel are violating their often very umbrella um and open-ended patents in an attempt to earn money.

0:12:20.387 --> 0:12:35.811
<v B>So basically what's going on here is the patent trolls want to go after Apple and every large company because these companies are very wealthy and they would often settle at a cost less.

0:12:35.811 --> 0:12:42.038
<v A>For them to settle than to pay the legal expenses to defend them even if they win, right? Exactly.

0:12:42.038 --> 0:14:18.700
<v B>But what's happening is a lot of these companies have entire legal teams. Apple, Google, Microsoft—all these big companies have a whole team of legal enforcers who can bring down the club if they have to on some of these patent trolls. Now, so what the trolls have decided to do is to go after developers, especially small-time developers who are making apps for Apple products like the iPod and the iPad. So the patent troll will go and sue the app developer, who's often a small startup or a five six person company, knowing that they don't have adequate legal representation. And in this case, what this article really elucidates is that the people who are being sued here are just using the Apple SDK. So in other words, Apple provides you with a series of functions; in this case, this particular instance is some functions that let you—I think—in-app purchasing, so let you buy items from while you're inside a particular application. And apparently that violates some patent from this company, Lodsys. So um Lodsys is going and suing every app developer that calls this function. So what this article is sort of hinting at is that or I guess it goes right out and says it is that Apple really should engage their legal team to go after some of these patent trolls because otherwise people won't develop for the platform.

0:14:20.700 --> 0:15:06.454
<v A>Yeah. I mean, I guess this is something that is gonna have to be handled by our legal system adapting to the fact instead of having a few big companies that sell to people—now it's instead of a what is that? A one-to-many relationship with the store being one and the people being many. Now you have a many-to-many relationship where you have many people buying from many sellers, and many sellers selling to a few people. And so you know, like you said, you can go make an app and only 10 or 20 people buy your app, and that's perfectly fine. But if these people are able to come after you and say, 'Hey, we're going to charge you five thousand dollars because you made a thousand dollars using our patent,' then you're just going to close up shop because you can't afford to pay that, right?

0:15:07.028 --> 0:16:11.963
<v B>And I mean, just to draw an analogy of how ridiculous this is. Imagine if you are really into model planes and you buy and assemble model planes and you sell them in your store, and you can sell assembled and unassembled, etc. And somebody—you're basically dealing in terms of kits. So you buy a kit which has all of the parts, the wing assembly and the brushless motors, etc., to power the plane. And you'll assemble the plane and then sell it at your store. And let's say that that kit, the wing assembly, is violating some patent. Well, the company that sold you the kit ultimately, in my opinion, should be responsible. Yeah? But it's like now what they're doing is going after you for just taking something that—for buying something that violated a patent. And in this case, it's even more ridiculous because Apple has already settled with this Lodsys company. So Apple's not violating the patent because they paid off this company. So really this company shouldn't have a leg to stand on, in my opinion. Yeah.

0:16:11.963 --> 0:16:31.825
<v A>But and it looked like this article from the Electronic Frontier Foundation is basically calling to action saying that Apple needs to stand up for their developers and defend them because this isn't fair to let the developers kind of just flap around in the wind without helping them considering that they know that those people can't defend themselves, right?

0:16:32.331 --> 0:16:58.065
<v B>It's really funny to see an article where the EFF, you know, you just—I guess in this case they're not really siding with Apple. It's more like they're trying to drive Apple to do something, but you know the EFF practically hates Apple, right? Because yeah, that's true. So, just to hear them talking about Apple, it's really a sentiment to Apple and just how pervasive Apple has become in the digital world.

0:16:59.314 --> 0:18:17.277
<v A>So talking about the way things are changing, you know, I saw an article saying that Mark Zuckerberg wants to be able to let kids younger than 13 use Facebook. Now currently, you have to be the incredibly intelligent individual that has to understand that even if you're under 13, you can still just click the button that says you're over 13 and get on. So actually there's, you know, many reports out there showing that there are, you know, millions of people on Facebook that are under 13, but it's technically not allowed. Like they're not supposed to let them use that because they're not able to decide what should and shouldn't be posted there, and it can just be a problem. And Mark Zuckerberg saying that, 'Look, this is kind of silly; they're already doing it. We should allow them to use it,' you know, and learn about it. To me, it's kind of, you know, even the article here in the title is like a minor controversy, and it's not really that big a deal, but I thought it was interesting to bring up that, you know, when we were growing up, when we were kids, you know, there was no worry about this kind of thing because that opportunity didn't even exist really. And now we have to think about that, you know, if we're going to have kids, what are we going to tell them to do? Like if they want to get on Facebook, you know, they can. So are we going to tell them, 'Look, you're not allowed to get on there,' or are you going to say, 'You know, teach them how to use it appropriately and let them get on'? And then how young is too?

0:18:18.188 --> 0:18:37.577
<v B>Young. Yeah, I mean these are all really good questions, right? I think that one of the things that this article hints at is that the Facebook for a 12-year-old will look very different from an adult—the adult version of Facebook. And so you know, as long as there's the correct parental supervision, you know, built into like

0:18:37.830 --> 0:18:39.450
<v A>Controls. Yeah, parental controls.

0:18:39.580 --> 0:19:04.797
<v B>Yeah, controls and even more so—I guess I don't know what the word is, observation? Maybe like maybe you can see all the profiles that your 12-year-old has clicked on or something like that. You know. Um then yeah, I think it would be great. I mean Disney already does this, right? There's um several Disney massively multiplayer games like The Pirates of the Caribbean MMO, and there's a couple other ones I can't think of off the top of my head. Oh yeah, I've seen

0:19:04.797 --> 0:19:08.695
<v A>it some weird cartoon village one or something. I saw an advertisement on TV for once.

0:19:08.914 --> 0:19:40.352
<v B>Yeah, yeah. And so they're 13 and under, and you know parental consent and things like that. And when I was at the Disneyland in California, um they had a little demo where you could—you could jump on and play. It was it was a little creepy being like 30 years old running around in this village with a bunch of 12-year-olds, so I wasn't on that game for too long without being weirded out and just leaving. But yeah, no, but I mean, you know the environment's there, and Disney's had tremendous success with that, and I haven't really heard of any bad press or anything. So yeah, I

0:19:40.352 --> 0:20:05.445
<v A>mean as long as if you, you know, show your kids the, you know, how to handle when something is suspicious or looks wrong or, you know, to not say certain things online, that, you know, I think that's good. But there's a lot of adults who haven't figured out how to use it appropriately. So um I don't know, I think some kids could probably do a better job than many adults, but yeah, it's hard to say. I guess like you said, just as long as if maybe the parents have the option to be able to observe.

0:20:06.660 --> 0:20:38.014
<v B>Right? And this really gets that sort of—I mean, just going off what you were saying a second ago, a lot of adults really don't understand, you know, privacy and and really how little privacy you have on the internet. You know, some people think, 'Oh, if I post something and I post it to my friends, no one else will see it.' And you know, I mean, I'm sure they know that all someone has to do is copy and paste that, you know, and post it to the whole world. But but maybe they just—they don't think that something like that would happen.' You

0:20:38.217 --> 0:21:57.816
<v A>know? Yeah, well I mean even people don't understand the permanency of things on the internet, and it's kind of very different the way information exists in the world today. So you know, it used to be before the printing press, before writing, you know, before recorded speech that people would say something, and if you didn't hear it, it became hearsay. It became passed down like it was very ephemeral. But then now and today everything you do can be, you know, even this podcast, right? We'll record this, and then many years later after we've long probably forgotten we ever done this, our kids will probably be able to find this online somewhere floating around or posted somewhere. You know, it'll get copied thousands and thousands of times, and it'll just live on forever in one form or another. You know, so things you do on Facebook, even if you think you delete them or get rid of them, like you said somebody could have copy and pasted it somewhere else taking a screenshot of it. You know, it gets duplicated. And you see this with things like WikiLeaks when that happened, and aside from, you know whether that was right or wrong, just the fact that some of the people, you know, writing to WikiLeaks and saying, 'Can you please delete the copy of, you know, the stuff you have that you shouldn't have? That that's classified. Please delete it.' And it's like—like what does it matter? Like you can't—can you send us back? It's like, you know, I can't send you back to CDs. I sure I can delete it off of a computer. It's been copied out on BitTorrent to thousands of people, like yeah leading off my computers isn't going to change anything. Yeah, I

0:21:58.356 --> 0:23:02.060
<v B>mean it's extremely true. There's a time when I was using LiveJournal a lot, and I was posting about something—about it was something that was it wasn't offensive or anything, but it was very trite, like something about 'I hated this particular class.' Oh, I really didn't like—I think it was American History. And for the longest time, if you Googled my name, the first link was how, you know, Jason Gauchi, which easily could have been traced to me and was me hated American History. And even as I was applying for jobs and things like that, I had to carry around this fear that like if some American History buff software engineer interviewed me, that you know it just wouldn't go over well. Yeah, so it is true, and it really, you know, especially as as you know this article, you know, draws our attention—if you're a 12-year-old, you really can't think about the permanency of what you say. You know? Yeah, most 12-year-olds just don't have the maturity to do that. So yeah, Facebook's gonna have a tough time, but if they can create an environment that's—that's, you know, safe and regulated and easily observable.

0:23:02.498 --> 0:23:04.439
<v A>That, you know, I think that could be a positive.

0:23:06.109 --> 0:23:10.598
<v B>Thing all right. So I see an article here about open source preparing students for better careers. Yeah, I guess.

0:23:11.138 --> 0:23:57.038
<v A>This is one of those no-duh. Yeah, that's right. But I thought this is interesting. I put in here because I know you've done a lot of work on open source projects and helped out with that. And you know, in general, it talks about learning how to communicate, learning how to work on big projects and planning and all this. I mean things that are kind of like no-duh, but I think when you're in school, you have this time, but you kind of think you're busy, but you're not really all that busy. And so if students would take time to actually go join an open source project and actually make contributions—not just to put it on their resume, but to actually experience growth—it'll make them better prepared when they first start their first job, and people will notice there's a difference, and it'll help their careers, right? I mean, the thing about you.

0:23:57.038 --> 0:24:42.300
<v B>Programming is it really an art? And it's almost—I guess I would say it's a trade similar to like masonry and things like that. But unlike the Freemasons, which is a highly secretive society and probably doesn't do masonry anymore, but unlike those know secret trades of yesteryear, in this case all of that information that trade and that skill can be cultivated on the internet. But to do that, you really have to participate in open source. So, you know, we talk about many different programming languages here, and a lot of them have—as we talk about batteries included—like Python has a zlib compression built into the language.

0:24:44.140 --> 0:26:14.063
<v B>But you know, many languages like C++ and Java, low-level kind of languages you learn when you're first starting, they don't have a lot included. So you really have to sort of understand what are the tools at your disposal. If I want to do cryptography, let's say if I need to do some kind of cryptographic hashing or something, I know of several open source utilities, and I would just download and actually know which ones are good and which ones are painful to work with. And that's just because I've been in so many different open source environments. You know, I've seen you can go into the Mozilla Gecko rendering engine and go into the socket code for Mozilla and find out what crypto and MD5 libraries they use. And then you can visit their websites and move it back. It's sort of like reading research papers. Let's say you're really interested in some kind of—let's say you're interested in the Google car, like that's all open research, right? The autonomous car. You can read that research paper, and it'll probably use a bunch of words that none of us know. You can go and read the papers that are referenced by that paper and start to build the vocabulary and understand what's going on. In a similar way, you can dive into an open source project and end up learning a tremendous amount about programming, and especially about getting stuff done. And you can give yourself a tremendous amount of power to do some amazing applications. Yeah.

0:26:14.265 --> 0:26:55.020
<v A>I mean, I think it's very easy to get overwhelmed. Even the stuff you just said is very overwhelming. But I mean, that's the same thing that happens to you when you first start a job. It just seems like oh, there's so much to learn. I'm never going to figure it out. But then you do, and you start to make small contributions and bigger and bigger. And some open source projects are probably better suited to this than others. Some are kind of notoriously—you don't want to say mean or hostile, but you know, kind of don't expect you to know a lot when you get there. And others are more welcoming. Even this article mentions the Google Summer of Code, which is particularly specifically targeted at students where Google pays that student to work on the open source project, and so those projects create set tasks for the students to work.

0:26:55.020 --> 0:27:57.439
<v B>On. Yep. Yeah, those are definitely awesome. I know several people have participated in that. It's very accessible. So if you really get into a particular open source community—like there was a period of time where I was really involved in the Ogre open source graphics rendering engine community—and you can go and request to be a part of the Summer of Code if you have a particular project that's especially engaging, and those people are often very helpful. And they want—a lot of those people who are in charge of open source projects, they're natural leaders. I mean, the reason why Ogre is successful and Joe Schmoe's graphics library is not successful is because Sinbad and some of the other leaders of that community are very charismatic, and they draw developers to go on there and work for free. So they will be more than happy to help you out and get you started. So yeah, definitely if you're in college, definitely take advantage of that.

0:27:57.591 --> 0:28:01.675
<v A>Yeah, yeah. So what is this Hype animation creator? Yeah, so—

0:28:02.991 --> 0:29:15.014
<v B>Many of you out there probably have developed or done some stuff in Flash. If not, I'm sure everybody's used Flash. If you've ever watched a YouTube video, well, now YouTube switched to HTML5, but regardless, many many applications out there on the internet, websites have Flash embedded in them. But to do anything cool with Flash, you have to buy the Flash Studio—what's it called? It's Flash CS5 Professional, which is I think it's like two thousand dollars. And even I remember as a student looking to get it and it was several hundred dollars for even the student edition. So, and plus Flash has other issues as security vulnerabilities, and it doesn't work on the iPhone. There's a hundred different reasons why making Flash stuff is kind of terrible. So what this Hype says is we're going to try and give you the same functionality as Flash, but instead of the output being a Flash video, it's going to be HTML5 with the Canvas tag and the JavaScript WebGL rendering. So you get to do the WebGL.

0:29:15.014 --> 0:29:17.020
<v A>Does it use the Canvas?

0:29:17.740 --> 0:30:09.857
<v B>So it uses Canvas. Now they're looking at making it support WebGL, which would give it the hardware acceleration that Flash has. So basically this Hype is where Flash was when it was 1.0 and it was all software rendering, etc. Okay? But the cool thing about it is it looks, the interface feels like the Flash development environment. So you have the keyframe animation, you have the tweening where you say I want the object to be at position X at time zero and at position Y at time one, and at time 0.5 it's the midpoint of X and Y. So it does the tweening. It does a spline tweening so it can look smooth when things are moving around. All the cool things that Flash can do, and it generates something that you can see on virtually any device. Nice. And so this—

0:30:09.857 --> 0:30:11.865
<v A>Is a free program? A paid program?

0:30:11.933 --> 0:30:22.446
<v B>No, but it's relatively inexpensive. It says here it sells for thirty dollars. Okay. So I haven't used it, but I'm thinking of buying it and trying it out. Yeah, I guess let.

0:30:22.446 --> 0:30:24.404
<v A>You know how it works? It sounds kind of cool.

0:30:24.623 --> 0:30:31.896
<v B>Yeah, I think I'm gonna buy it. And if it's good, you'll see it as a tool of the bye week some weeks speaking.

0:30:31.896 --> 0:30:33.340
<v A>Tool of the bye?

0:30:35.237 --> 0:30:36.284
<v A>Week? Yeah, so...

0:30:36.486 --> 0:30:48.585
<v B>What's your tool of the bye? Oh, you beat me to the punch. What's your tool of the bye week? This I guess I have to say my tool of the bye week is FileZilla, which has that sounds like the thing.

0:30:48.585 --> 0:30:49.480
<v A>That defeated?

0:30:52.534 --> 0:31:47.395
<v B>Tokyo. It's... well, that was Godzilla. Yeah, FileZilla defeated. I don't know DirectoryVille. I don't know, but FileZilla is not to be confused with Mozilla. Um, I don't believe they have anything in common. I don't think the communities are in common or anything. FileZilla is an FTP client, um, but its UI is very slick. It has drag and drop from outside the window so you can drag from Finder on a Mac or from Explore. You could just drag folders into the FTP server. It has a bunch of cool features, you know? You could do diffs. You can actually open a text file on the FTP server, and it'll open in your favorite editor. And when you save um and close the file, FileZilla somehow keeps track of the process when you've closed the editor. It uploads the file back, so it has a lot of nifty things, and it's completely open source, so you can put it on any computer. You don't have to pay for.

0:31:47.597 --> 0:31:51.023
<v A>It now FileZilla is both an FTP server and an

0:31:51.023 --> 0:31:55.073
<v B>FTP client, right? Oh, did I say server? Uh, I think.

0:31:55.073 --> 0:31:57.587
<v A>You were saying client, and you're talking about

0:31:57.587 --> 0:31:59.916
<v B>Yeah, I don't think is it a. Oh yeah, it.

0:32:00.000 --> 0:32:00.929
<v A>Is a server? You?

0:32:01.485 --> 0:32:05.265
<v B>Know I've actually never used the FileZilla Server well just because that can be.

0:32:05.485 --> 0:32:14.969
<v A>Confusing when you go to the website because um I've done that before, told people, 'Oh yeah, get FileZilla,' and they're like, 'I don't need a server. I'm trying to connect to a server.' Oh, that's interesting. Yeah.

0:32:15.289 --> 0:33:18.351
<v B>So I actually get it. Um you know, I'm a big, uh, you know, Mac/Ubuntu Linux fan, and in Mac you can get it through MacPorts, and in Ubuntu you can get it through um through apt-get. So neither of which actually use the website, so I've never actually been on the website. It's my first time, but, uh, but yeah, the FileZilla looks like the server is only for Windows, which is interesting. Okay. Yeah, but, uh, yeah, the client is very effective, and, uh, I'd highly recommend it. One interesting thing too: it has like an auto-updater interface, which is pretty slick even on Windows. Um you know, many of the open source apps, and this is one thing that I've always had a problem with, and maybe if I have some more time, this is something I want to address, is you have NSYS, which is um Nullsoft Scriptable and Solve System. So you know how you see like you download some open source program like FileZilla, for example, and it has your stereotypical like 'Here's a new license,' the new license in like a little install shield, and you click next. It's like the directory installed too. You click yeah.

0:33:18.351 --> 0:33:23.363
<v A>We talked about this last episode in association with over-the-air updates from Apple and whether.

0:33:23.363 --> 0:33:32.580
<v B>Oh yeah or not. Yeah, we talked about so FileZilla actually has you know a nice auto updater, and I just hope maybe I might lift it or something. So we'll see.

0:33:32.580 --> 0:33:57.180
<v A>Yeah, so my tool of the bi-week on the notion of, I guess doing networking tasks is PuTTY, which is a Windows tool for doing um remote connections to computers, so especially like SSH, Telnet—those kinds of things. It supports a whole host of things. There's actually a couple different programs um to do various features like secure copying SCP and stuff like that, and um this is.

0:33:57.180 --> 0:34:03.036
<v B>So can I take this and put it on my walls to fix cracks and place where I've nailed things?

0:34:03.154 --> 0:34:14.072
<v A>To the wall? Sure. I'm sure it's probably good for that. It is a pretty useful tool. Um but no, I would not try to get it to uh seal any cracks in your in your house. That's probably not a good idea. Um and I.

0:34:14.072 --> 0:34:14.730
<v B>Also wouldn't try?

0:34:14.730 --> 0:35:13.776
<v A>To stick it to a comic in the newspaper and make it have the image of it like silly putty. Um sorry. Okay, anyways. Um yeah, but this tool is really good at connecting to SSH stuff on Windows. It's really useful for doing that because I don't think Windows has a native way to even—it has a native Telnet client, but not a native SSH client. And so um this is the thing everybody uses. It's a little confusing to use because it does so much. It's so powerful. Um but once you kind of figure it out, it's able to even do like setting up um proxy tunnels and stuff like that, so you can you know tunnel SSH traffic through it to another computer and do all sorts of interesting things like that. Um so it's really powerful, but just the even the basic ability of just being able to SSH something on Windows is very nice, and this is the de facto thing to go to. And so people who are trying to do this for the first time or using or have never done it before, uh if they don't know about this, they either quickly find it out or if you tell them, they'll be really excited they found it.

0:35:14.249 --> 0:35:24.981
<v B>Yeah, yeah, definitely. So I think if I remember right, um there's PuTTY, which is sort of a little bit more full-featured, but there's also Plink, right? From the same company. Um I don't.

0:35:24.981 --> 0:35:31.647
<v A>Know. I think yeah. Okay. Um yeah, they do have it looks like it. I see Plink on here on their website.

0:35:31.967 --> 0:35:45.822
<v B>So yeah, I think Plink is sort of more like a scriptable version. It's not as full-featured, but it's sort of—it's a lightweight version, I guess, of PuTTY, but yeah, they're both excellent programs for anyone who's on Windows.

0:35:46.159 --> 0:36:11.219
<v A>Yeah, it's open source and everything, which is important to note when whenever you're dealing with security. That's always a kind of an interesting thing that if you have a closed-source security tool, for instance, like an SSH client, and they don't implement everything exactly right, you could be subject to people getting your traffic even when you think it's not. So open source at least—you know, hopefully people have taken the time to review that or have the opportunity to review it, right? And look

0:36:11.219 --> 0:36:11.843
<v B>for vulnerabilities.

0:36:13.598 --> 0:36:55.718
<v B>Yeah. So today, this show, we're going to be talking about Assembly. Yeah, and so like assembly lines—yeah, it's kind of like have you ever had to do community service at the soup kitchen, and someone comes up to you and they say, 'Hey, move a 20 to register three.' And the next guy comes up to you and you give him some soup, and he says, 'Hey, you know store three and register five.' It's similar to that, but it happens on the computer. Okay, that's a little bit of a stretch. Yeah, but as you could tell—as you could probably tell—Patrick is definitely the Assembly expert. And well, I can probably count on one hand number of times I've seen Assembly code, really.

0:36:55.718 --> 0:36:57.540
<v A>Wow, that's kind of sad, Jason.

0:36:57.574 --> 0:36:59.970
<v B>Yeah. Um, so yeah, so Assembly. So you know,

0:36:59.970 --> 0:37:25.367
<v A>kind of sticking with our a little format here: the history of Assembly kind of is the history of programming, I guess. That when you first have a computer that has—you know, just a CPU—we're talking that you kind of have to talk to it somehow. Something has to give it instructions to execute, and those instructions aren't C; they aren't Python; they aren't Java; they aren't Erlang; they aren't C#. Um, so right because

0:37:25.367 --> 0:37:36.201
<v B>those languages—you know, as we talked about in the past, like Python runs on a virtual machine. You know, but if you want to know what runs on the actual machine, it is Assembly language.

0:37:36.404 --> 0:38:09.833
<v A>Well, actually not quite. So this is a maybe a knit—maybe a a, you know, something that's really specific and nobody pays attention just; it's semantic. Um, but Assembly actually isn't what runs on the computer directly. Assembly is even one step slightly above that. So the thing that actually runs on the computer are known as opcodes. So this is like raw hex instructions, you know, just like a number, a hex number that represents move, which moves from one register to another register. Oh right.

0:38:09.833 --> 0:38:11.014
<v B>address and RAM to

0:38:11.014 --> 0:39:55.538
<v A>a register, and then a number that corresponds to a hex number that corresponds to which register, and then a hex address. And so that's basically humanly not readable. You can't read that at all. So one step above that is Assembly, and it—it kind of has to do with what's called mnemonics, which is kind of reassigning a name for something else. And so instead of having to remember that you have to type, you know, FA for move, now it can just have the letters MV or MOV. Um, and so it's a renaming, but it also allows you to have special names for registers so you don't have to remember the hex code for each register and things like that. Um, but what that does introduce is the need for an actual what's called an assembler, which is kind of like a compiler but a lot simpler. Um, and that even some languages—the assembler can be one pass instead of many passes, which we've never talked about that before. But um the way that high-level languages are, the compiler can have to make many passes through a given source code to try to figure everything out, and an assembler is typically either one pass or two pass. And what it does is it goes through, and if you use a variable, it has to figure out where in memory that variable is going to reside. Um it has to figure out what the register names are, and it kind of converts all of those things to offsets into numbers. And then the second pass, it actually does, you know, almost like a transliteration just from the instruction to the hex code—this the instructions that are fed into the CPU which tell it literally how to guide something through the pipeline, through the ALU, you know, moving stuff from one register to another, to do an addition, to do a multiplication, to go fetch something out of RAM, to handle all of that kind of stuff. So what?

0:39:56.415 --> 0:40:08.295
<v B>are a few instructions when you get down to that level? Like what are some typical instructions? So so typical could you do like is can you do like sort a list? Is it like calling a function where you do a bunch

0:40:08.582 --> 0:41:46.896
<v A>of things. Or well, so no, but sometimes and this is a very unique quirk of assembly. So when you talk about higher-level languages, which assembly is kind of the lowest-level language—you know, excluding opcode programming, which nobody does—so assembler, but it is the lowest. And you kind of go up to like C and then to C++. And there's something above that, maybe Java or Python. And so when you move up that stack, you're gaining portability, which is the ability, like when we talk about running on a virtual machine, that you don't care about what CPU you're running on. But the interesting thing with assembly instructions is that they are completely unique to a given processor. So if you're using, you know, an x86 Intel processor and then you try to go run on a machine that has something different—so, you know, Macintosh computers used to run on PowerPC, older computers might run on Alpha processors, or even like the Android phones are using ARM processors. And actually the iPhone does as well; it uses an ARM processor. Those all those processors have different, completely different instruction sets. And so the assembly language and the routine supported—the instruction supported can vary greatly between those. For instance, that on one way that an instruction is done, if you say have a move and you want to move from one register to another register, you may list the, you know, origin register first and the destination register second. And then in another processor it may be reversed where it's the destination register first and the source register second. Oh, I see. So you got to

0:41:47.031 --> 0:42:41.858
<v A>be careful. And then also the number and you know complexity of the instructions can vary. So that has to come with something called the difference between CISC and RISC. And CISC is a CISC, which is Complex Instruction Set Computer. And then RISC is a Reduced Instruction Set Computer. And so originally the CPUs were very basic and kind of were RISC by definition, but they weren't called that because there was no alternative. They could only support very few instructions, right? And then as they grew, they became more complicated to support things. Even like you were talking about, like you may have a single assembly instruction that allows you to sort an array or yeah, an array of like eight numbers. Um and it can do it in one instruction. Now that instruction may take many cycles to execute, but you can have one assembly instruction that does that, and it's going to be very optimized because it's not implemented in software at that point; the hardware actually implements that sorting, and that's right.

0:42:41.976 --> 0:42:50.279
<v B>So maybe we should talk a little bit about since it's particularly relevant to this show the difference between registers and memory. I don't think we've ever explained that. No? Yeah.

0:42:50.279 --> 0:42:51.544
<v A>That's a good point. So,

0:42:51.544 --> 0:44:46.176
<v B>Do you want to take a shot at that or do you want me to go? I'll give it a shot, and then maybe you can clean up. Yeah, go ahead. Yeah, I'm not too good at the low level, but so basically for what I understand, you know, everyone knows about main memory. So you have, you know, you go to the store to Best Buy and you say, 'I want a computer with four gigs of RAM.' So you end up with, you know, a bank of four gigabytes. And um, you know, applications are given what's called an address space, you know, protected address space inside of that four gigabytes. So when you start Microsoft Office or something, um, you know the operating system in this case Windows gives Office a certain amount of memory, like you can have this block of 128 megs, let's say. And so Microsoft Office can go in that memory and allocate deallocate memory and you know put numbers in there and put your Excel spreadsheet in there, etc. Um now the computer, the CPU, it's sitting on a chip on your motherboard, and it's, you know, in terms of the motherboard, it's far, far away from the memory. So um the memory is it takes incredible amount of time, like on the order of milliseconds, to get data from the memory to the processor, or maybe it's faster than that, like microseconds or something. But the processor itself can run in terms of nanoseconds. So the processor needs the ability to sort of look at data and put data into places very quickly, much faster than the memory can support. So there are things called registers, which are sitting right next to the processor. So actually in the processor, right next to the logic unit—so you know the units that are responsible for adding two numbers, right next to that there's a small bank, usually let's say 10 to 20, you know, registers that can hold things which are going to be used immediately.

0:44:47.374 --> 0:46:45.940
<v A>Yeah, that was for, you know, something that could take a very long time to explain. That's a really good explanation, and it's kind of talked about as memory hierarchy. So you can kind of imagine it like a pyramid. So like you were pointing out RAM, you have gigabytes of RAM, um but then a process—registers. You may only have like, you said 32. Um they're normally in powers of two, so like 16 or 32 registers. Um and each one of those only holds a single. If you have a 32-bit computer, it'll hold a single 32-bit number, or if you have a 64-bit computer, it'll hold a 64-bit number. And that's where those—a 32-bit processor, 64-bit processor—that's where that comes from is what the size of the native um amount that it works with is. And then so the hierarchy is that close to the CPU, it's very, very limited memory. So you may have 32 numbers. Um and then as you go up, you go through something called cache, which is a little bit bigger and a little bit farther away. And you keep going out all the way out to main memory, and then to the hard disk, which does take, you know, milliseconds to access. And if you think about um, you know, you say it's far away, and this was an illustration that helped me when I was learning about computer architecture, but um the processor today runs at a couple gigahertz. And if you think about uh the frequency of one gigahertz in one cycle, so that the gigahertz measures how many times the computer's clock ticks up and down per second. So a one gigahertz computer is what—what's giga? Is a billion because a megahertz is a million, and then a giga is a billion. So a billion times in one second it it you know counts. And so in each of between each of those counts if you actually look at how far light can travel in one cycle, it only amounts to, you know, about uh, you know arms' width. So if you raise your arms up and hold them about shoulder width apart or whatever, that's about how far light can travel in one cycle, which is not very far—so a couple feet, right? And so even though the things on the board, you say, oh

0:46:45.940 --> 0:46:55.202
<v A>they're only a couple inches apart. Well, yeah, but we're talking about speed so fast that even in one clock cycle you cannot go out to main memory and get back.

0:46:55.202 --> 0:47:02.256
<v B>In time, right? Remember Patrick's analogy has to do with light, but in this case we're dealing with electricity, and the speed of electricity is significantly slower. That's

0:47:02.256 --> 0:47:17.798
<v A>right. That's right. And it isn't a direct connection. There's actually if you think about how far it has to travel, it's like a veritable maze between the process where you are in the processor all the way out to main memory. It's not a straight line, right? And there's a controller, a memory controller between the two.

0:47:17.798 --> 0:49:17.220
<v A>It's very complicated. Yeah. Um so yeah, so the registers like you said there's a bank of um holding cells of one one number each in each one, and you explicitly operate on those when you write an assembly instruction. And so one of the differences between RISC and CISC is that in a RISC, for instance, it will only allow you to do multiplication taking from two registers and putting into another register. So multiplications, additions, subtractions, you know, divisions can only be done on register-to-register basis. You cannot go out to main memory and then you have so you have those kind of basic instructions. You also have what's called a load and store. So a load says go out to main memory and bring it into a register address, and a store says take something that's in a register and stick it out to main memory. And those ones can operate outside of registers. Um and then you can have something says move where you might need to move from one register to another register, so essentially do a copy from one to another. Uh then so that's kind of talking about data memory. There's also something that you have to be aware of, which is program memory—program data, which is the instructions that are executing. So there's kind of two, and depending on your machine, there's kind of two can be together, it can be separate, but there's two kinds of data: there's data that you operate on, and then there's the instructions. And so the instructions have to be fed into the computer as well. And so what that is is you have an instruction pointer, which is the address and RAM that the current assembly instruction you're executing—the current opcodes are held. So on a 32-bit machine, those normally, you know, that's 32 bits is divided up between uh the what the opcode is, what a register is, and what the, you know, source register is, what the destination register is. And so when the when the CPU loads that instruction, it then has to know what to do with the instruction pointer. And so if it's for instance just a move or a load or a store or an add, what it'll do is just increment the

0:49:17.220 --> 0:49:37.759
<v A>instruction pointer by the size of that instruction and so just kind of go to the next instruction. But that doesn't support any sort of conditional stuff. So you're if you—if you didn't—if you just had those instructions, you would never be able to do anything different. Your program would be completely deterministic. You would just start it and always would do exactly the same thing, and nothing would ever change, and that'd be really

0:49:38.198 --> 0:50:02.970
<v B>boring, right? I mean, we know that when we write C code or any other language that there are sections of the code that we do or don't step through at runtime. So we might say if some variable is greater than 20, then do this code; otherwise it's going to skip that that block of code. And so when these languages—higher-level languages—get compiled down to assembly, that corresponds to a jump. That's right. Well, actually there's yeah.

0:50:02.970 --> 0:50:34.881
<v A>Depending on a couple different things, but one could be a jump. So a jump would be like a go to another instruction that isn't the next instruction. So you could jump to a different address, and that's where the assembler helps versus writing in pure opcodes. Is that that jump can go to a label in the computer, in your file, in your source code, which the compiler, the assembler will be able to figure out what that address is later. If you had to do it by hand, you would have to calculate how many bytes to skip in your jump, and that would be confusing and annoying.

0:50:34.881 --> 0:50:38.526
<v B>If you added a new line, you'd have to change all of those numbers. That's right.

0:50:38.526 --> 0:50:47.942
<v A>The assembler does that work for you. But other things—um, so sometimes they're called jumps; the other thing is a branch. So a jump is kind of always done. You always jump to a new location, right?

0:50:48.010 --> 0:50:55.739
<v B>So an example of a jump would be like a return, and C corresponds to a jump part of a return. Yeah, yeah, that's right. So like if you

0:50:55.739 --> 0:52:54.740
<v A>had a void function and you're returning, that would just be a jump. Yep, and it would jump—that actually like it's confusing; we'll ignore that for now. Um, but yeah, so a jump just kind of goes there wherever you tell it an address, and it just picks up—it changes the instruction pointer to that new address and picks up from that point and just starts going right. The other option is a branch, and so a branch basically like the word implies takes one of two paths, and those two paths are normally based on some sort of conditional. So you could have 'branch if equal,' 'branch if not zero,' 'branch of zero'—these kind of instructions. And depending on your processor will depend on what you have, but for instance, if you say 'branch if not zero,' then what you can do is previously you can have something that evaluates whether or not a given number—you might do a subtraction, and if that subtraction isn't zero, or if you have something that's greater than zero, then it sets a register to have a value that you're going to key off of. And when you say 'branch if equal' or 'branch if not equal' or 'branch of zero,' then it goes and looks at that register and it says, does this register meet my criteria? If so, then I just go to the next instruction. If it doesn't, then I'm going to go branch and do a jump to some other portion of code. And that amounts to like you were saying before the 'if' block. So if you know 'if true,' right, then execute what's in this block. So it's just going to keep going to the next instruction, but if not, it needs to skip over that block and pick up somewhere else. And so those kind of make up the basic instructions that you have, and it seems really simple, almost like—you know, I don't know about you, but the first time I learned binary, it was like didn't make sense to me that you could represent every number in binary, right? It's like no, you can't do every number; there's got to be some number you can't do. And then slowly it dawns on you, wait, you can do every number. So assembly is kind of the same way where when you learn it, there are actually computers that have been theoretically proven that only have one instruction and you could

0:52:54.740 --> 0:53:13.844
<v A>write every possible computer. It's called Turing complete, that basically means you're able to prove that you can write every possible program with just one kind of instruction. But that's not necessarily efficient or the best way, but it can be done. And so with very, very few instructions, you can build all the complex things that we have in our high-level languages. Yeah.

0:53:14.417 --> 0:53:50.024
<v B>Mean just think—you know, the Java, um, you know, I guess Virtual Machine. Um, so in other words, if you're writing essentially assembly code for the Java machine, um, it just has a stack; it doesn't even have registers, just as a single stack. So I guess in a sense as infinite registers, but basically you can only look at one register at a time. Yeah. So and that is able to do anything that you can code in Java, which is as we've talked about before, which is—you know, just just about anything. Yeah. Um, that you've seen on the computer can be done in

0:53:50.125 --> 0:54:46.099
<v A>Java, and all of those design choices have trade-offs with them. Um, engineering is all about making trades. It's about understanding there's no one right answer; that it's about understanding the choices you make. And part of programming—throwdown what we're trying to do is say that there's all these different languages and they all have their advantages and disadvantages, and help you understand better what those are and help you make the intelligent choice. So for instance, the difference between CISC and RISC. You might say, 'Well, why is there a reduced instruction set? Why doesn't everybody just provide as many instructions as possible and make them really efficient?' But when you do that, your processor becomes more complex, and it's also harder for the processor to do certain optimizations where if it's RISC, instead of spending all those extra um transistors trying to implement these complex instructions, you can have it be smarter. So take a few instructions and work with them more intelligently and do things like reordering them and stuff like that.' And so these are all trade-offs they get

0:54:46.589 --> 0:55:29.063
<v B>made. Yeah. I mean, if you can—you know, tighten the bounds on your expectations for, you know, for your instruction. So in other words, uh, if one of your instructions is, Patrick said earlier, is to sort a list that might take a long time, the bounds on that instruction might take anywhere from a nanosecond to 300 nanoseconds. And versus a RISC processor where you could say definitively, you know, every instruction is going to take one to let's say 20 nanoseconds. And so if you can tighten those bounds, then you can better predict what the future is going to look like, and prediction is key to making assembly—to making, you know, CPUs run faster. That's right.

0:55:29.299 --> 0:56:02.020
<v A>That's right. And we could talk endlessly about this. I mean, understanding assembly is understanding computer architecture, and understanding computer architecture, I believe, is key to writing efficient code. And you got to know the system you're working on. If you don't know the system you're working on, even if no matter what language you're writing in, you're not going to write the most efficient code. And you don't always have to write the most efficient code, but if you kind of take a few minutes to understand what you're working with, it's going to help you avoid, you know, doing grossly unnecessary uh things that are very inefficient, right?

0:56:02.020 --> 0:56:02.965
<v B>So what are

0:56:02.965 --> 0:56:06.070
<v A>what are some uses of? When have you used

0:56:06.070 --> 0:56:07.200
<v B>Assembly language, so

0:56:07.200 --> 0:57:08.693
<v A>Kind of the first place I learned it was in school, and when I was at the university, they talked—when we used embedded processors, so kind of Digital Signal Processors. They often don't have an operating system, don't have even something like C needs a library of code to be able to call for functions like printf or you know how to what was a for loop really do? And they rely on helper functions, right? These don't have those. And so you have to write in assembly. So we use assembly to be able to program those. We also had to learn how to design our own CPUs and design our own assembly language, and of course, we program those in assembly. Actually, we program those in pure opcodes like we were talking about. Oh wow, that's one use, and that really helps you understand what's going on. And it's that's pretty cool, but it's a lot of work. It's kind of scary. So, but kind of in the real world that's still used today, even with all the advances, there are still times when you have to use assembly because there's nothing else to use, right?

0:57:08.777 --> 0:57:29.972
<v B>And just think, you know, right now as Patrick is saying, we have the ARM processor. Which is actually the ARM processor is quite old, but you can imagine as new processors come out, somebody has to write the assembly language, you know, assembler for those processors. And that person is writing in straight opcodes. That's right. That's right. Um

0:57:29.972 --> 0:59:22.242
<v A>So, so that's kind of one option. The other reason to use it is, you know, if you want to squeeze every bit of performance out of a system, you typically will use assembly. And so one of the paradigms is important is to not optimize too early. But once you've determined this code is executed, you know, a million times every frame of my game—let's say I got to do this one thing a million times—then you want to go in and say that's slowing my system up because it's taking too long. You can go in and write that specific routine in assembly and make it just blazing fast because you're going to do things as efficiently as possible. Because for instance, instead of going out to memory, you can say, hey, how do I use my registers more effectively than maybe the compiler is able to do? Because the compiler is working at a much higher level, has a lot more things to do, and it can't be perfectly efficient all the time, right? Another thing is if you need precise timing. So if you need to know exactly how long something's going to take, you oftentimes will write it in assembly. And then we talked last week about reverse engineering, and we talked about how that if you write something in C, compile it—that's a lossy operation. That going the other way isn't going to get you back to exactly where you started. And so what one thing you can do is even if you've compiled stuff in C or C++, or even for instance compiled it into Java bytecode and reverse engineer that, if you actually look at those opcodes that were generated and write the assembly for that without going to a higher-level language—which is going to be more confusing in some ways—you can look at what the actual instructions that were generated were and begin to recover what the structure was, what was it doing? Um, how was it accessing memory in what ways? And you can actually begin to understand what the program was doing even if it wasn't written in assembly by looking at the assembly. Yeah, definitely I think.

0:59:22.242 --> 0:59:44.027
<v B>Another area where you see the assembly code is in areas that, as you mentioned earlier, that have high performance requirements. So I know if you look at the Quake III source code, I believe there's some blocks of assembly in there where they're dealing with things particular to the physics which had to be executed, possibly hundreds or thousands of times a

0:59:44.534 --> 0:59:51.739
<v A>frame. Yep, yep. And those people are really gurus. They have a really specialized task, but when you need them, they're really valuable. Yeah.

0:59:51.891 --> 1:00:00.025
<v B>And maybe we should mention you can actually put assembly in line inside of your C program, and both C and C++ you

1:00:00.025 --> 1:00:02.219
<v A>can I have actually done that before? Yes. Yeah.

1:00:02.421 --> 1:00:09.660
<v B>I think you use—I've done it once, but it's been a while. But I think you do what is it __asm that's right? That's right. And then a curly

1:00:09.660 --> 1:00:11.955
<v A>bracket and then your assembly instructions, right? So you

1:00:12.074 --> 1:00:19.364
<v B>could have a bunch of C code and then just in the middle of it, boom, here's some assembly. It's quite scary. Yeah. Um you can get

1:00:19.364 --> 1:00:23.228
<v A>into trouble, so you have to be very careful about what you're doing.

1:00:23.414 --> 1:00:36.340
<v B>Yeah, I mean keep in mind that you know the state isn't pure. So, you know, you're writing some assembly code, you might possibly break what's going on, and that's when things like volatile and so on become...

1:00:36.846 --> 1:01:30.660
<v A>Important. Yeah, you're working in a very specific niche—niche—when you're doing those kind of things, right? Right. The other thing that I mentioned that's used a lot is interrupt service routines. Because interrupt service routines kind of take the highest priority in the system. So when an interrupt happens, it has to get serviced, and you want to get in and out as fast as possible because you don't want to miss other interrupts. You don't want your program to be paused while that's occurring. So oftentimes those will be written in assembly because the object of the ISR is to basically capture what happened, store that somewhere, and then be done and let somebody else do the processing and handling for it. And so in order to make that even faster, those will often be written in assembly, right? Right. And then of course, in an operating system, many parts are written in an assembly language because you don't have the liberty of using other stuff that relies on the operating system because you're writing it. Yeah.

1:01:31.470 --> 1:01:40.448
<v B>Exactly. I mean if you're writing like the Linux kernel or something like that, yeah, you can imagine that know large parts of that are in assembly. That's right. That's right. Not as...

1:01:40.735 --> 1:01:43.553
<v A>much as you would think, but still some parts are. Yeah.

1:01:43.780 --> 1:01:52.345
<v B>Right. Yeah, I mean I guess large in the sense that like large blocks of assembly, but yeah, I mean I would say less than 10 percent of the whole kernel that's...

1:01:52.345 --> 1:01:56.277
<v A>Interesting. We yeah, we should have looked up that. That would be an interesting statistic to find, but...

1:01:56.496 --> 1:01:58.555
<v B>Yeah. Yeah, I wonder if I see... um.

1:01:58.875 --> 1:02:46.986
<v A>And so of course over time we kind of move up the higher-level language ladder, as it were. So you'll find people who have been programming for 20, 25 years remember having the only option be writing in assembly. And then as C came out at first people mistrusted it, right? Oh, there's no way it can be better than me at writing assembly, you know. And they were right, and it was not nearly as good. But then over time it became better and better, and it increased your efficiency at writing. So even though your program a C program will never be as fast as a handcrafted assembly thing—well, I shouldn't say never, almost never will be as fast as somebody who hand-coded assembly to do the same thing—but it can get close enough that for almost every purpose it doesn't matter.

1:02:47.324 --> 1:03:35.974
<v B>Right. And even if you know it's two times slower, um you know the productivity, you know one of the things that's really interesting is, you know, computers are increasing at an exponential rate, but the productivity of engineers is actually decreasing or staying constant, let's say. And the complexity of the system, the amount of code, you know, an effort that's required to build systems is increasing. Um you got a linear rate. So what what's happening? Long story short is that computers are getting much, much faster, but we humans who program them are not. And so you know if you have if you're going to program in C instead of assembly, even if it's twice as slow, if it makes you as a programmer twice as fast or 10 times as fast, it's worthwhile. Yeah, definitely. And the kind...

1:03:35.974 --> 1:04:00.342
<v A>Of idea here is if you waste cycles, it's not a big deal because in a few months it'll—it'll be well, that's the way it always used to be. Now that's changing today, but um still it it's still kind of in effect at some level that don't worry about wasting cycles because if it's something that only gets executed once, it's not a big deal. But like we said, but if it's something that get executed, you know, many, many, many times, um then that might be something you want to look...

1:04:00.882 --> 1:04:08.965
<v B>at, right? And systems nowadays are getting so complicated that you know a lot of the times speed ends up coming down to just algorithmic decisions.

1:04:08.965 --> 1:04:23.258
<v A>That's that's right. That's right. Yeah, sometimes changing the—in other words, if you hand-code Bubble Sort in assembly, you probably still won't necessarily be able to beat a person who codes Heap Sort or Quick Sort in C or C.

1:04:23.444 --> 1:04:29.080
<v B>Plus plus, right? Exactly. Yeah. So understanding the algorithm part is important as well. That's definitely true.

1:04:29.114 --> 1:04:38.530
<v A>That's often—that's often overlooked. People just pick an algorithm and then they just kind of assume that's what they're going to go with, and then they just try to make the algorithm as fast as possible instead of considering changing algorithms. Yeah. Yeah.

1:04:38.935 --> 1:05:27.700
<v B>Definitely. So it's—we've sort of hinted at this, but you know, the strengths of Assembly language are that you have complete control of the hardware. You're not coding to any virtual machine, as in Python or Java, and you're not relying on some expensive and lossy and—and—sort of somewhat, you know, bloated with respect to hand-coded Assembly. A bloated compiler like C or C++. You know, you directly know what's going on with the memory and the processor, and you can very accurately, you know, estimate the timing of a certain block of Assembly. And it really sort of makes you one with the hardware. Your zen with the hardware is much increased. Yeah.

1:05:27.700 --> 1:05:34.943
<v A>Even if you don't go write all your code in Assembly, if you know Assembly for a given processor, it's going to help you write better C code for that processor.

1:05:35.179 --> 1:05:50.789
<v B>Right. That's right. I mean, if you know that the processor only has, you know, one register or two or a handful of registers, then that might change the way that you handle memory on your system, and you might try and do things in a more data-independent way. Okay? That's right.

1:05:52.240 --> 1:06:13.700
<v A>But it does lead to a bunch of weaknesses. Well, not a bunch. One is just absolute tediousness. If you had to write a large-scale program—you know what? Might be a 10,000-line C program in Assembly. Oh, it would be ridiculous and very, very hard to maintain. And I'm not saying that nobody has ever done it, but it's just the maintainability is a lot.

1:06:13.700 --> 1:06:49.750
<v B>Worse. Right? I mean, just think of this simple expression: X equals Y. Well, in Assembly, you have to find where Y is in memory. You have to load that into one of your registers. You'd have to load X into—or actually let's say it was—sorry, let's say it was X equals Y plus Z. You would have to load Y. You'd have to load Z. Then you'd have to perform the add operation and put that result in a new register, and then you have to put that register into X. So I mean, all these different instructions for something that's just five or six characters? And see, that's right. That's right there.

1:06:49.969 --> 1:06:56.719
<v A>Can be a very—and that's for a simple case. That's if they were all native integers to that machine, right? That's right. If

1:06:57.107 --> 1:06:58.002
<v B>X and Y

1:06:58.500 --> 1:07:13.274
<v A>Are classes or shorts or something else. Yeah. You got—oh yeah, if they're like characters, you have to do all sorts of masking right as well. So yeah. Yeah. So tediousness. Um the other thing is it's basically the antithesis of portability. Yeah. That's right.

1:07:13.898 --> 1:07:17.577
<v B>You can—the code is coding for that one CPU.

1:07:17.796 --> 1:08:55.739
<v A>Yeah, for and now I should mention that if you, for instance, code for a Core 2 Duo processor, which is an Intel x86 architecture, what that x86 architecture that you hear people talking about, and the ability to run executable on one Windows PC and on another Windows PC or a one MacBook and another MacBook that may have different specific processors but they're in the same family that has to do with the fact that they have the same opcode—that x86 family is the same set of opcode instructions. So they're binary compatible with each other, right? Yeah. Oh, and that actually brings in a lot more, but we'll skip it for now. Now I did want to say as far as if you're interested, I wouldn't recommend Assembly as the first language you learn, but I definitely do recommend it as something to at least spend a little bit of time with and learning because it will teach you a lot about how a computer really works at the lowest level. But you don't have to learn on a complicated machine like an x86 instruction set or an ARM instruction set. They actually have toy languages and toy—I don't mean they're in a demeaning way, but very simplistic CPU architectures and assemblers that will work for those so that you can practice on a, you know, four-register eight-bit CPU that you know has only like two or three instructions and practice moving stuff around. And actually, they'll have the simulator—will show you where the instructions are moving, how the processor is executing, and that. And that's a very informative and enlightening thing, and I don't have any right now to recommend. They're all out there if you just search around for them. You'll find them. And yeah, that's something I recommend.

1:08:55.739 --> 1:10:16.580
<v B>Make a shameless plug for an open-source project I work on called MAME, which is a multiple arcade machine emulator. And what MAME does is, as the name suggests, it emulates the processors that were used for just about any of the arcade machines that were from all the way from Pong all the way up to around the mid-'90s. So you can go into any of these processor drivers and what you'll see is a software assembler. So you'll see something which can read in the assembly language for that processor and convert each of the opcodes into or represent each of the things in C. So, for example, the command that loads a variable from memory to a register—if you look at the main source code for any one of those processors, what you'll see the load instruction do is it will just essentially copy the variable from one location to another because it's all done in C. So, in other words, someone has written a C emulator for the machine, and you can sort of get a feel for what assembly looks like and what an assembler does by looking at that source code without having to actually mess with x86. Yeah.

1:10:16.580 --> 1:10:22.544
<v A>Because if you start writing in assembly, you can definitely cause very easily problems to happen on your computer.

1:10:22.712 --> 1:10:24.501
<v B>Oh yeah, definitely. So and there's

1:10:25.176 --> 1:10:56.969
<v A>Also a lot of good books because the way, like I said, this is the only thing people used to have. Now we have many choices of programming languages. You know, 20 years ago you didn't have as many, and so there's a lot of learning material out there, a lot of good books that are written. And then you know, a lot of people—and I think I'm one of these people—I think that if you really want to be really good at writing programs at some point, you're going to have to learn assembler, even if you never write a real program in assembly for your work, for your job. Understanding is going to be invaluable to helping you write good

1:10:57.255 --> 1:10:58.167
<v B>code. Yeah, for

1:10:58.167 --> 1:11:02.487
<v A>Sure, not that I'm fussing at you Jason for not having done that before, but well,

1:11:02.487 --> 1:11:08.039
<v B>You know, to be fair, I did it in college. I've just completely forgotten about it. Oh, okay. You need to

1:11:08.039 --> 1:11:13.017
<v A>increase it from counting on one hand to counting on all fingers and toes at least. Yeah.

1:11:13.962 --> 1:11:16.257
<v B>I guess that's true. I guess that's true.

1:11:16.476 --> 1:11:29.504
<v A>So but yeah, I definitely encourage you guys all assembly. It's kind of a—and it's not a specific language, but it is this, you know, kind of a group of languages, and it definitely has a lot to offer, and it's something good in everybody's toolbox. Yeah.

1:11:30.044 --> 1:11:36.186
<v B>For sure. Definitely knowing about assembly will give you insight into how your computer works. That's never a bad thing. That's right. Well,

1:11:37.840 --> 1:11:42.767
<v B>Do you have anything else? Sir? I think that's it. So I hope so. Oh, go ahead. Oh, I was just

1:11:42.767 --> 1:12:05.177
<v A>Gonna say thank you for those of you writing reviews. I saw we had a couple more, so I definitely thank you for that. We're very grateful for you guys are saying really nice things. It helps us keep going knowing that you guys are out there enjoying this and tell your friends about it. Email some people, get your parents to listen. You know whoever. We don't really care one and all welcome to the Programming Throwdown, and learn something. Yeah, definitely.

1:12:05.987 --> 1:12:17.142
<v B>We did get an email. We got fan mail. Let's see if there's one that was like particularly interesting. I'm pulling up the Programming Throwdown right now. All right.

1:12:18.087 --> 1:12:43.230
<v A>Yeah, and so if you again want to check out our website, it's programmingthrowdown.blogspot.com. So feel free to go there. We post show notes, the links to the news we talked about, and kind of a summary of what we discussed about the programming language, and also a link to the download, which obviously you've already found because you're listening to this. Or of course, you can subscribe to us on iTunes and get it that way. Whatever works for you.

1:12:44.429 --> 1:13:21.807
<v B>Yeah, we got a mail from Justin. We probably shouldn't give away his last name. Yeah, that's because I hate when people do that to me. But yeah, just wrote to us. He said he wanted to hear some more about network security, which is—I you know, I've never really gotten into network security, but you know, I have a lot of friends who are really into like cryptography and all that stuff, and it's one of those things that you know I don't understand personally, but I know a lot of people who are allured by network security. So we will definitely try to talk about that, and there's definitely more that we can say about that. Yeah, I know he asked.

1:13:21.807 --> 1:13:32.084
<v A>To talk about malware analysis and talking about assembly this week. Definitely is something that if you're going to do malware analysis reverse engineering, you have to know Assembly. Yeah, I—

1:13:32.573 --> 1:13:42.985
<v B>Mean all these guys who write, especially these trojans that automatically infect other executables and things like that. Yes, they're definitely doing that at the Assembly level. Yeah, those—

1:13:42.985 --> 1:14:02.594
<v A>guys who write self-modifying code because like I said, you know instructions are just some other place in memory so you can write code that modifies itself. And some modern operating systems prevent you from doing that for good reason because most of the time if you're doing that, you're a virus. Right? But yeah, it's like you can write code that modifies itself on the fly.

1:14:03.589 --> 1:14:42.980
<v B>Yeah, well thanks Justin for writing. And yeah, if anyone else has any more comments or anything else that they want to tell us, send us an email at programmingthrowdown@gmail.com. All right. Well, I think that's a wrap till next time. Have a good one guys. Okay, the intro music is Axo by Binar Pilot. Programming Throwdown is distributed under a Creative Commons Attribution-ShareAlike 2.0 license. You're free to share, copy, distribute, transmit the work, to remix, adapt the work, but you must provide an attribution to Patrick and I, and ShareAlike, and kind.

