Deno First Look Installing Deno & Deno Basics
Transcript from the "Installing Deno & Deno Basics" Lesson
>> So we've taken a look at, and, in fact, spent quite a bit of time talking about the philosophical ideas behind Deno. I didn't cover all of them. I just covered the ones that I felt were most applicable to why Deno is the way that it is. And try to lay some ground work for how Ryan sees things.
[00:00:18] I highly encourage you to watch that video because I don't wanna speak for Ryan. I tried to summarize his ideas and show you how it plays out, but really you should listen to it in his own words. Okay. So, installing Deno it's one commands, cURL or PowerShell, your choice.
[00:00:38] We're not gonna regurgitate the docs here today. I'll let you do that on your own. It's not a very hefty install, it should be relatively quick. But once you have Deno installed, then we can start by taking a look at the rappel. So let's do that. Rappel stands for run, what does it run execute, run in print loop.
[00:01:04] Yeah. Yeah, I always have to look that up. So let's do that. So let's just hit Deno and then that's gonna put us into the rappel and you can see where Deno 1.6.1. And actually it just came out. In fact, I showed up yesterday to tech check. And [LAUGH] I saw that the version of Deno had changed.
[00:01:21] So it's changing rapidly, but it is considered stable in so much is like the main API isn't going to change on you. Which is good. Okay, so inside of the rappel we can do something simple like console log. Hello World. There you go. And you'll notice that like, we get syntax highlighting, which is kinda cool.
[00:02:06] So we could do function hello, take a name. And then when you open this brace like it just knows not to execute it knows that you're gonna do a multi line here. And then we can continue and just log out name. And then when we close the brace, it will exit.
[00:02:23] And then we can call this function, right? And pass in, let's pass in World, right? And then, it just says world. It's just echoing back whatever we pass in. So that's the Deno repple. The node repple by the way, Ctrl D to exit does the same thing. One of the big differences in the node repple is that the node repple has this thing called editor where you can just type dash dot editor.
[00:02:55] And then you're in this multi line editor mode where it's the same kinda thing or it's like function Hello name. But you see you're not getting the syntax highlighting which is strange. I guess Deno's doing that. But it's not gonna until we actually, it says Ctrl Ctrl + D to exit, yeah, and then undefined and then we can actually call this function.
[00:03:22] But Deno doesn't have this idea of this editor mode. But it doesn't matter because honestly, we don't spend a lot of time in the repple. I don't know that any of you have I don't I have been coding for 15 years. I don't hang out in reppels just know that that's the repple is there, that's how it works.
[00:04:03] And Deno, it actually says on the website what is written in but it's more fun to go spelunking into their repo. So let's do that and go into the core on Denos repo and look at these files here and you can see they have .rs extension and these are rust files.
[00:05:25] As he says he was obsessed with it. And so this idea of highly performant HTTP systems. And so the question then becomes, what is the difference between Deno and node? And so this is from their own benchmarks here, and in fact, we might wanna take a look at it just in case it's been updated.
[00:05:43] And you can see all the relative disclaimers about bench, it has been updated okay. This is execution time. Let's get down to what I really wanna look at is HTTP Server Throughput. And so you can see here it's kind of hard to tell because a lot of the colors are the same but that blue line at the bottom, the very bottom, that's Deno's HTTP performance.
[00:06:10] And that green line that's just sort of like hovering above it. That's nodes HTTP performance. And so you can see that node is more performance than Deno is currently in terms of HTTP requests. And that's something that people will tend to point out about Deno's that it's not as performant.
[00:06:31] But it looks to me, just as a casual observer and not an expert in performance metrics or HTTP systems that, that difference is kind of small, right? It doesn't appear to be extremely large here between the blue dot and the green dot. Also, those of us that are writing programmes, we are probably not building systems that are that concerned about performance to where we would say, well, I can't use Deno because it's simply isn't performant enough.
[00:07:06] But it is important to note that as of the time of this writing node still faster in terms of being an HTTP server. Also, I wanna know what Hyper is. I didn't even know what this is. I tried to look this up, but whatever this is, let's do that.
[00:07:21] Look at this line. Looks amazing. She sees that.