Turn Bad Code into Good Code (Javascript, TypeScript, Node, Jest, unit Testing)

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ต.ค. 2024

ความคิดเห็น • 50

  • @iyergh
    @iyergh 3 หลายเดือนก่อน

    Thank you for breaking this down so nicely and making it easy to understand. Completely agree with what Sapphiamur said below - Not all heroes wear capes.

  • @Sapphiamur
    @Sapphiamur 2 ปีที่แล้ว +13

    Not all heroes wear capes ;)! No, but seriously I'm starting to binge on your videos and I feel like you're one of the few yt lecturers who is so practical and actually helpful. I'm at the stage of my learning, where I struggle precisely with writing more readable, maintainable code and proper tests and you manage to choose example(s) easy enough to follow, but complex enough to explain the issues. I always found the other yt tutorials lacking the comparisons between good and bad code/ good and bad practice. It always seemed like something you can only improve if you're getting some sort of feedback on your program irl. I look at my code and I am fully aware it looks kinda all over the place, some functions are way too long, but what do I do exactly,, that's the question. It's hard to keep track of all the things you need to do >in the first place

    • @WebDevCody
      @WebDevCody  2 ปีที่แล้ว +2

      glad I could help! whenever you start getting that gut feeling that something is messy, it probably is time to refactor into smaller functions and separate into multiple files.

  • @ivansaidflores9198
    @ivansaidflores9198 หลายเดือนก่อน

    I love you content man, I am a junior developer and your videos are gold for my. This video has helped me more than many courses, thank you so much.

  • @ravenMK_
    @ravenMK_ 2 ปีที่แล้ว +4

    Beautiful and helpful. You thought we were going to lose interest but we were impressed.

  • @robiparvez
    @robiparvez 2 ปีที่แล้ว +4

    never watched your video before, but this one made me surprised. A lot of important things in just one video. Subscribed!

    • @WebDevCody
      @WebDevCody  2 ปีที่แล้ว +3

      Awesome! Hopefully I can teach you some more things in the future!

  • @shawn.builds
    @shawn.builds ปีที่แล้ว

    Everyone keeps telling me to learn testing, so I’m super thankful for this vid :)

  • @TomDoesTech
    @TomDoesTech 3 ปีที่แล้ว +6

    Great video! Testing is so important, I've been trying to include more testing in my videos.

    • @WebDevCody
      @WebDevCody  3 ปีที่แล้ว +4

      I’ve been debating just doing TDD videos on here. My views will probably drop, but no one really teaches testing

    • @TomDoesTech
      @TomDoesTech 3 ปีที่แล้ว +1

      @@WebDevCody I did one TDD video and people seemed to like it. The problem I have with it is that tests can get quite repetitive. Also, I think the people that are watching videos on YT to learn coding want to make stuff as quickly as possible and aren't ready to learn how to make good quality software yet.

    • @WebDevCody
      @WebDevCody  3 ปีที่แล้ว +2

      @@TomDoesTech I think the issue is tests can help a beginner understand what they are trying to build on the first place. I just recorded a video on the topic I’ll probably publish tomorrow, but I may start doing TDD videos or something. I’m glad you at least made a testing video

    • @TomDoesTech
      @TomDoesTech 3 ปีที่แล้ว +1

      @@WebDevCody It Will be interesting to see what people think. I hope they like them! Testing can be fun.

    • @ravenMK_
      @ravenMK_ 2 ปีที่แล้ว

      Yes Tom! Let's do a jest course lol.

  • @Sky-yy
    @Sky-yy 3 ปีที่แล้ว +4

    Helpful human being, missed you sir

  • @bandekhoda7801
    @bandekhoda7801 11 หลายเดือนก่อน +2

    Wow it was a really helpful video, especially the testing part since i was always skeptical of testing and just trusted my eyes and the console logs😅. Could you please also make a video about file or folder structures? Whenever i visit an open source repo, they have folders like utils, lib etc. I know it differs based on each project but I think it would be helpful to have a middle ground on where we should put our files and why the folders are named as such.

  • @lpdrummerboy
    @lpdrummerboy ปีที่แล้ว +1

    Dude, your videos are on fire! 🔥It almost makes me want to switch to full on TypeScript already over vanilla JS.

    • @WebDevCody
      @WebDevCody  ปีที่แล้ว

      It’s worth doing, I’ve wasted hours on simple js bugs

  • @ksisioO
    @ksisioO ปีที่แล้ว +1

    I wish to see more videos like this from you. Nice job.

  • @gilmoretj
    @gilmoretj 2 ปีที่แล้ว +1

    Hi Cody, Thanks for an excellent tutorial. I think you could have split this into a series given the breadth of material you covered but well done.
    I have been a Software Engineer for many years and am horrified but the number of TH-cam videos I see stating testing (and specifically unit testing) is not important, unjustifiably time consuming and costly.
    I fully support your comments that (to paraphrase) you cannot refactor a unit safely without having a unit test in place, and a unit is not finished unless you have a unit test to confirm it does what you (the developer) expected.
    On that last point; that is why I prefer to call them unit proofs rather than unit tests just so developers don't think they can leave it to the test team to create them.

    • @Toopa88
      @Toopa88 2 ปีที่แล้ว

      I haven't seen videos stating that testing isn't important. Rather, they don't mention testing at all or that it's not part of the video.

  • @Toopa88
    @Toopa88 2 ปีที่แล้ว +3

    28:00 I don't get this black and white thinking when it comes to writing comments. It doesn't automatically mean your code is bad if you use them. It always depends on the context.

  • @L0wPressure
    @L0wPressure 2 ปีที่แล้ว

    That is actually really helpful. I'm a typescript noob, and you pointed all the problems i definitely still have in my code.

  • @Туран141
    @Туран141 ปีที่แล้ว

    omg and testing and refactoring so much information , thank you

  • @集中-l7m
    @集中-l7m ปีที่แล้ว

    nice video to motivate me to write clean code

  • @partiid
    @partiid 2 ปีที่แล้ว

    This content is so great. I'm a mid node.js dev, i wish i knew this channel when i was getting started. Finally understood the purpose of testing :D

  • @nirrepluap
    @nirrepluap 2 ปีที่แล้ว +4

    The reason you shouldn't export a private function to test it is so you avoid making refactor a burden.
    If you export "implementation details"; there's high change this function could just be reused in other places as a utility function for me, and it might be the case for your "getAverageCourseGrade", it could just have been less aware of it's context, and just have been "getAverage(numbers: number): number"

    • @WebDevCody
      @WebDevCody  2 ปีที่แล้ว

      I don’t remember what I did in this video at this point, but yes if you can test without exporting private functions, it’ll make tests less brittle

  • @mumustemend2914
    @mumustemend2914 2 ปีที่แล้ว

    thank you so much this is the content i m looking for ♥

  • @jeremyAr
    @jeremyAr ปีที่แล้ว

    This is actually so helpful

  • @RdozeTV
    @RdozeTV 2 ปีที่แล้ว

    Exactly what developers should watching

  • @freedom13245
    @freedom13245 2 ปีที่แล้ว

    Really amazing video! Subscribed :)

  • @SeibertSwirl
    @SeibertSwirl 3 ปีที่แล้ว +2

    Good job babe!!!!!! What a coder!!!

  • @alessandrospiridigliozzi7943
    @alessandrospiridigliozzi7943 2 ปีที่แล้ว

    this was supeeer helpful, thanks!!! Please keep doing more videos like this one!!!!

  • @aashisharyal9704
    @aashisharyal9704 11 หลายเดือนก่อน

    Great video 💞

  • @siddhanttripathi5224
    @siddhanttripathi5224 ปีที่แล้ว

    that was pretty interesting

  • @nazaka9904
    @nazaka9904 2 ปีที่แล้ว

    It is sooo helpful, thank you

  • @ManfredSpecht
    @ManfredSpecht 5 หลายเดือนก่อน

    Nice video. Is there a chance, that you make the original code available for download, so I can make my hands dirty?

  • @NuNagames-zf8fm
    @NuNagames-zf8fm ปีที่แล้ว

    I have a question, when you removed the data to the test file, where did you get data to test the code after being removed?

  • @sebastienmorneau3767
    @sebastienmorneau3767 2 ปีที่แล้ว

    Great video!

  • @ryanwoods3333
    @ryanwoods3333 ปีที่แล้ว

    thank you!
    how did you become so good at unit testing?
    it seems there isn't a whole lot of content out there that goes beyond the basics.

  • @ELY-qg2vn
    @ELY-qg2vn 4 หลายเดือนก่อน

    MOAR PLS

  • @federicotomadin5130
    @federicotomadin5130 ปีที่แล้ว

    Great explanation !. What is the link from github repo ?

    • @WebDevCody
      @WebDevCody  ปีที่แล้ว +1

      don't remember at this point

    • @federicotomadin5130
      @federicotomadin5130 ปีที่แล้ว +1

      @@WebDevCody I looked for it in your github repo but I didn't found

  • @EdgarLopezAnaya
    @EdgarLopezAnaya ปีที่แล้ว

    what is vs code theme name?

  • @ajhughesdev
    @ajhughesdev ปีที่แล้ว +1

    28:01 👎

  • @ruyvieira104
    @ruyvieira104 2 ปีที่แล้ว

    good and old null students, yeah. always the troublesome kind. null people.

  • @korkut31
    @korkut31 ปีที่แล้ว

    outdated..