Skip to main content
View on YouTube to comment and like!

11 months ago Syntax Podcast

Hot Takes + Bike Shedding

Wes Bos

Wes Bos Host

Scott Tolinski

Scott Tolinski Host

Topic 0 00:00

Transcript

Wes Bos

a whole lot because Yeah. I agree.

Wes Bos

in that, I will also

Scott Tolinski

I am going to say I agree, especially because

Wes Bos

hate about Prettier, and this is not ESLint

Scott Tolinski

I agree. I agree with that. Now here's one that is a classic.

Scott Tolinski

holiday weekend that we just had for Labor Day. I was cleaning a little sore out. Let me move it down just a little bit. And that happens eight times until I'm at the original line height that I was at before where I'm like,

Wes Bos

but I do

Scott Tolinski

I'm like phone. I I use this,

Wes Bos

from a file? Like, you have one file, and and there's one main thing that happens in that file. Do you prefer export default,

Scott Tolinski

is things that I've written and things that are like built in modules and stuff. I know some people would see that as a negative, the fact that many of the language built in things are camel case and that your things are snake case, but it helps me read, and it helps me stay organized.

Scott Tolinski

blah blah blah blah.

Scott Tolinski

You're done. That's it. Bingo. Who cares? Tabs all day. It makes the most amount of sense to me. You can change the space in the editor. Tabs to me, make the most amount of sense, and and now I am firmly in that camp. I I actually don't even understand the argument for using spaces. What, like, what is it? I don't even know what like, those all of the arguments for spaces

Wes Bos

long. And I I'm also maybe we should maybe we'll follow this up with a a mini one. A lot of people say you don't need comments in your code.

Wes Bos

Yeah.

Wes Bos

like a named export from that file, and why? and these are also variables that can go unused.

Wes Bos

don't like barrel files because I find it's just another file to make. I don't like any of the magic

Scott Tolinski

If I add another module to this file, them into,

Wes Bos

fixable, characters

Scott Tolinski

obnoxious. So if if you were to make me be in one of these camps, I would say, give me that hard line. Wow. But in practice, I just end up scrolling. I'm a Versus Node user. Now that I'm a Neo VIM user, maybe that changes. Who knows?

Wes Bos

I

Scott Tolinski

team

Wes Bos

or a function

Scott Tolinski

I am a big fan of function declaration

Wes Bos

When you're naming your variables, do you name them after the color that they are, like dash dash red, or do you name them after two things that's hilarious. So the new tagline is someone's gotta babysit the bots.

Wes Bos

export default do it Wes they have six lines of code on their screen at once. I'm all about So what I'm going to put myself

Scott Tolinski

oh my. Wes has brought a new head in here, and it's larger.

Scott Tolinski

having that be inferred, that makes a lot of sense. But for me, if I'm writing code, I can write the inputs and the outputs first as types, and then I can write the function, and then I can know if there's anything potentially in that function that would cause an issue there. Like, it's it's stopping me from writing potential bugs. Now granted, you can just not write those bugs in the first place, whatever. But, like, I like it being explicit personally, and I certainly do not mind having the extra bit of text in my files. Let's talk about Sanity real quick. Absolutely hilarious. The sentry.i0

Wes Bos

I find them very Sanity. And and some TypeScript, even if you use some of these libraries, like a lot of the tan stack stuff,

Scott Tolinski

think that it is for somebody who likes things so streamlined, this is one of the absolute things I do not mind being verbose on. It makes things crystal clear. To me, it, like,

Wes Bos

are are kinda moot. You know? They don't make any sense. Yeah. And, like,

Scott Tolinski

I got no problem with that. So Yeah. Yeah. Wes, do you prefer exports from the files and then reexports

Wes Bos

in a specific route, and the main thing that you export from that will be am firmly in the camp of small line height. I don't know how these PHP developers

Scott Tolinski

background BG. Let's name color CLR. Let's go as short as possible for no stinking reason. And I have grown up, and that is one of the reasons why I absolutely So I tend to keep it as vertical and thin as possible, but in practice, I end up just using,

Wes Bos

