Back to the basics

Rate this content
Bookmark

“You’ll never believe where objects come from in JavaScript.”


“These 10 languages are worse than JavaScript in asynchronous programming.”


Let’s explore some aspects of JavaScript that you might take for granted in the clickbaitest nodecongress.com workshop.


To attend this workshop you only need to be able to write and run NodeJS code on your computer. Both junior and senior developers are welcome.


Objects are from Mars, functions are from Venus


Let’s deep-dive into the ins and outs of objects and then zoom out to see modules from a different perspective. How many ways are there to create objects? Are they all that useful? When should you consider using them?


If you’re now thinking “who cares?“, then this workshop is probably for you.


Asynchronous JavaScript: the good? parts


Let’s have an honest conversation.


I mean… why, oh why, do we need to bear with all this BS? My guess is that it depends on perspective too. Let’s first assume a hard truth about it: it could be worse… then maybe we can start seeing the not-so-bad-even-great features of JavaScript regarding non-blocking programs.

Guillermo Gutierrez Almazor
Guillermo Gutierrez Almazor
128 min
15 Feb, 2022

Comments

Sign in or register to post your comment.

Video Summary and Transcription

This workshop covers basic principles and patterns in software development and engineering. It explores topics such as objects, functions, prototype chains, classes, modules, and asynchronous programming in JavaScript. The workshop emphasizes the importance of understanding context, encapsulation, and the use of promises for managing asynchronous behavior. It also discusses the differences between synchronous and asynchronous code execution and provides insights into the design patterns and best practices for writing efficient and maintainable code.

Available in Español

1. Introduction to Workshop

Short description:

Thanks for joining this workshop on basic principles and patterns. I believe they are the best investment in your formation. Today, we'll focus on two topics: objects and asynchronous behavior of Node.js.

So I think we can start now, again, my name is Guillermo I'm your host today. Thanks for joining this workshop and a special thanks for coming because I know this is not the flashiest topic out there. Like basic principles and patterns is not a fancy framework that everybody is using or things like that.

So, yeah, good for you, too, I guess. Yeah, there's going to be a recording of this session and I think that the organization will put it on where you can access it. Yeah. There you go. Cool.

So, again, my name is Guillermo. I'm a software developer probably like most of you. I work at the company called DnSimple as a staff software engineer. I normally work on Ruby. But I also work a lot on JavaScript and in the past I've also worked on Java code bases, too. At DnSimple, we are a small team. And, by the way, we are looking for people to join us. So, be sure to check out our jobs page. If you're on the market for a job, we'll be happy to hear about you.

So, this workshop the basics, right? And I really meant it when I put that title. Because when I give talks and trainings like this one, I always try to bring it down to basic principles and patterns. Because that's what I honestly believe it's the best investment anyone can make in their formation. Because you know, frameworks and libraries tend to change so much, they're really volatile, whereas basic principles and patterns are things that have been around for a long, long time, and have been proven to be valuable and useful through time. So there you go. That's basically how I try to think about it. And also, in a two hours remote workshop like this one, there's not so not a lot of room to to talk about a lot of things and go into a lot of detail. So that's why I wanted to focus just on two topics, one objects and two asynchronous behavior of Node.js because I think those are topics that most of the people I know struggle with and these are also things that we take for granted without really having too much time to think about them and reason about them and get really into knowing how they work.

2. Understanding Objects and Values in JavaScript

Short description:

No practical notes will be given. We will focus on code for the next two hours. Objects are collections of key-value pairs in JavaScript. Values can be anything you put to the right of an equals sign. Let's look at an example with the variable foo and the property A. We can access the A property using dot notation or square bracket notation. Both will return the value 44.

So let's cut to the chase. Someone asking if practical notes are going to be given? No, I'm sorry, I haven't prepared any practical notes for you. It's just about dealing with the code that we are going to see for the next two hours and of course the repo will be there, it's public and you can do what you want with it afterwards. So, again, these are nuanced topics that require a lot of time to get into details etcetera.

And what I'm going to say then during the next couple of hours, you need to understand that these are only mental models, heuristics, ways to think about things, not canonical descriptions of how things are in the language, okay? So, let's start with the objects. So, the first topic was objects are from Mars, functions are from Venus. This was kind of a silly joke. But, really, what is an object, and why should I care? That's just the question I will try to answer. And the thing is that the way I think about objects is as if they were values that have this shape of a collection of key value pairs. So, in JavaScript, keys of those objects are called properties. And values, a value, right? So, oh. Okay. I'm going to enable this. I don't know if it's going to work. So, live transcription. There you go. It works. Okay. Let's continue.

