Live data from Hacker News

.NET 8

devblogs.microsoft.com

361–370 of 374 posts

Re: .NET 8

#361
post #261

Earlier quoted context omitted.

Any tips or tutorials for a PHP dev who wants to pick .NET up after a couple decades of not using it? I looked at the project templates in Visual Studio 2022 just for web apps and the options made my head spin. My wife has worked QA for a number of .NET teams and it just seems like something I should at least keep my thumb on, but I've had nothing but frustration with it so far, even just trying to figure out what te…

I'd just create a Blazor project with individual authentication (and don't worry about interactivity). Then inside Components/Pages you'll find code that should look pretty boring. You'll see some HTML, you'll see things like `@page "/counter"` and `@currentCount` and it isn't that hard to understand that the at-symbol means "code thingy" and "oh, @page must be how I specify the URL", and at the bottom there will be…

I think I'll eventually look into Blazor, but it seems really cutting-edge and I'm looking for more basic stuff right now, I think. I'm fine with a vanilla html/js front end (or React, or whatever) and having .net do the server side of things.

Re: .NET 8

#362
post #352

Earlier quoted context omitted.

Luckily nowadays C# is just as terse for writing CLI apps or even terser, which does not have aforementioned issues with AOT.

I'm willing to try it, I'm just waiting for a few more benchmarks regarding memory usage. Last time I checked I could only find the Benchmark Game [1] for AoT measurements, but they're from .NET 7. Memory usage is important to me and golang is very good at that being light, but I really hate writing it for various personal reasons. If I had more free-time I'd just simply go with Rust but you know, free time is limite…

[1] That isn't the benchmarks game.

This is the benchmarks game:

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re: .NET 8

#363
post #352

Earlier quoted context omitted.

I'm willing to try it, I'm just waiting for a few more benchmarks regarding memory usage. Last time I checked I could only find the Benchmark Game [1] for AoT measurements, but they're from .NET 7. Memory usage is important to me and golang is very good at that being light, but I really hate writing it for various personal reasons. If I had more free-time I'd just simply go with Rust but you know, free time is limite…

BenchmarksGame is actually an interesting if unfortunate case for C#. Many tests there are at odds with the areas of optimizations that get most engineering effort investment in .NET: high level and/or application logic and high-performance primitives like Span, Vector, etc. (with the exception of perhaps Regex-Redux, but even there I'm not sure why the results are so low, because C# has one of the fastest[0] regex e…

fwiw https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re: .NET 8

#364

Earlier quoted context omitted.

I teach for a living, mostly people of poor backgrounds, and a lot of them in the Third World. I understand your argument (and I buy some tools myself), but I can't tell them to use paid tools because the cost may be too high in the local currency and it adds up fast.

VS Code and Omnisharp are unconditionally free (and open source). DevKit and VS Community Edition are free for education scenarios. The arguments made in previous comments don’t correspond to reality.

Thank you!! Good to know.

Re: .NET 8

#365

I'd love to hear from some .NET fanatics, how would you convince someone to use that ecosystem over another?

I'm not a 10x expert developer so take this as anecdotal, but I've been freelancing a custom Blazor web application for a small business client who manages property - think presenting the user data, letting them manipulate the data, etc., so pretty simple stuff. It's the simplest MSFT framework I've worked with yet, which is a huge advantage to me as I'm using up my time outside of my regular 9 - 5.

Besides the controllers, models, and other things that might be separated from the views, I can mix my html and C# right there in the view - this is the biggest benefit IMO. In combination I use the Entity framework to interact with the DB, which adds to the simplicity.

The costs to run the internal application for several users is going to be around $6 a month for the Azure database. Hosting the web app is also on Azure, and it's free with the basic MSFT domain, which isn't a big deal to clients who use the software internally. This specific client will be saving over $200 a month once I release the app to them.

I can't tell you all the small details that the cool kids might be able to tell you, but I can produce reliable apps in lightening time and make my clients happy, which is ultimately my #1 goal with freelancing.

Re: .NET 8

#366
post #352

Earlier quoted context omitted.

I'm willing to try it, I'm just waiting for a few more benchmarks regarding memory usage. Last time I checked I could only find the Benchmark Game [1] for AoT measurements, but they're from .NET 7. Memory usage is important to me and golang is very good at that being light, but I really hate writing it for various personal reasons. If I had more free-time I'd just simply go with Rust but you know, free time is limite…

BenchmarksGame is actually an interesting if unfortunate case for C#. Many tests there are at odds with the areas of optimizations that get most engineering effort investment in .NET: high level and/or application logic and high-performance primitives like Span, Vector, etc. (with the exception of perhaps Regex-Redux, but even there I'm not sure why the results are so low, because C# has one of the fastest[0] regex e…

Note that I also imported regex-redux into rebar: https://github.com/BurntSushi/rebar/tree/master/record/all/2...

It isn't exactly equivalent to the benchmark game's version. The biggest difference is that it doesn't permit parallelism.

For more details on the benchmark model: https://github.com/BurntSushi/rebar/blob/master/MODELS.md#re...

