Contents

339 Articles
14 Comments

Search

3 months Ago

jj vs. git vs. GUIs

Published by marco on

The article jj init — Sympolymathesy by Chris Krycho explains what Jujutsu is and what it does. I was reminded of these notes that I wrote over a year ago when I read Evolving Git for the next decade by Joe Brockmeier (LWM.Net), which briefly mentioned it as a command-line UX toward which Git itself is working.[1]

Git is not worse than all the others

“Jujutsu is two things: It is a new front-end to Git. This is by far the less interesting of the two things, but in practice it is a substantial part of the experience of using the tool... [More]”

4 months Ago

Optimize by keeping only the code you need

Published by marco on

In the video Context is Everything by Andreas Fredriksson (Vimeo), the author pinpoints that a dependency in his app—a JSON-handling library—is sucking all the performance out of it.

So, he takes a look at it.

It’s a general-purpose library, with a lot of edge cases…edge cases that his input data doesn’t have. That is, if he can guarantee a certain context, then he can use an optimized version of the JSON library’s code. This isn’t always going to be the solution—it will, in fact, rarely be the solution for a LOB... [More]

Learning about OCaml Effects

Published by marco on

 OCaml LogoI don’t program with OCaml. I never have. I have a good colleague who does, occasionally, write stuff in OCaml, and he sent me a bunch of links about OCaml Effects, starting with a discussion asking Are we rational? About exceptions and effects by olleharstedt (OCaml Community).

The author writes,

“I was thinking about the fact that there’s no consensus about exceptions and whether to include them or not in a programming language. Think about Go. They decided to not add support for exceptions. Did they cite any study to... [More]

The goal is to test everything automatically

Published by marco on

So it all started with the following line of code in the Startup.cs of a WPF application,

locator.GetInstance<IAuthenticationService>().LogInBasedOnGeneralSettings();

It was to be replaced with these lines of code.

#if DEBUG
    locator.GetInstance<IAuthenticationService>().LogInBasedOnGeneralSettings();
#else 
    locator.GetInstance<LoginViewModel>().Show();
#endif

Reduce startup complexity

Going by the single-responsibility principle, the startup should be responsible for starting the... [More]

5 months Ago

Using extensions for operators in C# 14

Published by marco on

The article C# 14 Extension Members: Complete Guide to Properties, Operators, and Static Extensions by Laurent Kempe writes,

“Perhaps the most powerful C# 14 capability is extension operators. You can now add user-defined operators to types you don’t control, enabling natural mathematical operations.

When I first saw this, I thought it was kind of gimmick-y. But I just realized why it’s very nice that you can declare operators separately—optionally—from the type. Adding operators by default is a heavy... [More]

Thinking about the null-object pattern

Published by marco on

I had never thought of an if statement as a type-check until a Smalltalk programmer explained it to me in this video. She explained how Smalltalk has six keywords—according to Wikipedia, they’re true, false, nil, self, and super, but her list had thisContext on it as well[1]—and you can get rid of conditions and turn them into message-passing instead, as God intended.

RailsConf 2015 − Nothing is Something by Sandi Metz on May 1, 2015 (YouTube)

From the official video description,

“Our code is full of hidden assumptions, things that seem like nothing, secrets that we... [More]”

Discussing DI, IOC, and containers

Published by marco on

I was recently allowed to observe as a team discussed the benefits and drawbacks of using an IOC container.[1]

I was asked not to directly participate because it was a team-building exercise; the team needed to convince itself based on the merits of its own arguments. If those for the technology were unable to articulate their convictions sufficiently, then it wouldn’t help for an outside authority to dictate the answer. I assisted in the background, with clarification and alternate explanations.... [More]

A review of 35 Microsoft Ignite 2025 dotnet videos

Published by marco on

I watched/listened to 35 videos, each between 20 and 30 minutes long, and each listed below. I’ve grouped them but retained the order in which I watched them. I’ve left the notes mostly as I wrote them, which is kind of stream-of-consciousness, kind of snarky.

