Contents

323 Articles
14 Comments

Search

5 days Ago

How pattern-matching in C# is lowered

Published by marco on

 A while back, I wrote Stop trying so hard to use pattern-matching. I stand by everything i wrote there. I was recently mentoring a very clever programmer who’s new to C# but has cut his teeth on Rust. We were discussing switch statements vs. switch expressions. Which pattern-matching features can you use where? Which features can you combine?

The article Tutorial: Use pattern matching to build type-driven and data-driven algorithms (Learn Microsoft) offers a good introduction. Pattern-matching on objects is... [More]

2 weeks Ago

Angular is pretty specialized

Published by marco on

 I recently had a conversation about the pros and cons of using Angular and I found this year-old article that I’d prepared from my notes but never published. The article
Two-way binding between Signals and Query Params by Julio Castro (Software Engineering Corner by Zühlke Engineers) includes the following code snippet.

@Component({
  selector: "app-root",
  standalone: true,
  imports: [AsyncPipe],
  template: `
    <h1>Signals Demo</h1>
    <p>Your first name is: {{ firstName$ | async }}</p>
  `,
})
export class AppComponent {
  private activatedRoute =... [More]

Balancing user experience and performance in a web page

Published by marco on

 This video is just under 30 minutes and provides a lot of useful tips about how to optimize web pages. It’s almost a year old, but a lot of the optimizations are good to know, even though they won’t apply to most pages out there. It’s good to know how the browser works and which heuristics it uses to determine what can be optimized. Knowing these things helps you avoid accidentally formulating your web pages in ways that slow things down unnecessarily. You’ll be less likely to suffer under... [More]

Swift protocol extensions for C#

Published by marco on

 Extension syntax in C#14Since this feature is being touted for C# 14—this time it’s coming for real!—I thought it would be good to refresh what I’d already learned about it. The title is a bit hyperbolic but it’s quite an interesting feature. It’s basically protocol extension from Swift for C#. It’s .NET’s answer to extending extension methods to properties and, probably, operators. You can’t add state, as far as I can tell. But that isn’t so surprising.

The video below discuss the proposal as it looked for... [More]

A good intro to .NET Aspire from the 2024 Build Conference

Published by marco on

This is another 46-minute, 10-month-old video from the last Build conference that I found extremely helpful in explaining what .NET Aspire is and what it’s good for.

Demystify cloud-native development with .NET Aspire | BRK181 by Microsoft Developer (YouTube)

Damian Edwards and David Fowler do a soup-to-nuts demonstration of Aspire. It basically lets you configure your multi-project, distributed projects with code rather than with YAML (e.g. dockercompose.yml). Instead, it writes the files for you and handles the deployment to Docker. This lets you much more easily create and... [More]

Toub and Hanselmann at the Build Conference 2024

Published by marco on

This 46-minute presentation by Scott Hanselman and Stephen Toub is ten months old but is still worth watching. I note below that one of the more significant things Toub shows is not any sort of programming wizardry, but column-selection in a text editor. Half of the things that people use AI for can be solved with column-select and judicious copy/paste.

'Highly Technical Talk' with Hanselman and Toub | BRK194 by Microsoft Developer (YouTube)

Another fantastic “deep dive” with these two: this time they’re optimizing the Humanizer library on-the-fly, on-stage, during a session.... [More]

Getting Docker in the path on MacOS

Published by marco on

I couldn’t call Docker from the command line. I had installed Docker a long time ago, but had just restored from a Time Machine backup, so my system was new but the applications had been restored. That meant that Docker had recorded that the executables had been sym-linked to the right folder (/usr/local/bin) but those links were part of the old, dead system.

Long story short, go to the settings, as shown below. If you’re in the situation that I was in, in which the app was out of sync with... [More]

Toub’s 234-page tour-de-force on performance in .NET 9

Published by marco on

 The articlebook Performance Improvements in .NET 9 by Stephen Toub (.NET Blog) was published about six months ago. It contains a tremendous amount of interesting information, which I’ve attempted to summarize below, following the document structure in the original.

Tier 0

“Another tier 0 boxing example is dotnet/runtime#90496. There’s a hot path method in the async/await machinery: AsyncTaskMethodBuilder<TResult>.AwaitUnsafeOnCompleted (see How Async/Await Really Works in C# for all the details). It’s really... [More]”

Junior code is insidious

Published by marco on

 The article Enumerated Science by Remy Porter (Daily WTF) describes a train wreck of a code example. It suitably illustrates why we really have to question whether scientists/juniors/etc. should really be writing code with so little training. If they wrote text this poorly, they’d be laughed out of their profession. Somehow, it’s perfectly fine to write code like this.

index = 0
for index, fname in enumerate(img_list):
    data = np.load(img_list[index])
    img = data[0][:,:]
    img_title... [More]

Web optimization: preload vs. fetchpriority

Published by marco on

This is a nearly 50-minute video about certain optimizations that used to be useful but which, in modern browsers, often get in the way of heuristic optimizations that browsers apply automatically.

How browsers REALLY load Web pages by We Love Speed / Robin Marx (YouTube)

“Preload should be applied with surgical precision
  • Specific edge cases (you really know what you’re doing)
  • If the resource isn’t in the HTML
    • Fonts
    • Dynamic LCP images
    • JS imports

Basically, he said if you’re using preload, you’re almost certainly doing it wrong. For example, you can use fetchpriority=high... [More]

Guide to being a good person and programmer

Published by marco on

 The article The Best Programmers I Know by Matthias Endler seems almost too good to be true. NGL I feel seen. I have cited heavily from it, highlighting the parts I find especially interesting. At the end are a few pallid notes from me, but the meat of this article is the quote.

  • Read the Reference
  • Know Your Tools Really Well
  • Read The Error Message
  • Break Down Problems

    If you work as a professional developer, that is the bulk of the work you get paid to do: breaking down problems. If you do it right, it will... [More]

1 month Ago

Maddy Mondaquila (new .NET Aspire PM) talks programming tools

Published by marco on

This is a wide-ranging, occasionally delightfully foul-mouthed, and brutally honest interview with PM Maddy Mondaquila of Microsoft. Kudos to them for letting their best people do these kinds of informative and insightful interviews.

MAUI Lead Leaves to Work on .NET Aspire (and interview with Maddy Mondaquila) by Nick Chapsas (YouTube)

At 45:57,

“[…] yesterday Dave [Fowler] and I were fighting about if the Visual Studio .gitignore is getting dumber and he was like, ‘who cares about that? Why would anyone care about that?’ And I was, like, it’s 400 lines, dude. Like, we’re ignoring things... [More]”