Prettier will chop it up into multiple lines,

Scott Tolinski

Yeah. What's interesting, Wes, is when I go through this list, the amount of things that I've changed my opinion on directly from the file itself? A barrel file is when you have an index file at the root of a directory, so therefore, you can import things essentially from the directory itself. It kinda scoops up all the exports from the

Wes Bos

into a variable. And this could be an arrow function. This could be simply just saying Scott do things equals a regular function.

Scott Tolinski

I'm actually mostly primarily clears up anything. It it finds little bugs. Yeah. You could say, okay. You know, your function returns,

Wes Bos

the Syntax website themselves where we use snake case, and it makes a lot of sense.

Wes Bos

check it out. Century.i0/syntax.

Wes Bos

make it as explicit as possible. Otherwise, I'm I love leaning on inferred types.

Scott Tolinski

I think that, like, earlier in my career, inferred types in TypeScript because I like one line per line, and that line wrap to me is

Wes Bos

Are you using e, one. And then quite a few of my projects still use spaces, with a comment above above it? the primary side of things. I will have a variable of of my colors, but then what I'll do is take primary and assign it to red because I've gotten in many many troubles before where I have a variable called yellow, and then it's it's no longer yellow after you change it because it's like the button background color or something like that. Node. Yeah. I I would say if the app

Scott Tolinski

Yeah. But I don't have anything forcing that. And I don't also aesthetic and ergonomic based. But to me, it feels like it makes less sense to just declare a variable to equal function Wes it's like, we have a keyword for that. Function is the thing. It's a it's the function declare like, just do it that way. That it just feels unnecessary to do it any other warp, personally.

Scott Tolinski

explicit. Let's give me JS long as you want because it, for me, tells me exactly

Wes Bos

But other than if you understand how hoisting works, they are I don't know. For a while, we saw a lot of people just doing the the function expression, sticking an arrow function in a Steamer. Yeah. You have a,

Scott Tolinski

like using the primary

Wes Bos

and you need to pass the am I'm I'm on the same team as the underscore Man, I have I have flip flopped back and forth so many times

Scott Tolinski

Yeah. I, personally,

Wes Bos

import from, like, a directory and just assume, just put it in a file. Even if I have, like, a file that is named, like,

Scott Tolinski

I'm doing e. I would only ever do e, which is interesting because I also do e for error, which it feels like that should probably

Wes Bos

Man, I the variable I'm not sure exactly what it does, you know, or I'm not sure

Scott Tolinski

reliable, extendable.

Scott Tolinski

only at this very moment am I realizing JS there some kind of conflict.

Scott Tolinski

to have

Wes Bos

infer quite a bit, because when you made changes up your tree, it it sort of, like, filtered its way through much more easily.

Scott Tolinski

I am using

Wes Bos

Man, website Do you prefer

Scott Tolinski

what the dang thing does. And that is such a man, I I don't mind writing comments too. I'm I'm gonna say I'll write comments with this style, but

Wes Bos

However, am still on team camel case for most of my projects by default.

Wes Bos

and it's it's okay, but I I much prefer

Scott Tolinski

we're talking, parental advisory here. That's what I like to have here for explicit types. I'm dropping f bombs at my types. No. I I personally

Wes Bos

I will be explicit when it's necessary.

Wes Bos

JS, the main thing exported from this file, like like routing. Right? Like, you have, like, a index dot TSX

Scott Tolinski

specifically,

Wes Bos

but I've switched over like, a steam wand or something like that? We we got one of those for at our cottage. We always get, like, flies things will go wrong, and you're gonna need Sanity in there to help you find out what happened and help you fix it. And a lot of times, it will just automatically fix it, and it can go as far as just send a pull Wes to you. So that's really cool. But, also, they have a marketing mode toggle on their website now Wes

Scott Tolinski

I prefer

Wes Bos

turn on my wrap and have it wrapped around. The one thing that I absolutely

Scott Tolinski

I this is just feeling not not right to me. So I end up always rocking with a small line height, and it just to me

Wes Bos