Some videos that I didn’t like got a lot of notes, some videos I liked got fewer notes. It might seem like I hated the video from my snarky notes but I still ended up rating some of them as 🆗, which means that I thought that either... [More]

6 months Ago

Toub’s 232-page tour-de-force on performance in .NET 10

Published by marco on

 The book-length Performance Improvements in .NET 10 by Stephen Toub (Microsoft DevBlogs) arrived a couple of months ago.

He explains how the various compilers (AOT, JIT, etc.) have been optimized to eliminate allocations and just generally optimized for performance. A reduction in allocations is a multi-win: the performance is better because the allocator isn’t working, the memory usage has dropped, and the garbage collector also works less.

See previous coverage in:

1 year Ago

The idea of MCP: “Tea. Earl grey. Hot.”

Published by marco on

The article A Critical Look at MCP by Rasmus Holm (Raz Blog) discussing many of the drawbacks of MCP as it is currently conceived. One of them is the push to build everything in Python, which is a dynamic language that’s better-designed than JavaScript, but isn’t a lot better at helping users write maintainable code.

“Am I being pretentious/judgmental in thinking that people in AI only really know Python, and the “well, it works on my computer” approach is still considered acceptable? This should be glaringly obvious to... [More]”

CSS is a collection of layout algorithms

Published by marco on

 This is a nice explanation of how CSS is a declarative language, where you describe the metadata of your styles. The layout algorithm determines which property values affect the size and position of the element. Generally the properties position and display properties determine which layout algorithm is used for a given element. The layouts are,

CSS makes sense when you realize it's a collection of algorithms by Kevin Powell (YouTube)

A good explainer of how the core concept of CSS is layout

Published by marco on

This is a nice ~13-minute explanation of how CSS is a declarative language, where you describe the metadata of your styles. The layout algorithm determines which property values affect the size and position of the element.

CSS makes sense when you realize it's a collection of algorithms by Kevin Powell (YouTube)

Generally the properties position and display properties determine which layout algorithm is used for a given element. The layouts are,

 Kevin Powell

Refactoring a dead-simple progress-bar function

Published by marco on

I just saw a neat code example from a Dutch government project (function starting at line 182). The commentator who posted it at Reddit wrote,

“Some people laughed at it and suggested all kind of clever one liners to replace it, but to me, that if statement is perfect. The intent is immediately clear and bugs are easy to spot. This is the kind of code you want in critical apps.”

Here’s the code.

private static string GetPercentageRounds(double percentage)
{
    if (percentage == 0)
       ... [More]

An LLM use case with function-calling

Published by marco on

The article Function calling using LLMs by Kiran Prakash writes,

“It’s important to emphasize that when using function calling, the LLM itself does not execute the function. Instead, it identifies the appropriate function, gathers all required parameters, and provides the information in a structured JSON format. This JSON output can then be easily deserialized into a function call in Python (or any other programming language) and executed within the program’s runtime environment.”

This is an approach that... [More]

A subtle failure to pattern-match null in C#

Published by marco on

 The article The null check that didn’t check for nulls by Oren Eini (Ayende) points out an interesting and subtle difference in code-generation, depending on whether you use the var keyword. Using var in pattern-matching might lead to a pattern that looks like it checks for null but doesn’t. You can see and play with a live example (SharpLab.IO) but I’ve replicated the examples below.

This is the problematic example:

string Test1(List<string> strs)
{
    if(strs is [var s])
    {
        return s;
    }
    return... [More]

Zed shows off how to work with AI agents

Published by marco on

The article Zed: The Fastest AI Code Editor by Richard Feldman (Zed) includes a great description and video that shows off the behavior of their new “agent” feature.

“The entire Zed code editor is open source under GPL version 3, and scratch-built in Rust all the way down to handcrafted GPU shaders and OS graphics API calls. Zed’s new AI capabilities are also open-source, just like the rest of the editor, so you can see exactly what the new Agent Panel is doing under the hood.”

This editor is very, very smooth and more... [More]

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]

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]

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

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]