Code Review with a Jr JavaScript Developer - Here's What I Found!

Поделиться
HTML-код
  • Опубликовано: 12 июн 2024
  • I made these 5 suggestions throughout a 2 hour code review with a junior JavaScript developer.
    *Newsletter*
    Newsletter 🗞 - www.jamesqquick.com/newsletter
    *DISCORD*
    Join the Learn Build Teach Discord Server 💬 - / discord
    Follow me on Twitter 🐦 - / jamesqquick
    Check out the Podcast - compressed.fm/
    Courses - jamesqquick.com/courses
    *QUESTIONS ABOUT MY SETUP*
    Check out my Uses page for my VS Code setup, what recording equipment I use, etc. www.jamesqquick.com/uses

Комментарии • 19

  • @jesper.ordrup
    @jesper.ordrup 3 месяца назад +20

    I like to decontstruct variables but you could argue against. If you dont deconstruct you automatically get a good descriptive name: subscriber.email says a lot about which email you refer to.

    • @keithjohnson6510
      @keithjohnson6510 2 месяца назад +1

      Spot on, I would say avoid using them just because there cool.. :) But what worries me more for James is the advice on error handling.. :(

    • @jesper.ordrup
      @jesper.ordrup 2 месяца назад

      @@keithjohnson6510 Thanks. I also encourage this approach when importing modules

    • @SonAyoD
      @SonAyoD 20 дней назад

      @@keithjohnson6510why?

  • @gosnooky
    @gosnooky 3 месяца назад +4

    The joke is the two hardest things in programming is cache and naming things.

    • @deadlyecho
      @deadlyecho 3 месяца назад

      Well, I am pretty bad at naming things 😂😂

    • @jlmx
      @jlmx 3 месяца назад +1

      And off by one errors

    • @jlmx
      @jlmx 3 месяца назад +1

      The joke being that you list three things

  • @sujoykrhaldar
    @sujoykrhaldar 3 месяца назад +1

    Learned something new regarding err handling,
    throwing err as obj key and use it for checking a condition.
    Thank you.

  • @benpluim7685
    @benpluim7685 2 месяца назад

    Loved this! Especially the view of typescript at the end. Im just starting a new role in a few weeks and I'm always looking to improve my code so that reviews are seamless!

  • @gregmunro90
    @gregmunro90 3 месяца назад

    Thanks for the video, very useful. What vs code theme is this?

  • @SeRoShadow
    @SeRoShadow 2 месяца назад +1

    1. Object Properties 0:27
    Never check if an object has a property by accessing its value:
    If it doesnt have it, the code wont run ; GOOD
    if it has it and is nullable (undefined / null) , the code wont run ; BAD ; sometimes nullable values are expected and this is true especially when fetching data
    use hasOwnProperty method on the object instance instead or iterate over the project keys to find the match, then code accordingly.
    personally, I prefer a custom function, hasOwnProperties() , that takes in one value, primitive or array, then checks for matches in object props for every value.
    2. Using shorthand notation 1:57
    I disagree with that since if the code will ever require refactoring, the changes will have to cascade all they way, otherwise the code will not work properly.
    I personally write the longhand notation so that code style is consistent and the small changes wont require refactoring the entire codebase

    • @keithjohnson6510
      @keithjohnson6510 2 месяца назад

      1. I tend to use `in`, mainly because it helps with Typescript , type narrowing.
      2. I wouldn't say I disagree with shorthand notion, but would agree that use it with caution. In other words, don't use it as cool factor, if using shorthand notification loses intent, then you have made harder to debug code.

  • @RobertMcGovernTarasis
    @RobertMcGovernTarasis 3 месяца назад

    Curious, with autocomplete being a thing, isn’t it better to be explicit with subscriber.email vs simply email. Keeps it clear where that variable comes from?

  • @hunterbertoson156
    @hunterbertoson156 3 месяца назад

    There are 2 hard problems in programming: cache invalidation, naming things, and off-by-1 errors.

  • @jlmx
    @jlmx 3 месяца назад

    Return types FTW 💪

  • @nidinpereira5898
    @nidinpereira5898 3 месяца назад

    Destructuring has its downsides, if email is undefined, everything is going to break down.
    Doing a safety check first is always better, even if it requires writing a few extra words

    • @keithjohnson6510
      @keithjohnson6510 2 месяца назад +1

      That is true, but if say using Typescript like James is doing and `email` has come from a type that's not optional, then that can't happen, and if it was optional the nice thing with Typescript it would warn or error for you too. I would say that is one of the nice things with Typescript, sanitising data only needs to be done once, passing data down the call stack will have implicit type checking, saving on extra checks.

  • @WebDevCody
    @WebDevCody 3 месяца назад

    Soon you’ll be writing go