Live data from Hacker News

What .NET 10 GC changes mean for developers

roxeem.com

151–160 of 253 posts

Re: What .NET 10 GC changes mean for developers

#151
post #76

Earlier quoted context omitted.

As polyglot developer, I also disagree. If I wanted explicitness for every little detail I would keep writing in Assembly like in the Z80, 80x86, 68000 days. Unfortunately we never got Lisp or Smalltalk mainstream, so we got to metaprogramming with what is available, and it is quite powerful when taken advantage of. Some people avoid wizard jobs, others avoid jobs where magic is looked down upon. I would also add tha…

Explicitness is different than verbosity. Often annotations and the like are abused to create a lot of accidental complexity just to not write a few keywords. In almost every lisp project you'll find that macros are not intended for reducing verbosity, they are there to define common patterns. You can have something like (define-route METHOD PATH BODY) You can then easily expect the generated code. But in Java and ot…

Only if those Lisp projects are done by newbies, Clojure is quite known for having a community that takes that approach to macros, versus everyone else on Lisp since its early days.

Using macros for DSLs has been common for decades, and is how frameworks like CLOS were initially implemented.

Re: What .NET 10 GC changes mean for developers

#152
post #99

Earlier quoted context omitted.

All great and dandy, except tooling still sucks. You still need to usually install plenty of moving pieces to produce a wasm file out of the "place language here", write boilerplate initialisation code, debugging is miserable, only for a few folks to avoid writing JavaScript.

I think you may be underestimating how many people really dislike JavaScript.

As many that dislike PHP, C, C++, yet here we are.

Re: What .NET 10 GC changes mean for developers

#153
post #55

I am considering dotnet Maui for a project. On the one hand, I am worried about committing to the Microsoft ecosystem where projects like Maui have been killed in the past and Microsoft has a lot of control. Also XML… On the other hand, I’ve been seeing so many impressive technical things about dotnet itself. Has anyone here used Maui and wants to comment on their experience?

I have used MAUI at my previous job to build 3 different apps, used only on mobile (Android and iOS). I don't know why many people dislike XAML, to me it felt natural to use it for UI, I researched flutter and liked MAUI/XAML more. Although the development loop felt smoother with flutter. What I didn't like was the constant bugs, with each new version that I was eager to update to fix current issues, something new appeared. After spending countless hours searching through the projects GitHub, I am under the impression that there aren't much resources dedicated to MAUI development from Microsoft, the project is carried forward by few employees and volunteers. If I would start another project I would seriously look into Avalonia. But I always was a backend guy so now at my current job I do server backend development in C# and couldn't be happier.

Re: What .NET 10 GC changes mean for developers

#154
post #144

Earlier quoted context omitted.

Not a single user cares about "native ui", it's only a debate among developers. Take the top 20 apps people are using, all of them use their own design system which isn't native. Flutter will always have multiple advantages against React Native (and even Native toolkits themselves) in terms of upgradability, you can do 6 months of updates with only 30mins of work and make sure it 100% works everywhere. The quality of…

Classic HN comment with unapologetic statements. If Flutter were that good, it wouldn't have flatlined so fast after the initial hype a few years ago. I tried it last year, only to see rendering glitches in the sample project.

Rendering glitches may be due to completely new, lightweight rendering engine made from scratch, that has replaced Skia. Shoudn't be a problem when it matures a bit.

Re: What .NET 10 GC changes mean for developers

#155
post #141

Earlier quoted context omitted.

You are missing the forest for the trees. C# has increasingly become more terse (e.g. switch expressions, collection initializers, object initializers, etc) and, IMO, is a good balance between OOP and functional[0]. Functions are first class objects in C# and teams can write functional style C# if they want. But I suspect that this doesn't scale well in human terms as we've encountered a LOT of trouble trying to get…

I notice that none of the examples in your blog entry on functional C# deals with error handling. I know that is not the point of your article, but that is actually one of my key issues with C# and its reliance on implicit, because like so many other parts of C# you'd probably hand it over to an exeception handler. I'd much rather prefer you to deal with it explicitly right where it happens, and I would prefer if you…

My team just recently made the switch from a TS backend to a C# backend for net new work. When we made this switch, we also introduced `ErrorOr`[0] which is a monadic result type.

I would not have imagined this to be controversial nor difficult, but it turns out that developers really prefer and understand exceptions. That's because for a backend CRUD API, it's really easy to just throw and catch at a global HTTP pipeline exception filter and for 95% of cases, this is OK and good enough; you're not really going to be able to handle it nor is it worth it to to handle it.

