Programming Throwdown - Assembly

Episode Date: May 21, 2011

This show covers Assembly, the lowest level language used to program a computer. This episode talks about the amount of traffic Netflix is generating, how many ebooks Amazon now sells, Apple ...not standing up for its developers, how young is too young for facebook, working on open source projects, and a new tool called Hype. The tools of the day are FileZilla, a cross platform ftp client, and PuTTY, a Windows SSH tool. ★ Support this podcast on Patreon ★

Transcript
Discussion (0)
Starting point is 00:00:00 programming throwdown episode number six assembly take it away jason hey so i'm here in the valley now which is uh silicon valley which is it's an amazing place Take it away, Jason. 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 um so it's it's kind of a i don't know it's sort of a it's 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 uh you don't think that these websites like like 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 like makes it all like very opaque so now when you go to those websites do you think of their actual building instead of the website yeah yeah exactly like now
Starting point is 00:01:23 it's like it almost like there's two faces. There's the physical manifestation. And there's still the website. There's the LinkedIn building. Which is like this red brick. Kind of like old looking building. With a bunch of oak trees. And then there's the website.
Starting point is 00:01:39 You can't help but conflate the two concepts. Huh. Yeah. It's pretty nuts. So what have you been up to lately yeah um pretty much the same stuff as as always uh it's been really hot here so you left just in the nick of time i guess and uh it's uh it's been really brutally hot and terrible outside and so uh that's been kind of interesting it's doing a number on my grass so uh oh yeah yep um but i shouldn't complain anyways it's nice to have a yard but it's a pain number on my grass so uh oh yeah yeah um but i shouldn't complain
Starting point is 00:02:05 anyways it's nice to have a yard but it's a pain a lot of work and yeah when we got here it uh it actually rained and it was overcast for the first week or so and people were just in shock because i guess it doesn't rain between you know april and and november or something like that and uh but yeah now it's starting to get sunny, which is kind of nice. Yeah, awesome. Yeah. All right, well, I guess we'll go to the news. So the first news item I see here is that Netflix is now the single largest source of
Starting point is 00:02:34 internet traffic during prime time in the United States, I guess that is. So that would be, what, like 6 to 10, which is when most people sit down and watch TV. Instead of watching their TV, they sit down and watch tv instead of watching their tv they're watching cable or instead of watching cable they're watching netflix yeah yeah exactly something like what 30 percent of the entire traffic on the internet is netflix yeah that's pretty crazy now a while ago my wife and i canceled uh 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 uh other than that we watch all of our video online and i've
Starting point is 00:03:11 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 uh yeah i'm a big proponent of this yeah i i just uh you know as part of moving i made a commitment to uh 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, you know, 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.
Starting point is 00:03:40 I noticed that there's a lot of especially newer newer movies, that you can only get on DVD. Do you know why that is? Yeah, so it has to do with the licensing. So the studios don't want to let Netflix carry it right away or as soon streaming as releasing DVDs because they don't want it to hurt sales or whatever. And then also they're hesitant to let Netflix to have some movies because they don't think they're going to make as much money or whatnot but there's yeah getting more and more yep sorry oh no i just i feel like uh you know we really have to sort of redefine like art and the value of art and and the value of like artistic contribution in light of technologies that can
Starting point is 00:04:21 duplicate said art for free. Yeah. Well, the only thing that I really miss going this way is between Netflix for movies and older TV series and then using a website like here in the United States we have Hulu, which is a lot of the big networks shows go on there. The only thing I really missed is 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 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 subset of the channels for free that's right that's right i
Starting point is 00:05:06 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 a hundred dollars a year i wonder if you can get that without cable television um normally not they that's called a la carte pricing and at least in the united states the cable providers have been hesitant to go to a la carte 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 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 way.
Starting point is 00:05:48 Oh, gotcha. Yeah, so I see that Amazon has actually reached that threshold, that crossover point, to where they're selling more e-books than hard copy books. I think that's fascinating. Yeah, there was a lot of buzz about this on the internet when this story first hit, and people were kind of confused about exactly what did this mean. Oh, and Amazon must be not counting all of their physical books, like just counting paperback books or just counting hardback books. And then they must be counting on the Kindle side the free books that people download on the Kindle.
Starting point is 00:06:22 But Amazon came out and said this does not count 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 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 yeah i mean this 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,
Starting point is 00:06:57 with the movie industry and with the book publishing industry, that the middle people are sort of getting completely cut out of the loop. You mean the middlemen, the people who like go between them? Right, like in the case of Amazon, the people who, you know, publish and bind the books. And in the case of Netflix, you know, the people, the cable companies who broadcast, you know, the video content, both of those people are getting cut out of the loop in the modern internet era. Yeah, and actually,
Starting point is 00:07:27 they're very quick to point out that fact and that 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, you know, trying to carry along what amounts to dead weight, you know?
Starting point is 00:07:42 If they don't have a place, it's kind of like when we, and this the probably cliched and probably not actually accurate but um you know when automobiles first started coming about and the people who sold whips for the 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 there 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 you know screwing over their
Starting point is 00:08:19 customers to try to get every last penny out of the few who stay with them yeah exactly i remember reading something in uh um you know historically in the 1940s 1950s as women were beginning to get suffrage and get and become part of the workforce and things like that that people were complaining that oh now you have this this surplus in the workforce and it's going to force, you know, drive wages down for everybody and things like that. But looking back on it now with, you know, with our advance in sociology, you know, no one would take that away, you know, and say that women shouldn't be allowed to work as was the case, you know, 100, 150 years ago. So I think that it's similar here where we're getting this pushback because there's this dogma or this or this you know people have been entrenched in their in their core business but uh you know 50 100 years from now we'd probably just we wouldn't want to look back to to this day yeah and i mean it's
Starting point is 00:09:17 it's one of those interesting things where it's a few people you know 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 you know cut you out like uh is 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 you know which i'm 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.
Starting point is 00:09:56 They just want to be able to buy what they want cheaply and quickly when they want it. And so, you know, that's why it doesn't seem like they're shouting very loudly. But they actually do care. They just don you know 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 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 and uh you know the cable companies i mean the the uh ucf university of central florida arena is called the bright House Stadium for a reason. Yeah, which I guess we should explain to people who don't live in the region that that is because
Starting point is 00:10:30 they're a local cable provider. Right, that's 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. Yeah, well, everybody's got their right. If people are willing to pay that, there's nothing to stop them from charging that. Yeah, definitely. People seem happy to pay that. So you put an article in here about apple trying
Starting point is 00:11:06 to go after individual app developers or not other people going after individual app developers right so basically you know one thing that's been sort of pervasive in the news recently has been 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 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 bridge. Basically, a patent troll is somebody who,
Starting point is 00:11:41 a business, a corporation, who does not have a, you know, profitable endeavor, does not, you know, typically, you know, isn't a big player in any particular arena, but, you know, has acquired either through, you know, their own developers or through purchasing it from another company, has acquired, you know, 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 and open-ended patents in an attempt to earn money. 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.
Starting point is 00:12:35 It costs less for them to settle than to pay the legal expenses to defend them even if they win. Right, exactly. they win right exactly um but what's happening is you know a lot of these companies have entire legal teams you know apple google microsoft all these big companies have a whole team of legal uh enforcers who can uh you know 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 is often a small startup or a five, six-person company, knowing that they don't have adequate legal representation.
Starting point is 00:13:35 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 it lets you buy items from while you're inside a particular application. And apparently that violates some patent from this company, Lodsis. So Lodsis 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 you know apple really should engage their legal team to go after some of these patent trolls because otherwise people won't develop for the platform
Starting point is 00:14:18 yeah i mean i guess this is something that is gonna have to be handled by our legal system that 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 you know 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, you, like you said, you can go make an app and, you know, have 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, you know, we're going to charge you $5,000 because you made a thousand dollars
Starting point is 00:15:02 using our patent, then you're just going to have to close up shop because you can't afford to pay that right and i mean just to draw an analogy of how ridiculous this is imagine if you are really into model planes and you buy you know and you assemble model planes and you sell them in your store and you can sell assembled and unassembled etc and somebody you know and you're just 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, et cetera, to power the plane. And you'll you'll assemble the plane and then sell it at your store. And let's say that that kit, you know, the wing assembly is violating some patent. Well, the company that sold you the kit ultimately you know in my opinion should be responsible yeah but it's like now what they're doing is going after you for just
Starting point is 00:15:52 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 lotsodsis 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, and it looked like this article from the Electronic Frontiers 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. It's really funny to see an article where the EFF, you know, just I guess in this case, they're not really siding with Apple. It's more like they're trying to drive Apple to to do something.
Starting point is 00:16:43 But, you know, the EFF practically hates Apple. It's more like they're trying to drive Apple to do something. But, you know, the EFF practically hates Apple, right? 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 this world, in the digital world. So talking about the way things are changing, you know, I saw an article saying that Markuckerberg 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 and 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
Starting point is 00:17:30 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 and uh to me it's kind of uh 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 uh that now we have to think about that you know if we're gonna have kids what are we gonna tell them to do like if they want to about that, you know, if we're going to have kids, what are we
Starting point is 00:18:05 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 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 uh you know an adult the adult version of facebook and so you know as long as there's the correct parental supervision uh you know built into like controls yeah parental controls yeah controls and even more so uh i guess i don't know what the
Starting point is 00:18:42 word is observation maybe like maybe you can see all the profiles that your 12-year-old has clicked on or something like that. Then yeah, I think it would be great. I mean, Disney already does this, right? There's several Disney massively multiplayer games like the Pirates of the Caribbean MMO and there's a couple other ones. I can't think of them off the top of my head. Oh yeah, I've seen it. Some weird Cartoon Village one or something I saw off the top of my head. Oh, yeah, I've seen it. Some weird cartoon village one or something.
Starting point is 00:19:07 I saw an advertisement on TV for once. 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, they had a little demo where you could jump on and play. 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
Starting point is 00:19:30 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 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 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 i said just as long as if maybe the parents have the option to be able to observe right and this really gets that sort of uh 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
Starting point is 00:20:17 little privacy you have um on the internet you know some people think oh if i post something and uh 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 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
Starting point is 00:20:58 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've 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 copied and pasted it somewhere else, taken 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,
Starting point is 00:21:33 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 it's like what does it matter like he can't can you send us back it's like you know i can't send you back the cds i can sure i can delete it off of a computer it's been copied out on bit torrent to thousands of people like yeah leading off my computers isn't going to change anything yeah i mean it's extremely true there's a time when uh i was using live journal a lot and uh i was posting about something about it was something that was it wasn't offensive or anything but it was very trite like something
Starting point is 00:22:10 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 adjacent 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 if some American history buff software engineer interviewed me, that it just wouldn't go over well. So it is true. Especially as this article draws our attention, if you're a 12-year-old, you really can't think about the permanency of what you say. Most 12-year-olds just don't have the maturity to do that. So, yeah, Facebook's going to have a tough time. But if they can create an environment that's safe and regulated and easily observable, I think that could be a positive thing.
Starting point is 00:23:04 All right. So I see an article here about open source preparing students for better careers. Yeah, I guess this is one of those no duh articles. Yeah, that's right. But I thought this was interesting. I put it 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, you know, learning how to communicate, learning how to work on big projects and planning out with that. And, you know, in general, it talks about, you know, 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,
Starting point is 00:23:33 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, you know, 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 know, programming is it really is 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.
Starting point is 00:24:13 But unlike those, you know, secret trades of, you know, 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, you know, as we talk about batteries included, like Python has a Zlib compression built into the language. But, you you know many languages like C++ and Java low-level the 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 you know like if I want to do cryptography let's say if I
Starting point is 00:25:02 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, you know, 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, you know, 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.
Starting point is 00:25:58 You know, in a similar way, you can dive into an open source project and end up learning a tremendous amount about programming and especially about you know getting stuff done and you can give yourself a tremendous amount of power to do some amazing applications yeah and 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 is 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 are probably better suited to this than others some are you know kind of notoriously i don't want to say mean or hostile but you know kind of expect you to know a lot when you get there and others are more welcoming and um even this article
Starting point is 00:26:42 mentions the google summer of code which is specifically targeted at students. Google pays that student to work on the open source project. And so those projects create, you know, set tasks for the students to work on. Yep. Yeah, those are definitely awesome. I know several people have participated in that. And 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 part of the Summer of Code.
Starting point is 00:27:18 And if you have a particular project, that's especially engaging. And those people are often very helpful and they want, you know, a lot of those people who are, you know, 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
Starting point is 00:27:42 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. Yeah. So what is this hype animation creator? Yeah, so 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,
Starting point is 00:28:18 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 $2,000. And even, I remember as a student looking to get it, and it was several hundred dollars, even for the student edition. So, you know, and plus Flash, you know, has other issues as security vulnerabilities and, you know, 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, you know, 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, you know, WebGL rendering.
Starting point is 00:29:13 So you get to the... Does it use WebGL or does it use the Canvas? So it uses Canvas now. They're looking at making it support WebGL, which would give it the hardware acceleration that Flash has. basically this hype is where flash you know was when it was 1.0 and it was saw software rendering etc 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, you know, I want the object to be, you know, at position X at time zero and at position Y at time one, you know, and at time 0.5, it's the midpoint of X and Y.
Starting point is 00:29:55 So it does the tweening, it does, you know, 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 is a free program, a pay program? No, but it's relatively inexpensive. It says here it sells for $30. Okay.
Starting point is 00:30:16 So I haven't used it, but I'm thinking of buying it and trying it out. Yeah, well, I guess let us know how it works. It sounds kind of cool. Yeah, I think I i'm gonna buy it and uh if if it's good you'll see it as a as a tool of the buy week some weeks speaking of tool of the buy week yeah so uh so what's your tool of the buy oh you beat me to the punch what's your tool of the buy week this i guess I have to say my tool of the bye week is FileZilla, which has nothing in common with... That sounds like the thing that defeated Tokyo.
Starting point is 00:30:53 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. I don't believe they have anything in common. I don't think the communities are in common or anything. FileZilla is not to be confused with Mozilla. 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, but the UI is very slick. It has drag and drop from outside the window, so you can drag from Finder on a Mac or from
Starting point is 00:31:18 Explorer. You can 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 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 it now filezilla is both an ftp server and an ftp client right oh did i say server uh i think you said you were saying client and you were talking about
Starting point is 00:31:57 yeah i don't think is it a oh yeah it is a server you know i've actually never used the filezilla server well just because that can be confusing when you go to the website. Because 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, so I actually get it. You know, I'm a big, you know, Mac slash Ubuntu Linux fan.
Starting point is 00:32:22 And in Mac, you can get it through Mac ports. And in Ubuntu, you can get it 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 yeah, the FileZilla, it looks like the server is only for Windows, which is interesting.
Starting point is 00:32:40 Okay, yeah, yeah. But yeah, the client is very effective and I'd highly recommend it. One interesting thing too, it has like an auto-updater interface, which is pretty slick, even on Windows. 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 Nullsoft Scriptable Install System.
Starting point is 00:33:04 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 GNU license in like a little install shield and you click next and it's like the directory install too you click yeah we talked about this last episode in association with over-the-air updates from apple and whether things are on the side or not. Yeah, we talked about it. So FileZilla actually has a nice auto-updater, and I just hope maybe I might lift it or something. So we'll see. Yeah.
Starting point is 00:33:34 So my tool of the bye week on the notion of, I guess, doing networking tasks is Putty, which is a Windows tool for doing 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 to do various features like secure copying, SCP, and stuff like that. And this is kind of... So can I take this and put it on my walls to fix cracks and places where I've nailed
Starting point is 00:34:02 things to the wall? Sure. I'm sure it's probably good for that. It is a pretty useful tool. But no, I would not try to get it to seal any cracks in your house. That's probably not a good idea. And I also wouldn't try to stick it to a comic in the newspaper and make it have the image of it like Silly Putty.
Starting point is 00:34:22 Sorry. Okay. Anyways, yeah, but this tool is really good at connecting to ssh stuff on windows uh 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 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 able to even do setting up proxy tunnels and stuff like that so you can tunnel SSH traffic through it to another computer and do all sorts of interesting things
Starting point is 00:34:55 like that. So it's really powerful, but just 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 it or have never done it before, if they don't know about this, they'll either quickly find it out
Starting point is 00:35:11 or if you tell them, they'll be really excited they found it. Yeah, yeah, definitely. So I think if I remember right, there's Putty, which is sort of a little bit more full-featured. There's also Plink, right, from the same company. I don't know i think yeah okay um yeah they do have it looks like it i see plink on here on their website so yeah i think plink is sort of more like a scriptable um version it's not as full-featured but it's sort of it's a
Starting point is 00:35:40 lightweight version i guess of putty but yeah they're both excellent programs for anyone who's on Windows. Yeah, and it's open source and everything, which is important to note. Whenever you're dealing with security, it's always a kind of 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 for vulnerabilities yeah so today uh this show we're going to be talking about assembly yeah and like assembly lines uh yeah it's kind of like uh have you ever had to do community service at the soup kitchen
Starting point is 00:36:25 and, uh, 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 I can probably count on one hand number of times I've seen assembly code. Really? Wow. That's kind of sad, Jason. Yeah. So, yeah. So assembly, you know, kind of sticking with our little format here, the history of assembly kind of is the history of programming, I guess.
Starting point is 00:37:07 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 Sharp. Right, because those languages, as we talked about in the past, like Python runs on a virtual machine. But if you want to know what runs on the actual machine, it is assembly language. Well, actually, not quite. So this is maybe a nit, maybe something that's really specific
Starting point is 00:37:42 and nobody pays attention, just it's semantic. 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, a number, a hex number that represents move, which moves from one register to another register, address and RAM to 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 kind of has to do with what's called mnemonics,
Starting point is 00:38:28 which is kind of reassigning a name for something else. And so instead of having to remember that you have to type, you know, F-A for move, now it can just have the letters M-V or M-O-V, 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. But what that does introduce is the need for an actual, what's called an assembler,
Starting point is 00:38:54 which is kind of like a compiler, but a lot simpler, in that even some languages, the assembler can be one pass instead of many passes, which we've never talked about that before. But 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. It has to figure out what the register names are.
Starting point is 00:39:26 And it kind of converts all of those things to offsets and to numbers. And then the second pass, it actually does almost like a transliteration just from the instruction to the hex code. 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 are a few instructions when you get down to that level? Like what are some typical
Starting point is 00:40:00 instructions? So typical instructions... I mean, could you do like is can you do like sort a list is it like calling a function where you do a bunch of things or well so no but sometimes and this is a very unique quirk of uh 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 is the lowest and you kind of go up to like c and then to c plus plus and there's something above that maybe java or python um 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
Starting point is 00:40:40 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 power PCs, older computers might run on alpha processors or even like the android phones are using arm processors and actually the iphone does as well uses an arm processor those all those processors have different completely different instruction sets and so the assembly language and the the routine supported the instruction supported can vary greatly between those. For instance, that on one, the way that an instruction is done, if you say have a move and you want to move from one
Starting point is 00:41:31 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've got to 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 C-I-S-C, which is complex instruction set computer. And then a RISC is a reduced instruction set computer. And so originally the CPUs were very basic
Starting point is 00:42:08 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. And then as they grew, they become more complicated to support things. Even like you were talking about, like you may have a single assembly instruction
Starting point is 00:42:23 that allows you to sort an array or an array of like eight numbers 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 so maybe we should talk a little bit about since it's particularly relevant to this this show the difference between registers and memory i don't think we've ever explained that no yeah that's a good point so uh do you want to take a shot at that or 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 from what i understand uh you know everyone knows
Starting point is 00:43:01 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, 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, you know, the operating system, in this case Windows, gives Office a certain amount of memory. 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 put numbers in there and put your Excel spreadsheet in there, etc.
Starting point is 00:43:43 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 the memory is, it takes an 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.
Starting point is 00:44:24 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 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 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
Starting point is 00:45:02 registers you may only have like you said 32 they're normally in powers of two so like 16 or 32 registers 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 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 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 and this was an illustration that helped me when i was learning about computer
Starting point is 00:45:53 architecture but um the processor today run at a couple gigahertz and if you think about uh the frequency of one gigahertz in one cycle. So that gigahertz measures how many times the computer's clock ticks up and down per second. So a one gigahertz computer is, 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 counts.
Starting point is 00:46:21 And so 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 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 in time right so remember patrick's analogy has to do with light but in this case we're dealing with electricity and the speed of
Starting point is 00:47:00 electricity is significantly slower that's right that 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 process or all the way out to main memory. It's not a straight line. Right. And there's a controller, a memory controller in between the two. It's very complicated.
Starting point is 00:47:19 Yeah. So, yeah. So the registers, like you said, there's a bank of holding cells of 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,
Starting point is 00:47:45 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 in 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. And then you can have something that says move, where you might need to move from one register to another register. So essentially do a copy from one to another. 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,
Starting point is 00:48:23 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 in 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 what the opcode is, what a register is, and what the source register is, what the destination register is. And so when the CPU loads that instruction, it then has to know what to do with the instruction
Starting point is 00:49:09 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 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 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.
Starting point is 00:49:36 And that would be really 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 block of code. And so when these languages, higher-level languages, get compiled down to assembly, that corresponds to a jump. That's right.
Starting point is 00:50:02 Well, actually, yeah, depending on it, there's a couple different things. But one could be a jump that's right well uh actually there's yeah depending on there's a couple other 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 the in your file in your source code which the 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.
Starting point is 00:50:33 And that would be confusing and annoying. And if you added a new line, you'd have to change all of those numbers. That's right. So the assembler does that work for you. But other things, 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 so an example of a jump would
Starting point is 00:50:49 be like a return and c corresponds to a jump part of a return yeah yeah that's right so like if you 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 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. The other option is a branch. And so a branch basically, like the word implies,
Starting point is 00:51:18 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 if 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
Starting point is 00:51:51 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
Starting point is 00:52:32 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 write every possible computer it's called turing complete that basically 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.
Starting point is 00:53:07 And so with very, very few instructions, you can build all the complex things that we have in our high-level languages. Yeah, I mean, just think, you know, the Java, you know, I guess virtual machine. So in other words, if you're writing essentially assembly code for the the java machine just has a stack it doesn't even have registers it just has a single stack so i guess in a sense it has 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 that you've seen on the computer can be done in java and all of those design choices have trades with them engineering is all about making trades it's about understanding
Starting point is 00:53:55 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 risk, instead of spending all those extra transistors
Starting point is 00:54:33 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 that get made. Yeah.
Starting point is 00:54:46 I mean, if you can, you know, tighten the bounds on your expectations for, you know, for your instructions. So in other words, if one of your instructions, as 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 risk 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,
Starting point is 00:55:27 you know, CPUs run faster. That's right. 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'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 things that are very inefficient right so what are what are
Starting point is 00:56:03 some uses of when have you used assembly language? So kind of the first place I learned it was in school when I was at the university. And they talked, when we used embedded processors, so kind of digital signal processors, and 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 what does a for loop really do? And they rely on helper functions. So these don't have those. And so you have to write an assembly. So we use assembly to be able to program those.
Starting point is 00:56:42 We also had to learn how to design our own CPUs and design our own assembly language. And of course we programmed those in assembly. Actually, we programmed those in pure op codes like we were talking about. Oh, wow. That's one use. And that really helps you understand what's going on. And that's pretty cool, but it's a lot of work.
Starting point is 00:56:58 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. And just think, you know, right now, as Patrick was 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.
Starting point is 00:57:28 That's right. That's right. And 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 and assembly and make it just blazing fast
Starting point is 00:58:05 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.
Starting point is 00:58:24 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,
Starting point is 00:59:04 you can look at what the actual instructions that were generated were and begin to recover what the structure was what was it doing what 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 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 3 source code,
Starting point is 00:59:33 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 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, and maybe we should mention you can actually put assembly inline inside of your C program.
Starting point is 00:59:59 Have you ever done that? And both C and C++ you can. I have actually done that before, yes. Yeah, I think you use – I've done it once, but it's been a while. But I think you do, what is it? Underscore, underscore ASM. That's right, that's right. And then a curly bracket, and then your assembly instructions.
Starting point is 01:00:12 Right, so you 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, you can get into trouble, so you have to be very careful about what you're doing. Yeah, I mean, keep in mind that the state isn't pure. So 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 important. Yeah, you're working in a very specific niche when you're doing those kind of things.
Starting point is 01:00:42 Right, right. The other thing that I'll mention that's used a lot is interrupt service routines. Because interrupt service routines kind of take the highest priority in a 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,
Starting point is 01:01:05 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 exactly i mean if you're writing like the linux kernel or something like that yeah you can imagine that you know large parts of that are in assembly that's right that's
Starting point is 01:01:39 right um not as much as you would think but still still some parts are. Yeah. Right. Yeah. I mean, I guess large in the sense that like large blocks of assembly, but yeah, I mean, I would say, I mean, less than 10% of the whole kernel. That's interesting. Yeah. We should have looked up that. That would have been interesting statistic to find, but yeah. Yeah. I wonder if I see.
Starting point is 01:01:58 Um, 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 was not nearly as good but then over time it became
Starting point is 01:02:25 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 um but it can get close enough that for almost every purpose, it doesn't matter. Right. And even if, you know, it's two times slower, you know, the productivity, one of the things that's really interesting is, you know, computers are increasing 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 and effort that's required to build
Starting point is 01:03:09 systems is increasing at a linear rate. So what's happening, long story short, is that computers are getting much, much faster, but we humans who program them are not. And so 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 of idea here is if you waste cycles, it's not a big deal because in a few months it'll be, well, that's the way it always used to be. Now that's changing today, but still, it's still kind of in effect at some level that don't worry about wasting cycles
Starting point is 01:03:50 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 they get executed you know many many many times um then that might be something you want to look at right and systems nowadays are getting so complicated that you know a lot of the time speed ends up coming down to just algorithmic decisions that's that's right that's right sometimes changing the in other words if you hand code bubble sort and assembly you probably still won't necessarily be able to beat a person who codes uh heap sort or quick sort in c or c plus plus right exactly exactly yep so so understanding the algorithm part is important as well that's heap sort or quick sort in C or C++. Right, exactly. So understanding the algorithm part is important as well.
Starting point is 01:04:29 That's definitely true. 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, definitely.
Starting point is 01:04:41 So we've sort of hinted at this, but 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 somewhat bloated, with respect to hand-coded, a bloated compiler like C or C++, you directly know what's going on with the memory and the processor, and you can very accurately 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.
Starting point is 01:05:27 Yeah, 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. 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.
Starting point is 01:05:47 And you might try and do things in a more data-independent way. 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, what might be a 10,000-line-of-code C program in assembly, it would be ridiculous and very, very hard to maintain. And I'm not saying that nobody has ever done it, but the maintainability is a lot worse.
Starting point is 01:06:14 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.
Starting point is 01:06:36 Then you'd have to perform the add operation and put that result in a new register. And then you'd have to put that register into x. So I mean, all these different instructions for something that's just five or six characters and c that's right that's right there can be a very and that's for a simple case that's if uh they were all native integers to that machine right that's right if x and y are classes or or shorts or something else yeah you got oh yeah if they're like characters you have to do all sorts of masking as well.
Starting point is 01:07:07 So, yeah, so tediousness. The other thing is it's basically the antithesis of portability. Yeah, that's right. The code is not portable. You're coding for that one CPU. Yeah, 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 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 um now i did want to say as far as if you're interested i wouldn't recommend assembly as the
Starting point is 01:08:01 first language you learn um 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 there 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 for register 8-bit CPU that you know has only like
Starting point is 01:08:38 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 um 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 i'll make a shameless plug for a open source project i work on called maim which is multiple Arcade Machine Emulator. And what MAME does is it, 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. And so you can go into any of these processor drivers,
Starting point is 01:09:22 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 op codes 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 in the main source code for any one of those processors, what you'll see the load instruction do is it will essentially copy the variable from one location to another because it's all done in C. 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.
Starting point is 01:10:16 Yeah, because if you start writing in assembly, you can definitely cause very easily problems to happen on your computer. Oh, yeah, definitely. And there's also a lot of. Oh yeah, definitely. So, and there's 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
Starting point is 01:10:41 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 code. Yeah, for sure. Not that I'm fussing at you, Jason, for not having done that before, but. Well, you know, to be fair fair I did it in college I've just
Starting point is 01:11:05 completely forgotten about it oh okay you need to increase it from counting on one hand to counting on all fingers and toes at least yeah I guess that's true I guess that's true so but um yeah I definitely encourage you guys all assembly it's kind of a 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 for sure definitely knowing about assembly will give you insight to how your computer works that's never a bad thing that's right well do you have anything else sir i think that's it so i hope oh go ahead oh i was just 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
Starting point is 01:11:53 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 we did get an email we got a fan mail let's see if i there's one that was like particularly interesting and i'm pulling up the uh programming throwdown right now all right yeah and so um if you again you want to check out our website it's programmingthrowdown.blogspot.com. So feel free to go there. We post show notes, links to the news we talked about, and kind of a summary of what we discussed about the programming language.
Starting point is 01:12:33 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. Yeah, we got a mail from Justin. We probably shouldn't give away his last name. Yeah, that's fine. Because I hate when people do that to me. But yeah, Justin wrote to us.
Starting point is 01:12:53 He said he wanted to hear some more about network security, which is, 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 alert by network security and uh so we will definitely try to um you know talk about that and there's definitely more that we can say about that yeah i know he asked to talk about malware analysis and talking about assembly this week um definitely is something that if you're going to do malware analysis reverse engineering
Starting point is 01:13:29 you you have to know assembly yeah i mean all these guys who write especially these these trojans that automatically infect other executables and things like that yes um they're definitely doing that at the assembly level yeah those guys who write self-modifying code, because like I said, 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.
Starting point is 01:13:58 But yeah, it's like you can write code that modifies itself on the fly. 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 at gmail.com. All right. Well, I think that's a wrap. Until next time.
Starting point is 01:14:19 Have a good one, guys. Take care. The intro music is Axo by Binar Pilot. guys. Take care.

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