So, what is a value, right? Whatever you can put to the right of an equals sign, that's a value in JavaScript. And you will find that almost anything is a value. You can actually put anything you want to the right of an equals sign. I was really trying really hard to think of something that was not a value, but I didn't find anything. So, let's jump to the first I have for you, we have a couple of folders. One is objects and the other one is called a sink. So, let's take the part1.js file. And you will find three lines here. And this is showcasing how an object can be thought of as a collection of key value pairs. Right? In the first line here we are creating a variable called foo. And to the right of the equal sign, I mean this part of the equal sign, we have curly brace and then an A which is the properties name. Then a colon and then 44 which is the value that I'm assigning to call A. This is an object, right there. And yeah. It has only one property with just the value. And I know that we are kind of talking about very simple things, but this we will grow on top of everything we introduce. Right? So we need to establish like the basics, right. This is what we're doing right now. And the way that we can reference the A property on foo is by using the dot notation or the square bracket notation. And you have an example of that in the following lines. The first line here, console.log, foo.A, this is a dot notation. And the next line is using the square brackets notation, where you have foo, square bracket. Oops, sorry, moving that. Square bracket. And then the property name as a string. And that will get you 44 in both cases. So, the way that code sandbox works is you've got to the bottom right, you have a section with terminal tab, console tab, and problems tab. And you have a very small plus sign on the right edge that you can click. And that should get you a new terminal. And I'm going to enable that for all of you that are following me here. So, if you create a terminal, this is basically a prompt, where you can run things.

QnA

Watch more workshops on topic

Using CodeMirror to Build a JavaScript Editor with Linting and AutoComplete
React Day Berlin 2022React Day Berlin 2022
86 min
Using CodeMirror to Build a JavaScript Editor with Linting and AutoComplete
Top Content
WorkshopFree
Hussien Khayoon
Kahvi Patel
2 authors
Using a library might seem easy at first glance, but how do you choose the right library? How do you upgrade an existing one? And how do you wade through the documentation to find what you want?
In this workshop, we’ll discuss all these finer points while going through a general example of building a code editor using CodeMirror in React. All while sharing some of the nuances our team learned about using this library and some problems we encountered.
Node.js Masterclass
Node Congress 2023Node Congress 2023
109 min
Node.js Masterclass
Top Content
Workshop
Matteo Collina
Matteo Collina
Have you ever struggled with designing and structuring your Node.js applications? Building applications that are well organised, testable and extendable is not always easy. It can often turn out to be a lot more complicated than you expect it to be. In this live event Matteo will show you how he builds Node.js applications from scratch. You’ll learn how he approaches application design, and the philosophies that he applies to create modular, maintainable and effective applications.

