Effortlessly Write Bug-Free Code

Поделиться
HTML-код
  • Опубликовано: 30 июл 2024
  • Discover the secret to writing bug-free code effortlessly! In this video, we'll look into the powerful technique of using type systems to ensure your programs are safe and error-free without any extra effort. You'll learn some type systems basics, their incredible benefits, and see examples that demonstrate their effectiveness. Whether you're a beginner or an experienced developer, this guide will help you write safe and bug-free code.
    Don't miss out on this essential tip for enhancing your programming skills!
    Frankly Developing is here to support you on your journey of becoming a better developer. Small episodes on various topics all around software development will help you learn and understand more about this important craft.
    Timestamps:
    00:00 Intro
    00:27 Type System Basics
    04:30 Examples
    08:26 Type System Tricks
  • НаукаНаука

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

  • @averydavis8568
    @averydavis8568 24 дня назад +3

    Old school C/C++/Java developer looking at dynamic language coders suddenly finding utility in a "type system" be like 🤭 you just figured that out huh?

    • @FranklyDeveloping
      @FranklyDeveloping  24 дня назад +2

      Indeed.. pretty much well known since the 70ies.. like most things development. But then again, some weren't even born at that time, so it's maybe worth repeating.

  • @hatiko8227
    @hatiko8227 23 дня назад +1

    Feels like in the last example with RocketWithFuel and RocketWithO2 if we bring this approach to more complex example with more complex invariants this will be messy (not speaking about performance). I think we need some kind of compile time asserts for this, but don't sure how it will look like.

    • @FranklyDeveloping
      @FranklyDeveloping  23 дня назад

      If you mean messy as in many classes for combinatorial variants, then yes. What we usually do in those cases is something like the builder pattern to ensure invariants on the final objects only.

  • @EMWMIKE
    @EMWMIKE 23 дня назад +1

    Can this pattern be used when doing the mapping to an external api request and the request model is built up by different classes?

    • @FranklyDeveloping
      @FranklyDeveloping  23 дня назад

      Yes of course. You may not always have the compiler to check it automatically, but a good API similarly tries to limit the number of invalid or inconsistent requests that can be possible. Less checking needed, less errors possible.

  • @adrianstephens56
    @adrianstephens56 22 дня назад +2

    Clickbaity title. You cannot effortlessly write bug-free code of any non-trivial complexity. And then there's the question of how you test it, which often consumes more effort than writing the code in the first place.

    • @FranklyDeveloping
      @FranklyDeveloping  22 дня назад

      I grant you the maybe clickbaity.. but there is no need to test! The point of using the type system is that successful compilation is already a way stronger correctness than any automated test could give you (limited to what you can express in the types of course).

    • @adrianstephens56
      @adrianstephens56 22 дня назад +2

      ​@@FranklyDeveloping I'm sorry, and with respect, but I have to disagree with you. I wrote software professionally (mainly C) for 20 years. Proving that a function or program or system meets its requirement is what I mean by testing. If we take the old chestnut of a sort function, I don't see that a type system addresses typical bugs such as "out by one" on an integer (e.g. a loop count) that might leave an unsorted number at the end of the list. Easy enough to test - just give random input data and check it's all in order. I don't see how your type system addresses this kind of programming bug.

    • @FranklyDeveloping
      @FranklyDeveloping  22 дня назад

      Nah.. we agree on that! As I said, you can only get as far as the type system supports. That means you can avoid some bugs, not all.

    • @greyshopleskin2315
      @greyshopleskin2315 13 дней назад

      @@FranklyDevelopingI like static types but this is bullshit.
      No need to test? Type system gives stronger guarantees than any test? Crazy, very crazy