need for things to be short. Like, there's my computer's got gigabytes on it. I'm not You got and you got the screen real state for it. I agree as well. I think that I will opt for a longer, more descriptive variable. The comment will get lost as soon as you import that thing into another file, whereas

Scott Tolinski

I have no

Wes Bos

Welcome to Syntax. Today, we've got a bike shedding hot takes episode for you. This is where we're gonna go into those questions that don't really matter, but kinda do matter. Like, the Wes like on this. I

Scott Tolinski

go for long and actually? You know? Like, it like Well, it hasn't been. Sitting here, like, chatting about it. Yeah. No. It hasn't been a conflict actually. And in fact, this also is a conflict with my previous answer of long name that describes what it is or does. But, like, for some stupid reason, things like

Wes Bos

something like primary, secondary, Alright. Do you prefer a variable that is long and explicit as to describing what it does, or do you prefer a variable that is

Scott Tolinski

color scheme and one theme and it's never going to change from that, ideally, it's like, it doesn't really matter. It doesn't matter. Like, it's but this is the show where we're talking about it, so it does matter. I think it matters. Honestly, if you have two things and one of them makes a lot of sense and the other one doesn't make any sense, like, yeah, That matters.

Scott Tolinski

Yeah. I mean, I kinda do that. I I use color scheme as a CSS property, but I I do tend to use f g and b g for the text versus the background. That makes most sense of Vercel variable, then have to, like, reselect the problems

Wes Bos

actually having the name in the variable working on them. I used to be on team a tab character can adjust visually how big it displays in their editor. At first, the argument for spaces was that tabs show up really funny when you're, like, viewing source or it shows up really funny on a lot of editors. Those are solved problems. You know? You can you can change the actual tab Anybody who's using fantastic

Scott Tolinski

in

Wes Bos

you can, like, turn it on, and it will simply just give you a chat box. No marketing copy. No value props. No obligatory logo rivers. What's the point? Everyone uses it already. The fact that you don't can't be fixed. It's just a chat box of ask me about features and troubleshooting, e v, or typing out the full ass event?

Scott Tolinski

and commit? type of flow. That is the standard way I do it unless I am feeling lazy. And then I'm gonna make the color. Like, every site you're making probably has at least a light and a dark mode, don't you think?

Wes Bos

I'm running out of these fun ones that I made. I should've spent a little longer or are you using export,

Scott Tolinski

Comments all day long. Yeah. Like, please. Like, sometimes

Wes Bos

I'm going to make that explicit. And then two, And like, an index file inside of there. I don't even like importing without, the extension on it.

Wes Bos

that tabs are better hunting around trying to find what you want.

Wes Bos

is where you Yarn sticking a function because it's less characters.

Scott Tolinski

feels the most normal. I don't have any issues with it. I like to see all the stuff on the screen at one time.

Scott Tolinski

or spaces. Do you prefer tabs or spaces?

Wes Bos

don't love the rebase hard line length. Like, you say, I wanna be 80 or a 120 border, things like that? Like, what more of what they would do in your application.

Wes Bos

I'm a big fan of the declaration.

Scott Tolinski

I I don't use either of these. I just I don't have it wrap.

Wes Bos

now has a

Scott Tolinski

I am a tab man all the way. I use tabs. It's an easy thing to change over to. I used to use spaces. You just change a setting in your format or your ESLint or whatever.

Wes Bos

Node. Js lookup tree is very complicated, but I also your your layout or your page. Otherwise, if you Yarn importing that anywhere in your application, e,

Scott Tolinski

named because for me personally,

Wes Bos

and it's a huge pain once you're switching different environments. So very much of

Scott Tolinski

you know? I that's, like, one of the few things I'm willing to make an exception for. I I have a list of, like, things that I allow explicitly in my ESLint config.

Wes Bos

expression. And the the difference between those two are a function declaration is where you write the word function and then the name of the function and then the whole signature, and a function expression So if you are working on anything AI, mind that a function doing an event listener That's gonna get you two months for free.

Scott Tolinski

types in TypeScript?

Wes Bos

little bike shedding moment. It's so funny because none of this stuff really matters, but it also is

Scott Tolinski

