Dylan Beattie
Dylan Beattie
  • Видео 92
  • Просмотров 1 688 265
Learning JavaScript with WAT
JavaScript has been called the world's most misunderstood programming language... but it actually makes perfect sense. Let's look at some classic JavaScript WAT and take it apart to see how it actually works.
The code snippet in the video is here:
gist.github.com/dylanbeattie/6f75bc83c9d617b54177adcacf891e21
Gary Bernhardt's classic talk "Wat":
www.destroyallsoftware.com/talks/wat
"Bug in the JavaScript":
ruclips.net/video/jxi0ETwDvws/видео.html
Просмотров: 3 049

Видео

Are Feedback Loops the Key to Building Better Software?
Просмотров 4,4 тыс.День назад
You just wrote some code... how long until you know for sure that it worked? Hours? Days? Have you ever found a bug in production that's been there for literally years but nobody ever noticed? The faster we can find defects, the easier they are to fix - so let's talk about feedback loops, and a couple of tools I use when I'm building software that'll let me know right away if I've broken someth...
What If Wordle Had Cost A Dollar?
Просмотров 5 тыс.14 дней назад
I think Wordle is one of the most delightful things that's ever happened on the web, but it's also a really interesting example of how the economics of online commerce just don't work if you want to get a very small amount of money from a very large number of people. Josh Wardle's "Opting for the Opposite" from Config 2024 is here: ruclips.net/video/eMhcL2yL7RI/видео.html
How can a crossword puzzle have two valid solutions?
Просмотров 2,1 тыс.21 день назад
This week's all about crossword puzzles - and a particular kind of puzzle that had to be this week's topic, because next week it just won't be the same. The puzzle is at dylanbeattie.net/puzzles/20240701 if you want to try solving it - there's an interactive web version using iPuzzler, and a PDF you can print out if you prefer solving on paper.
Turns out REST APIs weren't the answer (and that's OK!)
Просмотров 111 тыс.Месяц назад
A decade ago, it seemed like everybody was talking about ReST APIs and HATEOAS, blog comment threads bristled with spirited debates about whether something was, or was not, a REST API, and we all thought hypermedia was the key to building long-lived APIs. And yet here we are, a decade later, building just as many APIs as before but seems like hardly anybody's talking about hypermedia... so what...
I Was Too Busy Making Videos To Make This Video
Просмотров 1,3 тыс.Месяц назад
I've been in Norway all week at NDC Oslo... and, yep, been too busy making videos to make a video. So here's a little video diary from a sunny Sunday in downtown Oslo. Sorry about the wind noise... next time I'll remember to bring the Anker mic with the windshield :)
Spamhaus, GitHub Pages, and good error messages
Просмотров 1,8 тыс.Месяц назад
Last week a bunch of my websites went down... well, kind of. It wasn't just mine: thousands of sites were down, including github.io itself. And they weren't down for everybody... just for quite a lot of people in the UK. Let's figure out what happened.
Moore's Law, Amdahl's Law, Conway's Law - and why we need to stop having meetings`
Просмотров 2,7 тыс.Месяц назад
Over fifty years ago, Gordon Moore, Gene Amdahl and Mel Conway shared three observations about computer engineering which would go on to be known as Moore's Law, Amdahl's Law, and Conway's Law... but what can anything published in the 1960s possibly have to do with designing cloud software in 2024? Turns out the answer might be more than you think.
Corel Linux: the OS that could have changed the world?
Просмотров 3,3 тыс.Месяц назад
Corel Linux: the OS that could have changed the world?
Apollo, Soyuz, Postel's Law - and some really old-school HTML
Просмотров 2,3 тыс.2 месяца назад
Apollo, Soyuz, Postel's Law - and some really old-school HTML
Why Does My Phone Think It's In Cairo?
Просмотров 2,4 тыс.2 месяца назад
Why Does My Phone Think It's In Cairo?
What is Network Neutrality - And Why Does It Matter?
Просмотров 1,3 тыс.2 месяца назад
What is Network Neutrality - And Why Does It Matter?
There's a 1970s Tape Recorder in Interstellar Space
Просмотров 1,4 тыс.2 месяца назад
There's a 1970s Tape Recorder in Interstellar Space
Why Emoji are More Complicated Than You Think
Просмотров 3,6 тыс.3 месяца назад
Why Emoji are More Complicated Than You Think
Delving into the Landscape
Просмотров 1,8 тыс.3 месяца назад
Delving into the Landscape
Does Your UI Pass The "Moron in a Hurry" Test?
Просмотров 9 тыс.3 месяца назад
Does Your UI Pass The "Moron in a Hurry" Test?
You Forgot To Say The Magic Word!
Просмотров 4 тыс.3 месяца назад
You Forgot To Say The Magic Word!
The Evolution of Web Apps 1992-2024
Просмотров 26 тыс.4 месяца назад
The Evolution of Web Apps 1992-2024
Tips for Tech Presenters: Solving the "Super Mario" Problem
Просмотров 3,3 тыс.4 месяца назад
Tips for Tech Presenters: Solving the "Super Mario" Problem
The Road to Rockstar 2.0: C#, Blazor, WASM, and AOT compilation.
Просмотров 1,1 тыс.4 месяца назад
The Road to Rockstar 2.0: C#, Blazor, WASM, and AOT compilation.
Hey Tech Nerds - Here's a Question: Fundamental Layers of Abstraction
Просмотров 1,3 тыс.4 месяца назад
Hey Tech Nerds - Here's a Question: Fundamental Layers of Abstraction
re:bass
Просмотров 32 тыс.2 года назад
re:bass
Teams
Просмотров 18 тыс.3 года назад
Teams
ONYX BOOX Note Air - an e-ink tablet running Android 10
Просмотров 9 тыс.3 года назад
ONYX BOOX Note Air - an e-ink tablet running Android 10
Building a Rockstar interpreter in TypeScript, Day 1
Просмотров 2,3 тыс.3 года назад
Building a Rockstar interpreter in TypeScript, Day 1
Advent of Code 2020 - Day 12, Part 1... using Amstrad LOGO
Просмотров 6473 года назад
Advent of Code 2020 - Day 12, Part 1... using Amstrad LOGO
Advent of Code Day 12: Part 1 in Amstrad LOGO
Просмотров 8863 года назад
Advent of Code Day 12: Part 1 in Amstrad LOGO
Hello Helpdesk
Просмотров 13 тыс.3 года назад
Hello Helpdesk
Tech Sales
Просмотров 11 тыс.3 года назад
Tech Sales
Meetup 2020
Просмотров 4 тыс.3 года назад
Meetup 2020