We'll stick with ErrorOr, but developers aren't using it as monad and simply unwrapping the value and the error because, as it turns out, most devs just have a preference/greater familiarity with imperative try-catch handling of errors and practically, in an HTTP backend, there's nothing wrong in most cases with just having a global exception filter do the heavy lifting unless the code path has a clear recovery path.

    > I don't think you should never use OOP or abstractions. I don't think there is a golden rule for when you should use either.
I do think there is a "silver rule": OOP when you need structural scaffolding, functional when you have "small contracts" over big ones. An interface or abstract class is a "big contract" that means to understand how to use it, you often have to understand a larger surface area. A function signature is still a contract, but a micro-contract.

Depending on what you're building, having structural scaffolding and "big contracts" makes more sense than having lots of micro-contracts (functions). Case in point: REST web APIs make a lot more sense with structural scaffolding. If you write it without structural scaffolding of OOP, it ends up with a lot of repetition and even worse opaqueness with functions wrapping other functions.

The silver rule for OOP vs FP for me: OOP for structural templating for otherwise repetitive code and "big contracts"; FP for "small contracts" and algorithmically complex code. I encourage devs on the team to write both styles depending on what they are building and the nature of complexity in their code. I think this is also why TS and C# are a sweet spot, IMO, because they straddle both OOP and have just enough FP when needed.

[0] https://github.com/amantinband/error-or

Re: What .NET 10 GC changes mean for developers

#156

Comprehensive and (I thought) interesting article in perf improvements in .net 10: Performance Improvements in .NET 10 https://devblogs.microsoft.com/dotnet/performance-improvemen...

This is a great article, as soon as you’re beyond the introductory 5 paragraphs on the minutiae of the opening song of Disney’s Frozen.

Re: What .NET 10 GC changes mean for developers

#157

Earlier quoted context omitted.

Would you rather a team move faster and be more productive or be a purist and disallow abstractions to avoid some potential runtime tracing challenges which can be mitigated with good use of OTEL and logging? I don't know about you, but I'm going to bias towards productivity and use integration tests + observability to safeguard code.

Disallow bespoke abstractions and use the industry standard ones instead. People who make abstractions inflate how productive they’re making everyone else. Your user base is much smaller than popular libs, so your docs and abstractions are not as battle tested and easy to use as much as you think.

This is raw OpenFGA code:

    await client.Write(
        new ClientWriteRequest(
            [
                // Alice is an admin of form 123
                new()
                {
                    Object = "form:124",
                    Relation = "editor",
                    User = "user:avery",
                },
            ]
        )
    );

    var checkResponse = await client.Check(
        new ClientCheckRequest
        {
            Object = "form:124",
            Relation = "editor",
            User = "user:avery",
        }
    );

    var checkResponse2 = await client.Check(
        new ClientCheckRequest
        {
            Object = "form:125",
            Relation = "editor",
            User = "user:avery",
        }
    );
This is an abstraction we wrote on top of it:

    await Permissions
        .WithClient(client)
        .ToMutate()
        .Add("alice", "editor", "226")
        .Add("alice", "member", "motion")
        .SaveChangesAsync();

    var allAllowed = await Permissions
        .WithClient(client)
        .ToValidate()
        .Can("alice", "edit", "226")
        .Has("alice", "member", "motion")
        .ValidateAllAsync();
You would make the case that the former is better than the latter?

Re: What .NET 10 GC changes mean for developers

#159

Earlier quoted context omitted.

Don't we have automated tests for catching this kind of things or is everyone only YOLOing in nowadays? Serialization, routing, etc can fail at runtime regardless of using or not using attributes or reflection.

Ease of comprehension is more important than tests for preventing bugs. A highly testable DI nightmare will have more bugs than a simple system that people can understand just by looking at it.

But the "simple" system will be full of repetition and boilerplate, meaning the same bugs are scattered around the code base, and obscured by masses of boilerplate.

Isn't a GC also a Magic? Or anything above assembly? While I also understand the reluctance to use too much magic, in my experience, it's not the magic, it's how well the magic is tested and developed.

I used to work with Play framework, a web framework built around Akka, an async bundle of libraries. Because it wasn't too popular, only the most common issues were well documented. I thought I hated magic.

Then, I started using Spring Boot, and I loved magic. Spring has so much documentation that you can also become the magician, if you need to.

Post reply on HN