Syntax Video
HTMX is Pro-JavaScript @JSNation - Interview w/ Carson Gross
Transcript
hey what's up this is Scott tulinsky and today we're talking about JS Nation a conference going down November 18th in New York City but it's also a hybrid conference on November 21st and joining me today is Carson gross and we're going to be talking a little bit about Carson's talk that's happening at JS nation and if you want to attend I'll have a discount Link in the description below that you can sign up and by all means it's an incredible conference one of the best I've ever attended so head on out to New York or check out the remote hybrid conference as well it's really super good so Carson is an instructor over at Montana State University and that's out in Boseman can you tell me a little bit what that's like Carson being an instructor um it's good I I I like I've learned a lot about computer science you know you learn a lot more when you teach stuff and uh so one of the ironies is I I actually teach
so I dropped out of computer science at Berkeley um because I just I couldn't handle uh a class and I actually teach that same class now so and I teach it very differently I don't like the way it was taught at Berkeley but uh it's so it's really good from I mean you know I enjoy teaching I like helping students understand stuff I try I tend to I try to have a lot of visual like emulators and stuff like that because I find that helps people understand a lot of people are very visual it it is a little tough sometimes because I find myself switching between different topics I mean web development is crazy right like you got to know database CSS HTML like you know all this other stuff maybe a JavaScript library or 10 um and uh so uh that's good preparation for teaching because with teaching it's like okay databases okay like assembly and machine code like okay now web development and that you know so you can be very choppy uh in that regard but uh it's it's a lot
of fun I like my students a whole bunch uh University can be a little bureaucratic but that's just the way that it is yeah yeah you know I I I totally relate to that I think there's a number of uh web classes that I I took in college that I would love to do differently myself so yeah absolutely yeah it is nice like my compilers class same thing like I teach compilers the way I wanted want to teach it which is with recursive descent and everything you do everything by hand basically um and uh it's a it's a lot more I think it's one of these things where it seems like that would be more work but it's actually about the same amount of work and I find it teaches people the concepts much better so yeah sick well you created one of the most beloved new Js libraries HDMX can you tell me what inspired you to make HDMX um so HTM XX came out of intercooler JS which it's been around forever um I released intercooler back in 2013 and that Library it was an internal Library I was using at a startup before
that like as far back as 2011 I think and uh basically it was a JavaScript library that extends HTML so um you don't it's a JavaScript library but you don't write JavaScript to use it for the most part and uh instead you put attributes on HTML elements and that drives like a really simple Ajax basically Ajax request so just as a very basic example uh you can put an attribute like HX post on a button just a plain button that isn't in a form and have that button issue a post post to a URL and then that the response with HTM X is expected to be HTML like some partial typically a partial bit of HTML and then there's a couple other attributes you can use to specify where to put that response so I want you to you know replace this element with the response or whatever um so it's a pretty simple little concept uh like that and I just you know I was back in 2011 or 12 I
was uh there there was similar functionality it wasn't baked into HTML but there was similar functionality available in jQuery and I found that's what everyone was using back then and I found out about it and was and used it successfully in a couple projects and that's when I started creating this function that sort of wrapped up some of the behavior and then I saw angular one and the way they used attributes to drive behavior and said okay I'm going to instead of having you know having to call my library that I've built up I'm going to use attributes to drive that and then that eventually got you know I I started to understand the um the concepts around hyper media and HTML better because I especially after I open sourced it had people come and explain to me like oh this is cool this is actually real like real rest and uh so I I started to understand kind of what I had done it's another one of those situations where you kind of have to do something before you understand it yeah yeah totally so I did it and now I really have a much better understanding of it to the point I'm you know I'm
publishing academic papers on hyper media at this point so so that's sort of where it came out of um and you know I guess like at the B most base level it was just me I didn't want I kind of liked the web model of like request replace you know um and uh the more complicated stuff especially back in the day with like knockout if you remember knockout J yeah and angular um one I just was like this is too much for what I want it's more than I need and I can do most of what I want with this other simpler model and so rode that for a while and then you know when Co hit I rewrote it without the jQuery dependency intercooler was dependent on jQuery um which was fine in 2011 or 12 because every everyone yeah uh but uh you know that's JavaScript is standardized and gotten a lot better and so it was feasible to to pull that require pull the dependency out and now it's sort of
a standalone Library yeah yeah you have a I mean HDMX included has a big focus on Simplicity and that you know is using HTML forward it's it's obviously it's it's not a lot of you know handwritten JavaScript to do a lot like you said you're using attributes in it it's it's really super effective in that regard you WR a really great essay called the grug brain developer can you tell me about that essay yeah uh that was an essay I just had a friend uh I was chatting with a friend and I started just you know being like a caveman in the chat cuz we were talking about the design of something and I just started jokingly uh talking like a kman and I was like you know what I'm going to take that and just do an essay like not even an essay like I was like I'm just going to write down all the random stuff that's like knocking around in my head after you know 30 plus years of programming um and uh uh but I'm gonna do it as a caveman and I did it and I
like just as a joke was like okay I'll put it up on a website and like buy a domain for like it was like an internal joke with this other guy that I was talking with that I was working with and so I kind of put it up and he was like oh this is great this is so funny and uh and then you know I think I posted it on the HDMX Discord and someone ended up poking posting it on Hacker News and it's it's gotten more traction on Hacker News than anything like useful I've ever written like any of the academic stuff I mean it is you know I don't know some people probably don't like it but uh it is a lot of like things I've learned over time and a big you know one of the big overarching messages of that essay is like Simplicity is is like the most important thing there's an essay or it's it's actually it's part of a larger essay um if you've ever read worse is better have you ever heard of that paper so worse is better is a it's a it's a chunk taken out of a larger essay by a guy named Richard Gabriel who was a he
was a lisp developer and he was trying to figure out how come lisp lost like how could lisp have lost to C cuz you know lisp developers look at see the way maybe like rust developers look at JavaScript or something like like it's just like what is this garbage you and uh so maybe even more so uh and so his he and he he did something I think was pretty cool intellectually he was like okay I'm not just going to say no it's the people that are wrong I'm actually going to analyze why lisp lost and why C won and uh sort of the Crux part of that essay a guy named Jamie zalinski found and started mailing around and it became known as the worse is better essay and in there he talks about like different approaches to uh to software development and one the the worse is better approach uh really focuses on Simplicity Simplicity of implementation in particular and uh so Gabriel even though
he's not a worse of better person he argues that it has better survival characteristics in the long run from a software perspective so that's that that there's some influence of that essay say throughout the grug brain developer there's a lot of very practical things like you know like I'm not a huge fan of unit of test First Development and like unit testing I think you should you can write some unit tests to get going but then really to me the more valuable tests are the integration tests that start to get up a little higher in the abstraction levels so that you're not because when you when you do unit testing of like little teeny chunks of code then you you kind of you're committing to that chunk of code and particularly early on in a project like that code might be wrong you might be getting your abstractions wrong it's hard to get them right at the start and so uh so just a little tid bits like that um it's kind of but all written as a caveman nice yeah I love it give that a read if you haven't and I'll make sure to check out wors is better uh it seems
like a super influential uh so your talk at JS nation is titled HTM X is pro JavaScript can you give us a breakdown about your talk and maybe just a quick preview of what it what's it about yeah it's so um there's a so HTM Max you know as we sort of talked about like you don't you tend not to write as much JavaScript when you use HTM X for your web application particularly when compared with you know if you're writing like a react based application or something like that um you just the focus isn't as much on JavaScript and because of that there's uh a um HDMX has a reputation as being a library that people who hate JavaScript use um and so I wanted to that's true to an extent like if you don't like JavaScript you're GNA like HTM X in relative terms because you don't have to deal with as much JavaScript um but I think there's another way to look at it where you can say that HDMX is actually Pro JavaScript
in that um it allows JavaScript to be what it was designed for which is a scripting layer for the web um you know JavaScript was not designed like it was a it was a lisp that they kind of had to weld Java syntax on top of um but it was designed you can go and watch interviews which I've been doing in preparation for this talk of Brandon Ike the guy who created it and he was like he talks about oh it's just it was a way to just make a button do a thing you know and uh javascript's really good at that actually um there's aspects of the language you know I teach programming languages like compilers and I've got my own opinions on languages um and so there's things i' change about JavaScript but for for light frontend scripting for scripting in a web context like it's it's that's wheelhouse for JavaScript and uh if you use HTM Max you can actually use JavaScript in that way so it takes this pressure off of JavaScript to be a good general purpose
language to you know be to support a massive codebase of JavaScript which it's a dynamic language big code bases are not wheelhouse for dynamic languages but just getting little things done um that's that's again that's that's really what one of the strong strengths of JavaScript and so HTM X can put you in a position where you can use JavaScript in that way and so that makes uh I think that uh in that in that way htx is pro JavaScript and that it lets JavaScript be what it's best at and doesn't force it to be everything uh in web development yeah totally uh well I I'm really stoked to see it JS Nation happening November 18th and 21st online if you want more information click the Link in the description js. and you can get your ticket and I'll be there and checking out Carson's talking I can't wait to see it so thank you so much Carson for your time yeah no problem I'll be there in person too so
Quote it with credit and a link. Quoting Syntax