546

December 7th, 2022 × #Code Style#JavaScript#Launch Prep

Code Styles × Readable Rules and Petty Preferences

Scott and Wes discuss their code style preferences, focusing on readability over being fancy. They also chat about prepping for a site launch.

or
Topic 0 00:00

Transcript

Guest 1

Welcome to Syntax, the podcast with the tastiest web development treats out there. Today, we've got, rid Good one for you. We kinda put 2 shows together. We had this idea of, first, a petty preferences, show, which is just things, tabs, and spaces and whatnot, and we'll talk about all of that. But then there's also, like, a lot of stuff which is like, I actually prefer Function definitions over an arrow function in a variable, and there's some real reasoning behind that. So Scott and I are gonna go through a list of probably Twenty different things, and we're gonna say what we prefer and as well as, like, why we prefer that, which is, rid. Generally, you try to side with more readable code over being a hotshot.

Topic 1 00:11

Discussing petty preferences and readable code

Guest 1

So we are sponsored by 3 awesome companies today, rid. Linode cloud computing developers trust LogRocket, JavaScript session replay, and FreshBooks cloud accounting. We'll talk about all of them partway through the episode.

Topic 2 01:06

Scott launching a site this week

Guest 1

How How you doing today, Scott? I'm doing good. Just hanging out,

Guest 2

launching our site this week. Rid Oh, wow. I'm just in Berserker mode here. Just you know? We we have a a friend of mine doing q and a for us. Is it q and a or QA?

Guest 1

Q and a. Quality oh, you know? No. QA.

Guest 2

You're right. Yeah. Q and a. Buddy. Questions and answers. I know. I always say q and a. And then just as I was about to say that, I was like, wait a second. It might not actually be q and a.

Guest 2

We have a friend of Doing QA for us and, it's, simultaneously really great to just have somebody, rid. Go through and find all these things, but, like, it's also super depressing to see so many things pop up rid. After you're feeling like, alright. I'm ready to go. Yeah. And then your to do list has gotten down to, like, 4 more things left, and then now it's populated like rid Crazy again. So Totally. I I much prefer those like, a person that you've asked to do it than someone, like, being like, hey. Like, what's up with this rid Tweeting a screenshot

Topic 3 02:13

Getting feedback before launch vs after

Guest 1

or whatever. That always happens. It's like you I worked, like, 8 months to launch a course, and then, like, the first reply is, I think it's Broken, and there's, like, something, like, weird.

Topic 4 02:23

Feeling exhausted from prepping for launch

Guest 2

Yeah. I know. It's it's so hard to find everything, you know, especially on a large project. So, rid. Yeah. That's where I'm at. I if I sound exhausted, it's

Guest 1

I'm a little exhausted, I gotta say. Yeah. Alright. Well, let's, let's get on into it. First one is rid Function definition. There's many ways to define a function in JavaScript. Probably the 2 most popular ones are If you're just defining, like, a top level function, not a method or ever, do you do what's called a named function? You write the word function and then the name of it, Open up parentheses, open up curly brackets, or do you do, const or var or let rid. The name of the function is equal to, and you do a little arrow function inside of that.

Topic 5 02:33

Function definitions vs arrow functions

Guest 1

I am on team, like, there's certainly, arrow functions have their use, and I'm not, pooh poohing them at all. I use them all day long. But When you are defining a regular ass function, I always prefer the first, which is a named function, over sticking in a variable. I've never felt good about that. What about you? Yeah. I'm pretty much the same way. However,

Topic 6 03:10

Prefer named functions over arrow in variables

Guest 2

I will say that there I mean, I would maybe not pretty much the same way. I'm exactly the same way. However, there has been a a recent kind of thing that's popped up in my code base, which I wonder if you've noticed this.

Topic 7 03:35

TypeScript makes arrow functions convenient

Guest 2

So in in TypeScript, You can define the inputs, the outputs, like everything about a function as a type, and then assign it to the function Much more easily using the const do something way. Even if you're not using an arrow function, if you're saying const do something is equal to Function do something. You can like, if you're assigning a function to a variable,

Share

Play / pause the audio
Minimize / expand the player
Mute / unmute the audio
Seek backward 30 seconds
Seek forward 30 seconds
Increase playback rate
Decrease playback rate
Show / hide this window