Комментарии

  • @mitechko
    @mitechko 8 часов назад

    Eh... I have been building APIs for over a decade now. And while I agree with the general point that almost nobody ever designs full HATEOAS APIs and maybe OpenAPI style APIs most people do have are not "really" REST, I think the border between the two is a lot more blurred. The argument in the video seems to be that "if there is no hypermedia it is not REST. Well, a lot of APIs employ hypermedia. I made a few of them myself. Consider pagination of list APIs. You get a list of bajillion results. You don't want to send them all to UI. You don't even want to generate them in the first place, since that is likely to bog things down on the backend too. You could, like a lot of people just add a URL parameter like ?page=2 or ?offset=50 or whatever to request the next page. But in a lot of cases your UI needs to know how many results are in the total. At the very least to be able to tell the user how many pages they can page through. So you add some meta data to your results. Main body is the list and meta data contains the total number of results available. This way you can also process HEAD requests that will only serve the total count without the list data. But since you already add metadata you might as well include links to the next and previous page. Why? Because it is more intuitive for the API user and you have an option of making your pagination URLs unpredictable to dissuade scrapers and crawlers from abusing it. A similar example is with embedded objects. You have an ad for some product. Your product has reviews. For obvious reasons you are not going to include review data in the same result as the product request. So your API users need to construct your review URL based on the product data. You have a special review by product endpoint. You could have a hierarchical /product/<id>/reviews/ endpoint. Both are fine approaches, but both have downsides. The easiest approach is to include a URL for the review list endpoint in the product data. And again this gives you a lot of freedom on what you want that URL to look like. There are other examples, of course, but as I said, hypermedia in APIs is far from being dead. It just doesn't look as neat and idealistic as the original HATEOS idea.

  • @berenscott8999
    @berenscott8999 8 часов назад

    Something I started playing around with in my project was using the schema to define dynamic structure. Say I have a bunch of different item types and the documents contain different aspects that aren't static, I used the schema to define the dynamic web content. Over time, that schema can change, new item types can be added. When handling these documents, a simple read of the document structure is used rather then applying the schema to it.

  • @RichardCarlsson
    @RichardCarlsson 9 часов назад

    For some reason I feel like starting a fire.

  • @TesterAnimal1
    @TesterAnimal1 12 часов назад

    I detect a reference to KOHUEPT.

  • @SageHeru
    @SageHeru 17 часов назад

    Seems like lots of topics aren't working anymore in 2024. Wonder how all the big brains didn't foresee this.

  • @DARRELMCQUIENN
    @DARRELMCQUIENN 19 часов назад

    Amen to this. I was involved in a system where the management decided it had to be REST. It was a real-time control system. What a bad fit.

  • @HolgerJakobs
    @HolgerJakobs 23 часа назад

    Many "simple" protocols of the earlier days were actually really simple, like SMTP. Only later, the word "simple" was misused, as you say in the case of SOAP.

  • @Tomaszeks
    @Tomaszeks День назад

    Great video, Dylan!

  • @kant12
    @kant12 День назад

    In my 25 years of experience I've yet to meet a REST purist who was good at anything but making ppt slides.

  • @calanm7880
    @calanm7880 День назад

    This is magnificent. I had multiple “penny drop” moments - understanding the context of the “why?” really helps me understand.

  • @EliKennedy
    @EliKennedy День назад

    Oh this channel is for me.

  • @markcoleman8579
    @markcoleman8579 День назад

    Love these trips back in time. Nice t-shirt.

  • @BryonLape
    @BryonLape День назад

    I'm old enough to remember when Z39.50 was most of the Internet traffic.

  • @charonme
    @charonme День назад

    "no hypermedia - no rest"? ok then, but then also if you have a stateful login, ie. the same request which gives different results based on some state on the server (eg. a login state) then you don't have REST. See paragraph 5.1.3 Stateless in Roy's paper

    • @DylanBeattie
      @DylanBeattie День назад

      Yes, if you're using something like session state, Roy Fielding would say that you don't have REST since as you quite rightly point out his paper defines statelessness as a prerequisite for a RESTful system. That said, it's entirely possible to build a system which uses authentication and is RESTful according to Fielding's definition, - either via authorization headers, or something like a JSON web token that's included with every request.

  • @andreidei
    @andreidei День назад

    idea for javaScript update: !Nan = "number"; !"number" = String; String*String = "crossword"...

  • @DylanClouden
    @DylanClouden 2 дня назад

    Wow, I had no idea this was a thing that's sick, going to try and integrate this into my workflow

  • @Chris-op7yt
    @Chris-op7yt 2 дня назад

    you're mixing up things. authentication has nothing to do with it, but it's nice when authentication works seamlessly with REST and applications. applications and what REST API provides to them are different things. there's no need for hypermedia to be part of an API unless it's a need/nice to have for the application. REST is stateless. applications use whatever technologies to maintain authentication and state if they need it. REST separates the concerns of server and client, and typically give the client a structured way to do CRUD (create/read/update/delete) like things with objects on server, that application pulls together into a coherent application to do something. web REST APIs is another level or number of levels that people implement, which is more a reflection of their business needs rather than a reflection on core REST APIs.

  • @spaceageboys3485
    @spaceageboys3485 2 дня назад

    this guy explains things so well im going to be hacking governments🤣

  • @sm5574
    @sm5574 2 дня назад

    We've also essentially moved from dumb terminals in the '70s to smart terminals now, with everything essentially running as a web app or something cloud-based. The idea of actually running software on that massively powerful machine in front of you has become antiquated.

  • @woosix7735
    @woosix7735 2 дня назад

    NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN

    • @NikkyAI
      @NikkyAI 10 часов назад

      the automatic translation by google to 'Yes' is extra funny, NaN should not be truthy

  • @jona826
    @jona826 2 дня назад

    Why do you seem to imply that REST services only provide frontend content. We have hundreds of REST APIs in our organization that are purely for communication between backend services. Hyperlinks in the response message are not needed for this. Indeed, backend services communicating via REST send JSON message bodies, not HTML.

  • @Zainjerr
    @Zainjerr 2 дня назад

    These videod are just sooo good Please don't stop making them 🙏

  • @feicodeboer
    @feicodeboer 2 дня назад

    What did I just watch? I looked like a pile of loose sand shifting ...

  • @ailaG
    @ailaG 2 дня назад

    The "cat" could be a squeaky door hinge.

  • @spaceageboys3485
    @spaceageboys3485 3 дня назад

    Great video might revive applets just to make people mad

  • @Stoney_Eagle
    @Stoney_Eagle 3 дня назад

    Madness 😂

  • @DavidBeaumont
    @DavidBeaumont 3 дня назад

    I'm sorry, but JavaScript is in no sense elegant. Elegance of a system is a measure of how well it suits the problem it's trying to solve. Elegant languages have low impedance for use. JavaScript is for sure a simple language, but it was designed in a few weeks by essentially one person. You cannot expect elegance from that.

    • @caerphoto
      @caerphoto День назад

      It can be elegant, if you avoid the root of all of these problems: type coercion.

  • @rojokongen
    @rojokongen 3 дня назад

    Hahaha! Excellent! 👌

  • @sazk4000
    @sazk4000 3 дня назад

    🙂

  • @psgouros
    @psgouros 3 дня назад

    Wet Ass Tokens?

  • @DrCoomerHvH
    @DrCoomerHvH 3 дня назад

    Just as Brendan Eich saw it

  • @ShadowKestrel
    @ShadowKestrel 3 дня назад

    you can take this to an extreme and obfuscate *any javascript program* into only using the characters []()!+ i love javascript, masochistically

  • @versacebroccoli7238
    @versacebroccoli7238 3 дня назад

    I hate that empty arrays are truthy in JS. They are falsey in Python and that seems reasonable.

    • @househall
      @househall День назад

      For me as a former C/C++ developer they are obviously truthy because they are not nulls. For the same reason type of null is obviously an object because of type of "Object *obj" is still an object pointer even if it's value is null.

    • @rafal06
      @rafal06 День назад

      @@househall what's null if not null pointer? and null pointer is just 0 casted to a pointer. It points to nothing, there is no Object. Also, 0 is equivalent to false. and what is an empty array? you can't malloc(0)

    • @woosix7735
      @woosix7735 День назад

      The hole concept of truthyness for anything other than booleans is heresy

    • @caerphoto
      @caerphoto День назад

      @@woosix7735 tell that to the C programmers. They don't even have an actual boolean type.

    • @rafal06
      @rafal06 День назад

      @@woosix7735 I agree

  • @rolandcsaszar5479
    @rolandcsaszar5479 3 дня назад

    Oh, I thought this would be about WASM-WAT (WAsm Text format).

  • @andreasgierstorfer8046
    @andreasgierstorfer8046 3 дня назад

    Could it be that this notion of truthiness was pioneered in Perl? Perl 5 came in 1994, Javascript appeared in 1995 (according to Wikipedia). But, I see that Javascript could have it's own industrial-grade obfuscated programming contests 😀

  • @DragoniteSpam
    @DragoniteSpam 3 дня назад

    Looking back I find it a bit amusing how "write once, run/debug anywhere" was the motto for Java, and Oracle used to make a big stink about how Java wasn't JavaScript, and yet it was JavaScript where that promise actually won out in the long run

  • @Huntracony
    @Huntracony 3 дня назад

    Aww, my prediction was wrong. I _almost_ correctly interpreted ({}+"")[!""+!""] as indexing 2 from the string "Object Object" (forgetting the square brackets), which would've been 'j', and predicted the entire expression would evaluate to "javascript"

  • @NeunEinser
    @NeunEinser 3 дня назад

    JavaScript is not a good language, it's a necessary and at this point pretty much irreplaceable language. The idea of just running code without needing to compile, in a way that can just be interpreted by all browsers is obviously grand. Just the design of the language itself is unfortunately pretty mediocre.

    • @janhofmann3499
      @janhofmann3499 3 дня назад

      PHP: hold my beer! (I know, different beast but also something that became somewhat relevant despite its questionable design..)

    • @peterlinddk
      @peterlinddk 3 дня назад

      And would that "mediocre design" by any chance have anything to do with not requiring declared types or class definitions, and having automatic coercion? As seems to be the standard complaints about the "garbage JavaScript language" that seem to flow from every other "internet coder" out there, who dont' care to read specifications, and declare any language behaving other than whatever they learned first, as "bad". Or are there any actual design problems in the language that prevents it from being "good"? I'm honestly curious, because I've only ever heard whining about the way it handles types.

    • @madshorn5826
      @madshorn5826 2 дня назад

      Is that critique really fair? Having a messy origin story and heroically standing by the past by ensuring backwards comparability isn't automatically disqualifying in my book. The latest version of ECMA script has cleaned up quite a bit as I understand it. What is the verdict if you follow best modern practice?

  • @TheGeoffable
    @TheGeoffable 3 дня назад

    🤣 That's brilliantly ridiculous! And what I'm hearing is that this process could generate working Rockstar code?

    • @DylanBeattie
      @DylanBeattie 3 дня назад

      Oh, no, Rockstar takes things a step further. In Rockstar 2.0 you can add, subtract, multiply and divide strings. No NaNs to worry about.

    • @michaeltrillium
      @michaeltrillium 3 дня назад

      Oh no, it’s ridiculously brilliant… What looks like a complete silliness actually teaches you JS syntax!!!

  • @DotArve
    @DotArve 3 дня назад

    Dunno when, but from the WAT talk, things have changed.. {}+[] and []+{} now both return '[object Object]' in NodeJS

    • @rafal06
      @rafal06 День назад

      the first one returns 0 in firefox

    • @DotArve
      @DotArve День назад

      @@rafal06 It does and doesn't, actually. If you just evaluate it on its own in the console, it returns 0. If you use it as the right-hand sign of an assignment expression, e.g let a={}=[]; console.log(typeof a, a), it will print "string [object Object]" - it only shows 0 when it's there as a naked expression in the console. The same applies in Chromium-based browsers and Safari. In NodeJS, this changed somewhere in the 13.x release cycle. The safe way to get 0 is {}|[]

    • @DylanBeattie
      @DylanBeattie 8 часов назад

      {}+[] (and {}+"", which I talk about briefly in the video) are misleading, because they return something different depending whether you evaluate them as an expression or run them as a program. As a program, they're both an empty block {} and then, separately, an expression with a unary plus operator + and an empty array/string, which is zero. If you wrap them in parentheses - or run them in nodeJS, which I assume interprets them as a single expression for some reason - the {} becomes an empty object, it tries to add that to whatever's on the right hand side and the only way to make that not explode is to make them both strings, so you get "[Object object]" plus the empty string. I ❤ JavaScript.

  • @minigamer4262
    @minigamer4262 3 дня назад

    classic jsfuck

    • @minigamer4262
      @minigamer4262 3 дня назад

      actually not even true jsfuck

    • @Domitianvs
      @Domitianvs 2 дня назад

      @@minigamer4262 so... truthy jsfuck, I guess?

  • @WaterTimeLapse
    @WaterTimeLapse 3 дня назад

    I was like, wat? Wat is awesome? Yes.

  • @jelenaperfiljeva4998
    @jelenaperfiljeva4998 3 дня назад

    Just a note of appreciation for "The Consolidated Cheese and Diesel Corporation" at 03:56 🤣

  • @JeremyAndersonBoise
    @JeremyAndersonBoise 3 дня назад

    The late Joe Armstrong is still my #1 computer science hero because of the way he thought about problems, and his great mind for critiques, positive and otherwise.

  • @JeremyAndersonBoise
    @JeremyAndersonBoise 3 дня назад

    In my personal experience, it sure helps.

  • @chopsueysensei
    @chopsueysensei 3 дня назад

    the web was a mistake

  • @TangiAmalenge
    @TangiAmalenge 3 дня назад

    This is where the "What3Words" App can come in handy. 🤔

  • @klauselk
    @klauselk 3 дня назад

    Nice and Clear. I was part of introducing REST in an embedded product, and I must admit that we never caught the Hypermedia thing. So - I guess we got it right ;-)

  • @goclick
    @goclick 3 дня назад

    Too bad certain Big Tech companies conspired to completely neuter WASM.

  • @f0ssig
    @f0ssig 4 дня назад

    wat