Promoting SoC Through Application Layering

Creating a layered design in an application is a fundamental element of modern software architecture. The goal is to promote the Separation of Concerns (SoC) design principle. Separation of Concerns The ideas behind SoC date back to Dijkstra's 1974 paper "On the role of scientific thought" . In computer science, separation of concerns (sometimes abbreviated as SoC) is a design principle for separating a computer program into distinct sections. Each section addresses a separate concern, a set of information that affects the code of a computer program. A concern can be as general as "the details of the hardware for an application", or as specific as "the name of which class to instantiate". A program that embodies SoC well is called a modular program. Modularity, and hence separation of concerns, is achieved by encapsulating information inside a section of code that has a well-defined interface. - Wikipedia SoC is a broad design principal th...

.NET Blazor Warning: BL0007

While researching a .NET 8 upgrade, we noticed a vague BL0007 compile time warning on a number of our custom Blazor components.

BL0007: Component parameters should be auto properties.

After some research, it turns out this vague warning is designed to prevent loops in two-way binding.

Here is a description of the original issue on GitHub: https://github.com/dotnet/aspnetcore/issues/26230

Fortunately, we had already witnessed the loops in the two-way binding and addressed the problem by designing all of our Parameter property setters to fire only when the data changed.

Code example of partial solution.

That design was a partial solution, as it still allowed for a single bounce (or a single loop iteration). But we had to account for the situation where the component would alter the value internally and the consuming component needed to be notified of this change.

A better solution is:

Code example of correct solution.

In this scenario, if the component needs to manipulate the value internally, it should do so using the SetVolume method.