.NET does well overall in rebar's benchmarks, but less so in regex-redux (in both the benchmark game and in rebar's version of it). Not sure why. I haven't investigated. Of course, this is assuming you aren't using .NET's default interpreter engine. You've got to switch to the no-backtracking or compiled modes to get decent perf.

Re: .NET 8

#367

Earlier quoted context omitted.

When you literally don't have $20 in your account. Then you can spend 100 hours and it's still worth it.

Then again, this sort of decisionmaking is probably why you're a software developer with less than $20 in your bank account.

I don't know... Possibly because your life circumstances made it that?

But hey! Talented people doing their best to break out of poverty is clearly a novel idea to you.

Re: .NET 8

#368

Earlier quoted context omitted.

You probably mean sum types and convenient syntax for testing and de-structuring sum types.

No I specifically meant what is often called the Either or Result Monad. These are often implemented as Sum types, but they also follow the Monad laws and supports things like monadic binding/transformation/combination and benefit from syntax sugar like Haskell's "do-notation"/OCaML family's "computation expressions"/the "async/await" pattern of so many other languages now. Good sum types destructuring would probably…

Why pick on Golang, then? Rust doesn't have a monadic interface to side effects and "errors" either. Nor do the vast majority of the other newer languages.

Re: .NET 8

#369

Earlier quoted context omitted.

No I specifically meant what is often called the Either or Result Monad. These are often implemented as Sum types, but they also follow the Monad laws and supports things like monadic binding/transformation/combination and benefit from syntax sugar like Haskell's "do-notation"/OCaML family's "computation expressions"/the "async/await" pattern of so many other languages now. Good sum types destructuring would probably…

Why pick on Golang, then? Rust doesn't have a monadic interface to side effects and "errors" either. Nor do the vast majority of the other newer languages.

Rust uses a sum type for most errors (Result) and there are common macros such as "error-chain" that apply a monadic approach to binding/combining them (or chaining them, as the preferred nomenclature in that case).

Exception-based languages don't look monadic at first blush, they definitely aren't Sum types, but try/catch is one of the earliest and oldest of the monadic binding/combining approaches, even if it isn't often thought as such (and is barely considered more than goto/switch). It's far more obvious when you start to realize the intersection of async/await and try/catch is a working monad (and how that is reflected in Task/Promise monad instances).

Golang is the obvious odd one out where every other line of "best practice" code is `if err != nil` and the only other advice is "well you could just ignore errors". try/catch doesn't ignore errors, it just looks like it. Rust error chaining doesn't ignore errors, it just looks like it. Golang gives you the choice between micro-managing errors or BASIC-style "ON ERROR RESUME NEXT" and I cannot get anyone to convince me why this isn't either a practical joke or an intentional throwback to writing code like it is the 1970s all over again (even VB6 had better options than "ON ERROR RESUME NEXT", even if they maybe weren't used as often as they should be in some legacy 1990s/2000s codebases).

Re: .NET 8

#370

Earlier quoted context omitted.

Why pick on Golang, then? Rust doesn't have a monadic interface to side effects and "errors" either. Nor do the vast majority of the other newer languages.

Rust uses a sum type for most errors (Result ) and there are common macros such as "error-chain" that apply a monadic approach to binding/combining them (or chaining them, as the preferred nomenclature in that case). Exception-based languages don't look monadic at first blush, they definitely aren't Sum types, but try/catch is one of the earliest and oldest of the monadic binding/combining approaches, even if it isn'…

>every other line of "best practice" code is `if err != nil` and the only other advice is "well you could just ignore errors".

You have a valid point there, but it hurts my ears a little for you to use the word "monadic" or "monad" to make the distinction between how the way Golang handles errors differs from how other modern language do it. To me, for a language to "have monads" requires the type system to give the programmer the ability to distinguish between a value type, e.g., an integer, and a computation that produce a value type. Haskell's type system for example uses `Integer` to refer to the former and, e.g., `IO Integer` to refer to that latter. And clearly by that definition, Rust and most other modern languages just don't have monads, i.e., don't have monadic types (and consequently don't support a monadic programming style) -- unless perhaps Rust's macro system can be used in some complex way to define the monadic-computational types, but I've never seen it used that way. BTW, I'd actually go further and say that to get the benefits of monadic style, the IO monad or whatever the language calls it must be the only way to perform side-effecting computations (though there is a little wiggle room on the definition of side effect here).

To be more precise, the terminology I prefer is that a monad (in the context of programming languages) is a type that obeys the 3 monad laws: https://wiki.haskell.org/Monad_laws. There are other ways besides a monad for the type system to distinguish between a value and a computation producing a value; Explicit continuation passing is one such way: whereas in Haskell you'd read a character from standard input with `main = getChar >>= \char -> do something with char`, in a language that uses explicit continuation passing, you'd write `main = getChar (\char -> do something with char)` where in this language getChar takes one argument, which happens to be a continuation argument. But all the languages I know about that let the programmer use the type system to distinguish between a value and a computation producing a value use the monadic style to express that distinction (rather than something like explicit continuation passing) so I tend to use "monad" and "monadic" to refer both to the specific thing that obeys the 3 laws and for the deeper programming-language property.

Post reply on HN