Contents

322 Articles
14 Comments

Search

Two Days 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]

3 days Ago

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]

2 weeks 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]”

1 month Ago

tsc is going native

Published by marco on

The article A 10x Faster TypeScript by Anders Hejlsberg (Microsoft) includes the following text, as well as a link to the video below,

“[…] we’ve begun work on a native port of the TypeScript compiler and tools. The native implementation will drastically improve editor startup, reduce most build times by 10x, and substantially reduce memory usage. By porting the current code-base, we expect to be able to preview a native implementation of tsc capable of command-line type-checking by mid-2025, with a feature-complete... [More]

Pointers for large files and repositories in Git

Published by marco on

How to Add files to a Large Repository? (Reddit)

Git has opt-in support for handling large files.

  • Use the –depth option to control how much history to clone (good for pipelines, where you’re usually only interested in the tip, so depth 1)
  • Whereas depth controls how much you clone (size of the .git folder), sparse-checkout controls the size of your working tree.
  •  git logoUse LFS (Large File Storage) to store files. This will not remove large files from existing commits. This feature is seamless to enable and... [More]

Narrowing types to avoid primitive obsession

Published by marco on

Recently, I saw that the following error had been fixed in a code review.

 Classic primitive obsession error

The error shown above is an example of a design smell called Primitive Obsession. This is where code is “obsessed” with primitives, in that it uses a much “wider” type than is actually acceptable.

Whereas C++ has a typedef, TypeScript and Delphi Pascal have a type, C# has … nothing simple. The linked article describes a hand-coded version for making “narrower” types (e.g., MeanLength or ShortFiber). Our go-to... [More]

Who’s going to fix the bad projects?

Published by marco on

The article Can You Get Better Doing a Bad Job? by Jim Neilsen cites Woody Harrelson as saying, “I think when you do your job badly you never really get better at your craft.”

Of course that’s true on the surface: If you manage to avoid learning anything else, then you will only ever get better at doing a bad job. The author expands on this point as follows,

“Experience is a hard teacher. Perhaps, from a technical standpoint, my skillset didn’t get any better. But from an experiential standpoint, my... [More]

2 months Ago

James Mickens is back with more

Published by marco on

 James MickensI recently stumbled upon some Essays from the funniest man in Microsoft Research by Raymond (Old New Thing). He is such a funny writer that this article, against convention and like the one before it (Brilliant articles by the funniest guy at Microsoft), will consist mostly of citations rather than an even mix of citations and paraphrasing that I naturally consider to be much more lucid and pithy. I quote at length to do the material justice, for documentation and to ensure that you all download the PDFs to see if there... [More]

And another thing about MVVM

Published by marco on