Level: intermediate
Testing Web Applications Using Cypress
TestJS Summit - January, 2021TestJS Summit - January, 2021
173 min
Testing Web Applications Using Cypress
WorkshopFree
Gleb Bahmutov
Gleb Bahmutov
This workshop will teach you the basics of writing useful end-to-end tests using Cypress Test Runner.
We will cover writing tests, covering every application feature, structuring tests, intercepting network requests, and setting up the backend data.
Anyone who knows JavaScript programming language and has NPM installed would be able to follow along.
Build and Deploy a Backend With Fastify & Platformatic
JSNation 2023JSNation 2023
104 min
Build and Deploy a Backend With Fastify & Platformatic
WorkshopFree
Matteo Collina
Matteo Collina
Platformatic allows you to rapidly develop GraphQL and REST APIs with minimal effort. The best part is that it also allows you to unleash the full potential of Node.js and Fastify whenever you need to. You can fully customise a Platformatic application by writing your own additional features and plugins. In the workshop, we’ll cover both our Open Source modules and our Cloud offering:- Platformatic OSS (open-source software) — Tools and libraries for rapidly building robust applications with Node.js (https://oss.platformatic.dev/).- Platformatic Cloud (currently in beta) — Our hosting platform that includes features such as preview apps, built-in metrics and integration with your Git flow (https://platformatic.dev/). 
In this workshop you'll learn how to develop APIs with Fastify and deploy them to the Platformatic Cloud.
Build a powerful DataGrid in few hours with Ag Grid
React Summit US 2023React Summit US 2023
96 min
Build a powerful DataGrid in few hours with Ag Grid
WorkshopFree
Mike Ryan
Mike Ryan
Does your React app need to efficiently display lots (and lots) of data in a grid? Do your users want to be able to search, sort, filter, and edit data? AG Grid is the best JavaScript grid in the world and is packed with features, highly performant, and extensible. In this workshop, you’ll learn how to get started with AG Grid, how we can enable sorting and filtering of data in the grid, cell rendering, and more. You will walk away from this free 3-hour workshop equipped with the knowledge for implementing AG Grid into your React application.
We all know that rolling our own grid solution is not easy, and let's be honest, is not something that we should be working on. We are focused on building a product and driving forward innovation. In this workshop, you'll see just how easy it is to get started with AG Grid.
Prerequisites: Basic React and JavaScript
Workshop level: Beginner
0 to Auth in an Hour Using NodeJS SDK
Node Congress 2023Node Congress 2023
63 min
0 to Auth in an Hour Using NodeJS SDK
WorkshopFree
Asaf Shen
Asaf Shen
Passwordless authentication may seem complex, but it is simple to add it to any app using the right tool.
We will enhance a full-stack JS application (Node.JS backend + React frontend) to authenticate users with OAuth (social login) and One Time Passwords (email), including:- User authentication - Managing user interactions, returning session / refresh JWTs- Session management and validation - Storing the session for subsequent client requests, validating / refreshing sessions
At the end of the workshop, we will also touch on another approach to code authentication using frontend Descope Flows (drag-and-drop workflows), while keeping only session validation in the backend. With this, we will also show how easy it is to enable biometrics and other passwordless authentication methods.
Table of contents- A quick intro to core authentication concepts- Coding- Why passwordless matters
Prerequisites- IDE for your choice- Node 18 or higher

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Scaling Up with Remix and Micro Frontends
Remix Conf Europe 2022Remix Conf Europe 2022
23 min
Scaling Up with Remix and Micro Frontends
Top Content
Do you have a large product built by many teams? Are you struggling to release often? Did your frontend turn into a massive unmaintainable monolith? If, like me, you’ve answered yes to any of those questions, this talk is for you! I’ll show you exactly how you can build a micro frontend architecture with Remix to solve those challenges.
Full Stack Components
Remix Conf Europe 2022Remix Conf Europe 2022
37 min
Full Stack Components
Top Content
Remix is a web framework that gives you the simple mental model of a Multi-Page App (MPA) but the power and capabilities of a Single-Page App (SPA). One of the big challenges of SPAs is network management resulting in a great deal of indirection and buggy code. This is especially noticeable in application state which Remix completely eliminates, but it's also an issue in individual components that communicate with a single-purpose backend endpoint (like a combobox search for example).
In this talk, Kent will demonstrate how Remix enables you to build complex UI components that are connected to a backend in the simplest and most powerful way you've ever seen. Leaving you time to chill with your family or whatever else you do for fun.
Making JavaScript on WebAssembly Fast
JSNation Live 2021JSNation Live 2021
29 min
Making JavaScript on WebAssembly Fast
Top Content
JavaScript in the browser runs many times faster than it did two decades ago. And that happened because the browser vendors spent that time working on intensive performance optimizations in their JavaScript engines.Because of this optimization work, JavaScript is now running in many places besides the browser. But there are still some environments where the JS engines can’t apply those optimizations in the right way to make things fast.We’re working to solve this, beginning a whole new wave of JavaScript optimization work. We’re improving JavaScript performance for entirely different environments, where different rules apply. And this is possible because of WebAssembly. In this talk, I'll explain how this all works and what's coming next.
Debugging JS
React Summit 2023React Summit 2023
24 min
Debugging JS
Top Content
As developers, we spend much of our time debugging apps - often code we didn't even write. Sadly, few developers have ever been taught how to approach debugging - it's something most of us learn through painful experience.  The good news is you _can_ learn how to debug effectively, and there's several key techniques and tools you can use for debugging JS and React apps.
It's a Jungle Out There: What's Really Going on Inside Your Node_Modules Folder
Node Congress 2022Node Congress 2022
26 min
It's a Jungle Out There: What's Really Going on Inside Your Node_Modules Folder
Top Content
Do you know what’s really going on in your node_modules folder? Software supply chain attacks have exploded over the past 12 months and they’re only accelerating in 2022 and beyond. We’ll dive into examples of recent supply chain attacks and what concrete steps you can take to protect your team from this emerging threat.
You can check the slides for Feross' talk here.
Webpack in 5 Years?
JSNation 2022JSNation 2022
26 min
Webpack in 5 Years?
Top Content
What can we learn from the last 10 years for the next 5 years? Is there a future for Webpack? What do we need to do now?