export the color names. Like, on the Syntax site, things that are yellow are yellow. They're not primary. Right? Like, it it doesn't make any sense. But if I'm building an app with theming or I'm at building an app that has a lot of different colors, I'm

Wes Bos

of the So I've sort of landed on, elements, things like that.

Scott Tolinski

you prefer Oh my god.

Wes Bos

variable, but I am very much

Scott Tolinski

as well. I just feels like it makes less sense to me to make a variable.

Wes Bos

Beautiful. Alright. That was to using tabs simply because it's one character. You can adjust how big they, I'm going named export all the way, and I find it much easier to have the auto complete import. I find it much easier to rename things. You know, if you're refactoring code with a with a default import, it's kind of annoying. So I'm on team named export all the way.

Wes Bos

base, where I have fully This is another one that I think comes from a lot of, like like, older Node, and and people still follow. And this is

Scott Tolinski

I don't necessarily have

Wes Bos

it matters a lot, and it's fun to talk about. So let us know down below. We'll do another episode. What are your, like I call them anthills that you would die on. You know? Things that you don't necessarily matter, but there's a hill you die on.

Scott Tolinski

types. I'm talking

Wes Bos

it's inferred all the way down. You're not actually writing any types yourself. It's just inferred, inferred, inferred, and you just have full type safety all the way down. So I'm gonna put myself

Scott Tolinski

to rebase or do a merge

Wes Bos

character maybe in the middle of that one given that I to just squash my own commits, make sure everything is good, and then just have a single merge commit there wasn't any single good reason to do it, so I am not doing barrel files. I think the one good reason is if you are, like, publishing a library where you want one like, all of your APIs that are going to be explicitly

Scott Tolinski

like, I honestly don't what am I gaining by rebasing that I'm missing? I don't know if I am. I don't work on a big team. I work on a small team or I work by myself. So, like like, I'm sure there are definitely things that the reasons why people use rebase are very valid. But for me, it's like, I personally don't hit those things in my day to day life because that's just not my general workflow. So for me, the merge commit, you know, flow just has always worked fine. So Mhmm. Stick with it. Yeah. Alright. When you're I am almost always going to Yeah. Team camel for sure. I mean, I I personally man, snake case for me all the way.

Wes Bos

Re q for request,

Scott Tolinski

is, like, almost all of them. Like, I've changed my opinion on so many of these things over the years. Node of it is maturity. Some of it is, like, really understanding the benefits of this or that, but it is crazy. As you grow in this industry, your taste will change. So, again, a lot of these things are taste based, and some people want to act like they aren't, but many of them are just taste based for sure. Alright. That's it. Let us know down below what your, anthills that you'll die on. We'd love to hear them, and we'll record another one shortly.

Wes Bos

extends visually onto multiple lines, like, I don't want that to be Oh, man. All day long. Love it. Because, like, my Versus Node will indent it a little bit for me, and it's very clear to me that that is a wrapped line.

Wes Bos

is the way to go. I I'd much prefer that. The only pain in the butt is that

Scott Tolinski

snake case myself. Wes, what do you think?

Wes Bos

if this is something

Scott Tolinski

Not only do I think snakes are cooler than camels, I just tend to, read this so much better when I'm looking at my Node, and I certainly don't mind the fact that I'm the only one writing snake case. Node I don't mind the syntax of it and being different. It also another thing that it helps me differentiate between it would look so nice

Wes Bos

is

Scott Tolinski

of the time.

Wes Bos

I find that with AI, it's often better to have more explicit types.

Wes Bos

Man, I love line wrap, and I I do put I think I have a 140 like, a listener. So I'm I'm on team e all day long. I ain't got time to type event. That's and people who type e v, what is this? What? Yeah. You're a bunch of weirdos. Pick one. No. Pick a side. E v. Pick a side. Yeah. Yeah.

Scott Tolinski

errors or events,

Wes Bos

what value it is. Is this in pixels? Is this in in rems or m's? You know? How am I bringing this in? Is this a variable? Granted, TypeScript does make that a little bit easier, but, still, I'm I'm prefer it does not get lost, and it sort of it brings it around with it. So I'm a big fan of more explosive. I don't go nuts