I recently wrote Real quick on MVVM and now I see that a good colleague and friend has written his own MVVM understandings by Austin Jones (Austin's Journey for Meaning). His piece got me thinking again about how the concept is a good start but isn’t really sufficient.

Justifying the view model

Somewhere near the beginning, he writes,

“The View Model’s function is separate from the Model. Abstraction requires discipline to not let two pieces of code that do the same thing become the same thing, purely out of convenience. Things that... [More]”

Avoiding completely failed estimates

Published by marco on

 The relatively short post My Washing Machine Refreshed My Thinking on Software Effort Estimation by Chris Horsley (Cosive) is kind of interesting, in that it’s a cautionary tale about being overconfident about your estimates. As the title suggests, his was a real-world task where he’d assumed that a tenth iteration would go just as smoothly. He draws some good conclusions but for what I think might be the wrong reasons.

“[…] while 90% of the project will be the same, there’s going to be one critical difference between... [More]

Tacking against the winds of Copilot

Published by marco on

The tweet ”Programming” by Andrej Karpathy (Twitter) is what some people are calling the future of programming—with the loudest claiming that it’s already here and that you’re all missing the boat if you’re not programming like this.

“There’s a new kind of coding I call “vibe coding”, where you fully give in to the vibes, embrace exponentials, and forget that the code even exists. It’s possible because the LLMs (e.g. Cursor Composer w Sonnet) are getting too good. Also I just talk to Composer with SuperWhisper so I... [More]

Building sites with HTML and CSS

Published by marco on

This is a 40-minute discussion about the combining the latest technologies, like scroll-snapping, scroll-driven animations, anchoring, etc. to produce responsive, progressive, animated, modern, and very fast sites without any JavaScript at all.

Pure CSS Scroll Spy Table of contents − No JavaScript Required! by Kevin Powell & Adam Argyle (YouTube)

Carousels

Adam uses it all to build carousels, which is fine for demos and proving the power of the technologies, but … I’m not a fan. While our two hosts mention that Netflix comprises only carousels, they don’t really discuss that Netflix is... [More]

A roundup of .NET 9 release videos

Published by marco on

In November of 2024, Microsoft released a lot of videos about .NET to accompany the release of .NET 9. I watched/listened to a lot of these, with varying levels of attention paid. When something caught my attention, I took notes. These videos are roughly in the other than I watched them, although I reserved the right to shuffle them about a bit to improve grouping.

AI
  1. AI Building Blocks − A new, unified AI layer by Steve Sanderson
  2. Discover the Latest GitHub Copilot Features for .NET... [More]

3 months Ago

Mads Torgerson on union types, existential types, and C# missteps

Published by marco on

This is a nearly 100-minute-long interview and discussion about programming-language design and evolution. It gets deep into the weeds on very specific and relatively advanced language features. While a feature may eventually feel quite simple to use, the considerations about how to design it and how to fit it into the landscape of the rest of the language can be very, very complex. There are a lot of moving parts to consider in a language, runtime, community, and ecosystem as established as... [More]

CSS: Popovers and anchors

Published by marco on

The article Do JavaScript frameworks still need portals? by Ollie Williams (Fully Stacked) explains a bit more about the relationship between dialog, popover, and anchor as well as how these elements have made “portal” support in frameworks obsolete. The following ~20-minute video shows how to use only CSS and HTML to position and display elements, regardless of their nesting in the document.

CSS Popover + Anchor Positioning is Magical by Kevin Powell (YouTube)

The main example uses CSS anchor positioning (MDN), position-try (MDN) and :popover-open (MDN). You can use position-try to direct the browser to adjust... [More]

4 months Ago

Angular 19 sounds … complicated?

Published by marco on

Some of the features described in the video below sound pretty interesting but they also sounds super-complicated, with deferred-loading, hydration, signals, and event/replay all combined with decisions about whether something loads on the client or the server or whether it’s initially built on the server but then enhanced on the client and then run independently from the server, …

I understand that a lot of this technology is for optimizing large web sites, but It’s honestly questionable... [More]

Using calc-size in CSS

Published by marco on

The following video shows not only when and how to use calc-size(), it also mixes in advice on generating timing functions for animations, sprinkles CSS variables throughout, and even uses overflow: clip combined with an absolutely positioned element to reveal more content without disturbing the layout.

Animate and do math on things like height: auto with interpolate-size and calc-size() by Kevin Powell (YouTube)

The syntax for calc-size() is, as Kevin says, “weird”; you have to pass two parameters: the first is the name of the logical size you’d like to use, while the second parameter is a formula that... [More]

How to apply EF migrations

Published by marco on

The picture and title are, as usual, clickbait-y, because apparently people don’t click on videos that sound educational unless you promise them ground-breaking learnings. Still, I don’t hate the player; I hate the game. But it’s the world we have.

The video is quite informative and is 90% not the guy pictured. Instead, it’s another guy called Gui Ferrera, who is quite competent.

The Correct Way to Run Database Migrations in EF Core by Nick Chapsas / @gui.ferreira (YouTube)

He starts by explaining how to deploy migrations in production—you don’t just run them, as you would in... [More]

5 months Ago

Are you doing the Advent of Code?

Published by marco on

No. No, I’m not.

I was briefly considering it because two good programmer friends[1] of mine asked me, and it seemed like it might be kind of fun to compare our solutions.

But … 24 days, man.

I’ve got other things to do. Like, a lot of other things to do.

I am not in any way bored or looking for things to do.

I’m not even lacking in programming projects that I could be working on.

I’m teaching a JavaScript class right now, for which I’m constantly refining the examples and project code,... [More]

Real quick on MVVM

Published by marco on

A little while back, someone wrote I can’t wrap my head around MVVM (Reddit), asking for help. I answered with a short example, reproduced below.

tl;dr: Use the MVVM Toolkit and try JetBrains ReSharper or Rider for more IDE assistance for binding and fixing up views.[1]

The concept is that:

  • the (M)odel describes your data in the shape you want to store it, process it, etc.
  • a (V)iew describes the elements of the UI.
  • a (V)iew(M)odel mediates between these two “shapes”.

Why do we need this? Why not... [More]

Writing elegant code

Published by marco on

I watched this video analyzing a chunk of code, in the hopes of refactoring it.

Always Return Early in Your Code | Code Cop #024 by Nick Chapsas (YouTube)

The original code is the laughably overblown example below.

public List<int> ProcessData(List<int> data)
{
  if (data != null)
  {
    if (data.Count > 0)
    {
      var processedData = new List<int>();
      foreach (var d in data)
      {
        processedData.Add(d * 2);
      }
      return processedData;
    }
    else
    {
      return new List<int>();
    }
  }
  else
  {
    return null;
  }
}

Nick... [More]

6 months Ago

You’re probably doing code reviews incorrectly

Published by marco on

The article Processes and rules make code review less intimidating by Stefan Judis writes,

 Code reviews are, by nature, intimidating. Sometimes even brutal. If you’ve been in the game for long enough, you probably experienced the following: you worked hard on a feature, you’re proud of yourself and open the PR to be praised and land your changes, and then… it rains comments, suggestions and nitpicks. And if it’s really bad, you’re forced to take multiple feedback and clean-up rounds. It sucks.”

Oh, wow.
... [More]