Our favorite things in .NET 8 - David Fowler & Damian Edwards - NDC Sydney 2024

Поделиться
HTML-код
  • Опубликовано: 24 ноя 2024

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

  • @JoeIrizarry88
    @JoeIrizarry88 5 месяцев назад +7

    Default for "var x = []" should be list. Never in my life have I wanted an easier way to create an empty array except when passing as a parameter. What would it's use case be?

    • @hahnkev
      @hahnkev 5 месяцев назад +1

      That makes sense. But what about "var = [5]"? You could argue it should be an array. But then you get a list when it's empty and an array when it's not? That doesn't make sense.

    • @JoeIrizarry88
      @JoeIrizarry88 5 месяцев назад +1

      Very valid point if consumers of the syntax are using it as a shorthand for existing types. Also Agreed that would be unexpected unless it’s defined behavior.
      Consider whether the compiler can infer the best type based on how it’s used in the same way it does when the left hand side is defined.
      If I mutate, give me the best mutable type. If I don’t, the best non-mutable. If I return it as a span, consider that. Or if I return an IEnumerable, please do the best there.
      When I see the syntax it kind of kicks me into a more dynamic context. We have anonymous objects, anonymous methods, lambda expressions which generate expression trees (not IL methods), and now we even have anonymous delegates with default parameters.
      Could this syntax be anonymous collections? Basically says “I don’t care about the underlying type, please use or create the best one that fulfills my needs based on local usage”. I say local because this syntax in a field or property wouldn’t work if it was anonymous and I think that’s ok.

  • @Pentracchiano
    @Pentracchiano 5 месяцев назад +11

    Title is wrong, it's David Fowler, not Damian Fowler 😊

    • @slang25
      @slang25 5 месяцев назад +4

      I like the idea they've done so many talks together they are just "Damian Fowler" now 😄

    • @cokert3
      @cokert3 5 месяцев назад +10

      I hope “Scott Toub” becomes a thing.

  • @pkop4
    @pkop4 5 месяцев назад +18

    Turn off copilot next time. Ruins the presentation

    • @codder32
      @codder32 5 месяцев назад +2

      no it doesn't. It shows real life usage of copilot...

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

      ​@@codder32this isn't a copilot talk

    • @codder32
      @codder32 4 месяца назад

      @@jamesl5149 this isn't a visual studio talk maybe he should go in notepad. Wait this isn't a notepad talk...
      Tools are tools, it's a tool a lot of people use with C#, its related

    • @alfflasymphonyx
      @alfflasymphonyx 4 месяца назад

      @@codder32 not everyone uses Copliot

    • @codder32
      @codder32 4 месяца назад

      ​@@alfflasymphonyxnot everyone uses visual studio and no one's crying that they're pushing VS?
      Not everyone is on windows, maybe we should ask them to program in notepad to make everyone happy?

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

    anyone know what is the light theme he is using?

  • @BryonLape
    @BryonLape 5 месяцев назад +11

    I'm old enough to remember when constructor injection was considered bad.

    • @modernkennnern
      @modernkennnern 5 месяцев назад +3

      What was considered best practice at that point? Method parameter injection?

    • @evarlast
      @evarlast 5 месяцев назад

      @@modernkennnern probably property injection. tons of cargo cult bad/good that doesn't really matter

    • @alexisfibonacci
      @alexisfibonacci 5 месяцев назад +1

      @@modernkennnern property injection. You always had factory or strategies to construct your objects and stitch things together. Constructor injection to my mind simplifies things. And you can hold a reference to IServiceProvider to do other resolutions as you need them.

    • @mvonballmo
      @mvonballmo 5 месяцев назад +1

      @@alexisfibonacci You can hold a reference to IServiceProvider but you almost never should. 🙂 Instead, you should pass in a more specific factory, if you can. Otherwise, it's no longer possible to see which types a type depends on -- it can create whatever it likes with the IServiceProvider. Sometimes you need this, like when you're instantiating plugins from a configuration but it's rare.
      To the OP, I don't know why constructor injection would be considered bad. It allows you to see a type's dependencies and reason about your code more easily. If a type has everything it will ever have when it's constructed, then there are far fewer code paths to consider.
      There are always exceptions, of course, but the general direction should be to inject simple types (i.e., not IServiceProvider) in the constructor ... and make properties read-only. 🙂

  • @Kitulous
    @Kitulous 4 месяца назад

    26:40 a docker container uses a system kernel and it uses system clock, so it wouldn't work anyways. you need a vm. or just run all tests in serial and modify system clock every time

  • @alfflasymphonyx
    @alfflasymphonyx 4 месяца назад

    what's the point of private fields in your can change their values via reflection.
    Getting a list of private fields, I'm ok with this but we should not be allowed to change their values.

  • @MorleyJamie-t5k
    @MorleyJamie-t5k 2 месяца назад

    Hall Michael Thompson Deborah Thomas Betty

  • @catfishfortesque-smythe437
    @catfishfortesque-smythe437 4 месяца назад +2

    What's with all the silly noises?
    Unwatchable.