3 Minutes with Kent

3 Minutes with Kent

By Kent C. DoddsTechnology
Download on the App Store

All 3 Minutes with Kent episodes

  • Single Letter Variables (and Types) Considered Harmful

    Hey there friends Today is January 11th 2021, and I want to talk about

    single variable names in TypeScript. Well think of variable names in
    general, but for some reason in TypeScript when we're making like generic
    types or type names whatever we've just I don't know where it came from.

    I guess people say it came from C sharp and stuff they do this, but using

    the letter T to denote the type force like a generic or something. Pretty
    ridiculous. I mean, there are some situations where it's obvious that like
    what what the types are.And there's no real better name necessarily
    assuming that everybody understands the convention that T stands for type.

    But there are so many cases where you've got a couple of different types

    that you're providing. Each one has a unique purpose and we could just
    communicate that purpose with a actual variable name but instead for some
    reason we're using single letter variables. I'm not sure where this came
    from but it does need to stop please stop doing this and just use a
    descriptive variable name.

    And now like this is more like in general, I just noticed.This a lot with

    TypeScript definitions you know And it's fine if it's like you're inside of
    your own little function and you know like with a map or something we are
    mapping over some data and you use D or whatever.

    I don't really care about that. I'm just talking about when you're exposing

    types to consumers. You wouldn't have like a single letter function that
    your consumers are calling or or like objects with single letters for D is
    duration, like nobody knows that. So given an actual variable name so that
    people know what they're working with and what they need to pass.

    As those arguments and we're better I don't like I feel like we don't need

    to have this conversation because it's kind of one of those things that we
    just everybody knows a single letter variable names not a good thing. Types
    are no different make your types longer variable names so that we know what
    those things are for.

    It's kind of a rant but I yeah just keep in mind that people if you're

    going to expose something as like for other developers to use the
    developers are going to use them and they may not know what you're talking
    about when you.Using single letter variables. So yeah, that's all that.

    I have to say about that. I hope you have a stellar week and we'll catch

    you all around. Bye.

    3 min
  • Why I'm Going 100% TypeScript in OSS and Teaching

    Hello friends it is January 9th, this is a Saturday and I guess I'm

    recording this on a Saturday, okay, so um, I wanted to talk about today
    type script and why I am starting to think that I'm gonna be doing my
    material and typescription stuff so first of all, I started using
    TypeScript right toward the end of my time at PayPal we had been using flow
    for a long time and and I liked it it was okay, but it was very clear that
    TypeScript was gonna be the winner of this game and so I decided let's
    switch over to type.

    Script so I made PayPal scripts completely. TypeScript supporting project

    and everything and and then the template I made default to type script and
    everything so like I was all in and I type script the PayPal or PP React.
    React component library that I was working on was completely in TypeScript
    and then I went full-time educator and I stopped using TypeScript and the
    reason that I have never used or I had never used TypeScript in my open
    source or in my instructional material is because I didn't wantIt to be a
    barrier for people So with open source I didn't want it to be the sort of
    thing that people couldn't contribute to open source because they didn't
    know TypeScript.

    And for my my educational content, I didn't want to make it so that people

    couldn't enjoy my educational content because they couldn't they didn't
    know type script. And so like it would just drastically limit the number of
    people who could benefit. So a few things have changed for one for the
    whole time with my open source stuff.

    I always use that as an excuse like no, I don't want to be a barrier for

    people butLike I knew that was bogus because anybody who's going to
    contribute to my project also needs to write some tests and that's
    basically what TypeScript is So they are going to need to learn how to
    write the tests and so yeah, it ends up being six is anyway, like if they
    don't know how to write test they're going to commit it and will help them
    write the test that'll be the same with text script.

    And for my educational content, I talked with Ryan Florence about this and

    he told me that a long time ago, they went full on TypeScript and a big
    reason was because a lot of them were like a lot of the people they were
    teaching were already using TypeScript and also it like you don't have.

    To go full on TypeScript on the educational material so like the people who

    don't know TypeScript they don't have to add types if you configure
    TypeScript correctly and then those of you or those people who are using
    TypeScript regularly and know it they'll get the editor hints and
    everything and and even if you're not using TypeScript yourself, if you're
    consuming an API that exposes types you get editor hints and everything's
    really nice.

    So it ends up being a better experience for everybody and so that's why I'm

    gonna be switching completely over to TypeScript and I'll probably have
    something there to help people who don't know TypeScript yet as well. So
    anyway, hope you have aSplendid day. Bye.

    3 min
  • Remix means I'm not excited about React Server Components

    Hello there. Friends, it is a little late for me. I was hanging out with

    the family today, but I did want to get my three minute podcast in for
    today and so I'm doing it while I am changing laundry. So what I wanted to
    talk about today was just a little bit about reactor server components and
    that thing that everybody's super excited about I think we have good reason
    to be excited.

    It I'm not going to explain exactly what it is. So you have to go Google it

    and and get an idea there's a video with.Stuff. But yeah, my initial
    reaction to it was pretty met just like huh. And what's interesting is that
    like this is probably not not quite as big as hooks at all but it is like
    some progress on the whole solving the problem that suspense and concurrent
    mode is supposed to solve or at least helping solve some of those problems.

    And so it is a big deal and there's a lot of cool things that it does. But

    the reason that I was so just like,Not impressed or not super interested.
    It isn't because it's not impressive and it's not like great in whatever
    but because I discovered solutions to most of these problems that it's
    intended to solve just a few months ago when I started using Remix and a
    remix if you haven't heard is Ryan Florence and Michael Jackson's business
    that they're working on this this paid software project.

    That's a framework for react and it is phenomenal. Seriously, it is so

    good. I'm really happy with it and it's currently like pre-beta like Alpha
    stage software so you know, I'm actually paying to as like a developer
    preview sort of thing to to use this and and learn about it, but anyway,
    yeah, it just solves all these these problems so if you haven't given a
    remix of solid look yet and then I would advise that you.

    Do you don't have to become a developer preview, you know paying subscriber

    anything. It is not software that you should ship to production and
    necessarily but it is going to really shake things up I think. So yeah give
    remix a look it solves many of the problems that react server components
    are going to solve and it does so in a way that I just think is remarkable
    really good stuff.

    And yeah, I feel like there's something else I was going to say about that,

    but that's that's it. That's my,Three minutes. Hope you're having an
    awesome day and we'll catch you later. Bye.

    3 min
  • Consider Long-Term Impacts and Deletability

    Hi there friends So today I wanted to talk about how a water damage thing

    that I discovered in my house and it relates to software. So a few days
    ago, we discovered in two of our closets in the basement that we have some
    water damage on the baseboards and the carpet.

    And we had no idea where this came from or how long had been or where it

    came like what the cause of the the problem was. So, I eventually found out
    that it was our water or not our water heater, but the furnace and it has
    some condensation and so there's this.

    Pipe that will take that condensation out of the house and there was a leak

    there just a little small little leak that it would drip like maybe once a
    minute not very much but this had clearly been going on for months and we
    just never noticed and eventually, you know, really damaged our baseboards
    and and the carpet and everything.

    So that would that's super annoying because now we're gonna have to you

    know, replace a bunch of stuff and it's gonna be expensive and we have
    homeowners insurance but yeah, what a pain. So I always thinking about how
    this is related to software.And that like there are often little things
    that you may or may not know about in your software that like little
    abstractions that grow over time or little things that you need, you know,
    you need to deal with but you never make time for them because by
    themselves they're not like a really big deal.

    Like for us we we didn't know about this, but there was this little drip

    and it really wasn't a big deal but after a long amount of time that turns
    into something just so much worse. And it's always this balancing act ofDo
    I invest a bunch of time into making this thing not so bad.

    So like how do I spend some time fixing this problem or do I just let it

    continue to be a bit of a problem because it's not that big of a problem.
    It doesn't justify the time that would take to make it better. And like you
    with software like with the house that's that's a little bit different but
    with software you can so easily just throw stuff away and so you need to
    also consider like if I work on this and and make this aspect better.

    Will that actually return on my investment or do we end up to deleting that

    feature completely and get rid of all of that code and stuff. And so my
    investment into making that code better is just gone. And we don't really
    do that with homes, but yeah, it was just something that was kind of on my
    mind of a you know, it's something to keep in mind that when you do have
    little problems that seem, you know, the subtraction is in all that great
    and so you slip through a code review or whatever.

    But think about the long-term impact of those things and also consider the

    deletability of things. I hope that'sAt least interesting. See you later.

    3 min
  • Why I don't have tests for my blog

    What is up my friends so I'm a little bit late today, sorry but it is

    January 6, 20 21 and I'm excited to talk about testing so I had a bug on my
    website kidsdance.com slash contact where you'd fill out a contact form and
    one of the things that happens is server side validation, so that uses a
    serverless function that I have running on Netlify, it is great, it's
    awesome the way that it works but yeah one of what it does is it uses a,NPM
    module called OW to do validation and on my website.

    I pretty much just like every week when I write a blog post I just update

    all the packages sometimes. I'll take a look at some of the breaking
    changes like major version bumps and stuff but often I just like I pull up
    and ship it because I don't really care and that's actually kind of what I
    wanted to talk about is.

    I I do have some tests on my website. I have one or I,Handful of unit tests

    and then a cypress test that just makes sure that you can pull it up and
    and click on this on a link and stuff so I know that at least it does open
    but I didn't have any sort of test for my contact form which is why this
    bug slipped out but here's here's the reason why I haven't invested any
    time into testing my own site, which is kind of like a lot of people would
    think that's paradoxical like hold on a second can't see.

    Dodds doesn't even test his own website, well the thing is that I think

    that it's important that you measure or that you think about.The things
    that you have to do all relative to one another and that includes tests so
    tests is just another task on your list of things to do and you need to
    think consider things relative to their return on the investment and for me
    writing some tests for my website has a pretty low return on investment
    frankly, like if something breaks it's not a huge deal.

    I'm not like taking people's money there or storing their you know, secure

    information or anything like that, it's not like a big deal of something
    breaks and that was the case here somebody sent me an email and said, hey
    your contact form is broken and that's why I sent you.

    Direct email so yeah maybe I missed a couple of contacts you know people

    saying trying to contact me but actually I don't really care how much so
    yeah so it ended up not being a big deal. I fixed it and I pushed that out
    and hopefully the context form is working now but I just wanted to talk
    about that.

    I do have a blog post actually about this, you know, whether you should fix

    the bug or write a test, you know, just how you prioritize testing and for
    me, I prioritize it like everything else that I do just consider the return
    on investment and focus on the highest return hope that's helpful have a
    wonderful day.

    3 min
  • Watch your own talks

    What is up friends it is the fifth of January Tuesday 2021 and today I want

    to talk about why I watch my own talks and workshops and listen to my own
    podcasts and all that stuff so I know a lot of people who give talks and
    say that like one of their least favorite things to do short of talking in
    front of people is listening to themselves talking front of people and I I
    don't share that feeling.

    I I don't dread listening to myself talk on like,Podcasts or wherever I but

    I I it's not like I just do it as a what's the I can't remember the word so
    many just loved myself whatever that word is but um, the reason I was
    thinking about this was just because in my blog post that I was yesterday,
    it was my review of 2020.

    I mentioned how like I think it's important to review your you know, how

    things go and so I said that I watch almost every talk and video.Cast that
    I produce and I use that as an opportunity to identify ways to improve and
    I think that that's really important so if you're the type of person that
    just like hates hearing yourself talk or whatever I think that I mean,
    that's that's fine but maybe get over it because how can you identify ways
    to improve the way that you deliver a talk or the way that you created a
    video or the podcast that you recorded whether you're the host or the guest
    how can you identify ways to improve if you don't.

    Review that material so this is just an invitation to you to find some

    content that you've created or whatever and give it a little review and try
    to look at it from the eyes of somebody who doesn't know the subject matter
    and see if or or yeah really just look at it through the eyes of your
    intended audience and see if you deliver the material in the way that your
    intended audience needs it to be delivered and maybe you can take notes.

    I don't really take notes.When I go through this stuff, but maybe you could

    and see ways that you could improve that so anyway. I hope that's helpful
    to you and I hope you have an awesome day and do check out this review of
    2020 on my blog KCD to IM / blog and then you'll find 2028 review okay,
    that was fun happy day, we'll see you around bye.

    3 min
  • Things Change Constantly

    Hey there friends. This is your friend Kent on Monday January 4th 2021, and

    today I just wanted to talk about how things change constantly. So I was
    updating the bookshelf app the app that we built together on Epic React.dev
    and just realized that there are a handful of well actually.

    I think only one major thing that has changed since I released this and

    that is React query version 3 came out. And it's just it would there are so
    many videos that that impacts.Even though the impacts themselves are
    relatively small it just like destroys so many of the videos I had to
    re-record all of those.

    And yeah, so I was just thinking about how things change and not only do

    our dependencies change but like the way that I recommend to doing things
    change and also like there's another one of the workshops the testing react
    apps in there. I have one exercise where we're dealing with a hook that
    allows you to get the geolocation of the current user.

    And so we're mocking that out, of course, you wouldn't be able to do that

    in a test because like,If you run it locally on your machine it's gonna be
    one place and if you run it on CI it'll be a different So even if it was
    supported in the environment you're gonna want to mock it out.

    Anyway, so the way that I approach doing that was a little complicated

    because you had to use act directly and somebody just recommended hey, why
    don't you use wait for element to be removed you wait for the spinner to go
    away and and then you don't have to use act directly and so like little
    things like this come up all the time and and I say well, you know the way
    that I showed works and and I would like it.

    It's it's a reasonably good way to solve this problem.But your suggestion

    is is arguably better. So I would suggest going with that. And so yeah,
    we've got things that change because just developers make cooler new things
    and then we've got things that change because the ideas are new and things
    and testing JavaScript has gone through this as well.

    And it's I guess I don't really have a whole lot positive to say about

    this, but it's it's just something to keep in mind that things are always
    going to change and you can't just wait for the next thing to to come
    out.All ways because you're always going to be waiting It's like waiting
    for you know the new addition of the best car You're always going to be
    waiting.

    There's always going to be a better car. So you just buy the one that you

    can afford right now that accomplishes your purposes and then just close
    your eyes anytime there's the new one out or something like that, but we've
    got to bet on technologies at some point and you've got a bet today.

    So just make the best decision and know that it's impossible to make a

    perfect one and do the best which with with what we have today. I hope you
    have an awesome day. We'll see you all later.

    3 min
  • New Year, Daily Planning

    What up friends this is Kent C. Dodds on three minutes with Kent and I am

    here it's a 21st or the yeah 2021 the first of January and I've been
    thinking about a lot of things, you know, you've got New Year's resolutions
    and stuff and my New Year's resolution my word of the year is planning so
    what I was in fifth grade, I was homeschooled and by my mom she has a
    degree in elementary education, so she homeschooled me and my two sisters
    that right my little sister and sister.

    To just older than me and we it worked out really well for me at some point

    after a month or so of of going through homeschool. I started wanting to
    get my school done really quickly and my mom was just like well, I've got
    to take care of your sisters too, so I'll just write down a list of all the
    things that you have to do and then you can do them whenever you want
    because I was I was pretty like a self-starter and so yeah, she would write
    it down the night before and then in the morning I would wake up sometimes
    around like,Four or five I'm not not too much later than that though and I
    would get working I would stop for a little bit to have breakfast with the
    family while the rest of the my siblings went to school and stuff and then
    I get back to it and I'd finish my school for the day like nine or ten in
    the morning and then I have the whole day to do whatever I wanted
    unfortunately at the time lots of what I wanted to do was hang out on the
    computer playing games and stuff which are not proud of but it like I
    changed a huge amount during that time.

    I became much more of a self-starter and and a very task-oriented.And

    goal-oriented it made a huge impact on my life, so yeah, I was just super
    productive so I've been thinking about that and just kind of wanting to
    have that level of productivity back and so for this year.

    I'm gonna be I I have a notebook that I'm gonna be using to write down what

    I'm supposed to do and the next day just like my plans what the things that
    I want to make sure I do and it's not like super planned out or anything
    like not the time of day necessarily but it's just like here the things
    that I'm going to accomplish tomorrow.

    And I've tried it the last couple days and I haven't been like working or

    anything it's been like family stuff but it's been working pretty great so
    that's what I'm gonna be trying to do. I hope you all had a wonderful new
    year so operation and have a great start to your new year.

    I think one of the things that I'm gonna try and plan is every weekday.

    I'll I'll do something here on the three minutes with Kent podcast, so if
    you want to subscribe and keep up with my journey, it'll be around like
    coding topics and just life topics and stuff like that three minutes on
    hope you have a wonderful day bye.

    3 min