Are tests really that bad?

Поделиться
HTML-код
  • Опубликовано: 4 сен 2023
  • Today's video is a thought-provoking discussion about a recent Twitter poll that sparked debate in the tech Twitter (X). Would you choose Types or Tests if you could only pick one?
    🔍 What We Discuss:
    - The importance of Types and Tests in software development
    - Why Types won in a Twitter poll with ~51% over 12,000 total votes
    - PHP example that demonstrates the limitations of relying solely on Types
    - My opinion on why Tests offer a more comprehensive validation of code
    SOME OF THE WAYS YOU CAN SUPPORT THE CHANNEL
    👍 Smash the like button
    🤝 Subscribe to the channel & turn the notifications on
    💬 Post comments, any feedback is greatly appreciated
    ⭐ Become a Patreon: / programwithgio
    THANK YOU!
    🛠️ TOOLS & SERVICES I USE
    Digital Ocean Hosting - Get 100$ credit - m.do.co/c/38b935ad74e5
    Domains on Namecheap - namecheap.pxf.io/rnRjdQ
    Envato Elements - 1.envato.market/c/2937311/298...
    ** Affiliate Disclaimer: Some of the above links may be affiliate links, which may generate me a sales commission at no additional cost to you.

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

  • @FGj-xj7rd
    @FGj-xj7rd 9 месяцев назад +9

    I chose types, because the client is the test 😎

  • @hassanag.dd.369
    @hassanag.dd.369 9 месяцев назад +2

    I see also the tests is much more important and assuring than types.
    If you made a course about tests and TDD, that would be super nice.

  • @hectorluis9294
    @hectorluis9294 9 месяцев назад +2

    I understood the importance of testing over types when I had to upgrade the node version and key libraries in a Typescript legacy project with no tests 💀

  • @ScorpusMugnes
    @ScorpusMugnes 9 месяцев назад +3

    I can also go with tests although types are also important in the long run. Tests ensures future security and extensibility where as types only directs you in a better path of writing strict code to handle type errors, types prevent unneccessary type check like using if statements and other checks but tests comes in with a couple variations composed of solutions and confidence, tests can handle all errors -- even the logic ones as you said.

  • @donmikele07
    @donmikele07 9 месяцев назад

    Great video as always! But one thing is missing or I'm missing something: why we can't use both at the same time?

    • @ProgramWithGio
      @ProgramWithGio  9 месяцев назад +2

      You absolutely can & should. This was just a hypothetical poll and I was surprised by results so decided to share my opinion. In real world you probably will never have to make such decision to pick one or the other.

  • @stephen.cabreros
    @stephen.cabreros 9 месяцев назад

    well as you said I will choose test for validating logical errors and complex constructed objects.

    • @ProgramWithGio
      @ProgramWithGio  8 месяцев назад +1

      Good choice, although, you should really do both, tests + types

  • @walayat_khan
    @walayat_khan 8 месяцев назад

    Tests are more comfortable, but I will choose types only to avoid early bugs and avoid writting more checking, nothing else.

    • @ProgramWithGio
      @ProgramWithGio  8 месяцев назад +1

      Tests would help avoid early bugs as well & late bugs. But you should totally do both if possible

    • @walayat_khan
      @walayat_khan 8 месяцев назад

      @@ProgramWithGio sure

  • @Zubbee
    @Zubbee 9 месяцев назад

    I must confess that I run away from the idea of building tests. I'm thinking, if the application works, why do I need to build a test again? But watching this video reveals two things to me.
    First is, test are important. Maybe the apps I have made are yet too small for me to appreciate that.
    Second is that I probably avoid tests due to ignorance. I would need to look into tests more and not avoid them.
    With regards to the comparison, because of the way I was taught about types from "learn Php the right way", I don't think I ever had the impression that one (types) can replace the other(tests). Saw them as two different checks.
    Thanks for that Gio

    • @ProgramWithGio
      @ProgramWithGio  9 месяцев назад +1

      Yea for small apps sometimes it isnt worth the extra effort depending on what the app is doing. Both types & tests are important, this was just a hypothetical poll

    • @travholt
      @travholt 9 месяцев назад +3

      You don't write tests to test that an existing app works. You start by writing a test for the code/functionality you're going to write. This test will fail. Then you write code to make the test pass. Then you refactor the code to make it better, still running the test to make sure the code still works after refactoring.
      Then you repeat the cycle, adding tests for more code/functionality as needed, seeing the new tests break, and writing code to make them pass. When you're done, you run _all_ the tests again to check if what you just did broke anything else in your app. (And at some point it will; it happened to me just a few days ago, but the test clearly identified the error and I had it fixed in seconds.)
      I've been coding our website/app using test-driven development (TDD) for half a year, and it has been pretty slow going up until now. But at this point I can add new functionality with confidence because my test suite confirms that I don't break anything, or shows me exactly what broke and why.

    • @Zubbee
      @Zubbee 9 месяцев назад +1

      @@ProgramWithGio ok Gio. Thanks alot

    • @Zubbee
      @Zubbee 9 месяцев назад +1

      @travholt oh wow, this sounds great. I would like to be able to do this. I'm about to embark on a personal project much much larger than the projects I have done. Building up the code along with tests sounds like the best way to go about it. Just that I need to learn more about how to write tests

  • @kalvikaring1304
    @kalvikaring1304 9 месяцев назад

    i really like to know how to define type without test 🤔

  • @azengakevin2310
    @azengakevin2310 8 месяцев назад

    I concur

  • @dr_ned_flanders
    @dr_ned_flanders 9 месяцев назад

    Because everyone hates writing tests.