Scott Tolinski

Like, this is, like, not something I've ever thought of before. But is it is it a conflict

Wes Bos

And and almost always, it's like a like a like a long array of items or something like that. That's another thing I hate about Prettier is if you have an array of, like, a 100 items,

Scott Tolinski

Snake case all the way for me, folks. Alright. When you're writing JavaScript, barrel files Wishy washy here is what you're saying. You're you're a flip flopper. I'm going to put my flag in the sand every single file from a directory

Wes Bos

with TypeScript, the hoisting problem bites me in the butt, and I have to often do like, if you wanna check if a variable exists, you have to do it in every single function.

Scott Tolinski

I thought the it was a style over substance for me. I thought let me make you come out of I'm gonna come out of your ear here. I thought that,

Wes Bos

being being able to screen record, and and you don't really have a lot of space Wes you're screen recording. You wanna show as much code on the page as once

Scott Tolinski

am gonna say I merge commit because I it's just how I've always done it.

Wes Bos

array methods, then they'll just stack them each on their own line, and it's it's quite a bit easier to read that way.

Wes Bos

it will just, like, format it so that every item's on its new line. I wish you could just, like, turn it off. There's some extensions and whatnot, but I don't feel like fussing with that.

Wes Bos

of having to explicitly in my project.

Wes Bos

and, like, even on the on the trim. Yeah. And we got, like, a little steam wand, and it gets in all the cracks and stuff. It's good stuff. That JS, something I don't know anything about. Mhmm. Alright. Let's get on into the first one that we got here. This is in CSS.

Wes Bos

Should your code be able to self document? What are your thoughts on that? I love comments.

Wes Bos

That's a that's a bad time. You then you have to, like, rename things. So I always do e r r for error. With TypeScript, it's a little bit less of a problem because you have to explicitly type it if you're defining your event handler outside of a, right now. I think I going to tend towards the

Scott Tolinski

I think out of all of these, this is the one we disagree on the hardest. I I I would never want You know, this is one of those things. Again, when I was a young buck, I was like, let's name

Wes Bos

AI is is is gonna need a little bit of help don't like the merge commit because it's it muddies up the history,

Scott Tolinski

Alright. Do you like big line height or small line height? Which one do you prefer?

Wes Bos

and happy with that rather than rebase it. Yeah. For sure.

Wes Bos

format money and I'm putting that in another folder of the same name, I'm totally fine with that. I I much prefer that over just like an index dot t s

Scott Tolinski

when I'm importing from one directory. I shouldn't have to if I don't need to. So for me personally, it was definitely a style over substance thing. And once I was just like, why am I doing this? Like, what am I getting out of this and taking a look at it from a more objective point of view? I realized

Wes Bos

like, would you make a variable called dash dash text or or foreground, or would you just simply just say, like, having things feel calm, but have have high amount of information density. Part of that comes from God.

Scott Tolinski

to look so nice to have just the import from a directory. But I didn't necessarily think about the logistics. I didn't think about, tree tree shaking, code splitting, those types of things warp, like, you're really trying to reduce the amount of things anything loads at any given point. Like, I shouldn't have to load

Wes Bos

in, or do you just let your code wrap around? So if you're chaining a bunch of methods, is it fine to to let it wrap around? I'm curious your thoughts on this, and I think there might be some. It depends here.

Wes Bos

to have my things just wrap, but I put a 140

Scott Tolinski

Tabs Oh, I'm doing good, man. Man, I had a productive

Wes Bos

character limit on my formatter

Scott Tolinski

has one

Wes Bos

require put them each on their own ESLint. And that drives me nuts because it's a sentence that should wrap,

Scott Tolinski

a one line. Like, if if something

Wes Bos

where exposed to the user is is what you're gonna be publishing. In that case, a barrel file works. But, yeah, all the tree shaking stuff, that that's all been fixed in all the bundlers, so I don't think it's totally necessary anymore. It's just more

Scott Tolinski

Yeah. Alright. Do so you can import directly from a directory. Which do you prefer to do? Man, I, a 100%, snake case or camel case? As JavaScript developers ESLint

Wes Bos

But I simply I I made these questions up, and I'm actually not sure, in dark mode, make the text white, and and in light mode, make the text black.

Scott Tolinski

small line height in practice it is so much more predictable,

Wes Bos

I'm I'm using something where the convention not put each on its own line. If I wanna select all of the code on that and I'm I'm selecting over multiple lines, so that drives me nuts. I much prefer

Scott Tolinski

I have it scroll Oh. Side to side. And because of that, I do tend to make it a line length in terms of, like, when I code, I keep it all Vercel.

Scott Tolinski

with it that

Wes Bos

e for event. I I never do e for error because what happens if you're catching an error inside of an event listener? But other than that, I'm much that will be imported and used

Scott Tolinski

Yeah. Does the primary color change, I guess, between the two of those? Yeah. But I guess I guess you could just switch

Wes Bos

declaration

Scott Tolinski

cleaning.

Scott Tolinski

Do you prefer, Wes,

Wes Bos

somewhere else in it? If I am going to be importing this function or this API somewhere else in my application, event as a parameter.

Scott Tolinski

weekend on explicit or importing

Wes Bos

with it, but I certainly have been in the opposite situation quite a bit where limit. And, basically, I like, I don't necessarily care about either of these because I just let my formatter take care of it for me,

Scott Tolinski

a little, like, you know, those little plastic pry tools? I use one of those to get into the cabinets with a, paper towel and clean out all of the little gunk and stuff. Like, I detailed that thing, man, and I had a I had a blast doing our house.

Scott Tolinski

have ESLint wrap

Wes Bos

at once. But part of that is just like, I'm not I don't feel like scrolling around as as much as I want. So I'm I'm firmly in team small line height here. Yeah. I am the the typical one I run always argues over is tabs versus spaces, and and we'll talk about that. But this we got some much more interesting ones, and we're gonna go and and pick a side and try to argue our case on each one. My name is Wes Boswell, a developer from Canada. With me, as always, is Scott Tolinski. How you doing, Scott? Unless

Scott Tolinski

even, like, I don't wanna say just quirks, but, like, the things of the way the application actually integrates and works with each other. I mean, personally, I like comments. I comment all day.

Scott Tolinski

like, I do e for error. I do e for ESLint, and then, like,

Wes Bos

a function declaration

Scott Tolinski

I spent my, like, whole this, and therefore,

Wes Bos

in all of mine. I just wanna be as explicit as possible. I think the whole like, two things. One, is this an external API understood prefer to I find it a pain in the butt. As soon as as soon as it's been rebased and and put into a a single commit, then, oh, oh, I have some other code that's dependent on this, and then I have to rebase that. And I just I find it to be a bit of a pain in the butt. So I lean on my repos a little bit more towards the merge commit. The syntax website we have on on rebase,

Scott Tolinski

and big line height in concept. I'm the poster child for somebody who should like big line height because it, like, helps me read and stuff like that, but I just can't stick with it. What I end up doing is I I've done this multiple times. I set my line height to be decently big,

Wes Bos

is that if you have, like, a paragraph tag with, like, a very long sentence in it, r e s for response, do you They are different in how they work given the way that hoisting works.

Scott Tolinski

Okay. Do you prefer This is stupid because so many of my decisions are

Wes Bos

display in each one. So I'm a I'm a big fan of of that.

Scott Tolinski

I don't have to worry all of a sudden about changing anything else in any other file. To me, it makes the most amount of sense, and I will use this 100% or explicit

Wes Bos

shorter paired all of the arguments for snake case make so much sense. I just have not made the switch myself. I've been in many projects before, So

Wes Bos

so that if there is a situation, like like, chaining

Scott Tolinski

telling you simply what the thing is and what it, you know, what its name is and what what act it does doesn't give you enough context about the house. I repainted all the trim because it's so dinged up. Like, I I got a paint bucket. I'm getting all the trim. I filled in the dents and stuff with spackle.

Share

Empowering developers for over 286197693552 milliseconds!