.NET
The NEW Way of Validating Settings in .NET 8 (via Nick Chapsas)
- You can add Required and Range() to certain properties from settings, but they don’t have any teeth unless you have .AddOptions<T>().Bind(…).ValidateAnnotations(). You could also add .ValidateOnStart() so your app won’t even run unless the settings are correct.
- However, all this work is done via reflection and can slow things down. With .NET 8 leaning toward AOT (ahead-of-time) compilation, the new approach will auto-generate validation code so that it can be pre-compiled.
- The advantage of source generators is that they’re typically optimized, especially ones from Microsoft.
- You can do nested object member validations with a bit of work (see the video for details).
Releasing Features the Smart Way in .NET (via Nick Chapsas)
- NuGet package from Microsoft (which has been around since .NET Core 3) is Microsoft.Management.AspNetCore. You get an IFeatureManager.IsEnabledAsync(str).
- Don’t use magic strings for feature names; use a constant in some other class.
- You can configure this in appsettings.json. You can edit this file while the API is running and it will work as expected. (Most hosting providers have live-refresh integrations.)
- Some people don’t like this idea because it’s bloated — codebase has both the old and new implementation.
- Use the FeatureGate(str) attribute on a controller; if not enabled, you’ll get a 404. You can do this per method as well.
- With a little extra work, you can support minimal APIs.
- It also has a .AddFeatureFilter<PercentageFilter>() where the feature will be enabled by chance. For something less random, there’s .AddFeatureFilter<TargetingFilter>() so you can tailor who sees is. Finally, there’s .AddFeatureFilter<TimeWindowFilter>() to limit when it’s available.
Burnout
Managers Are Burned Out. Here’s How to Help Them Recharge. (via HBR)
- Recognize the feeling and acknowledge their efforts
- Reconnect with other managers
- Reassess, reprioritize, and redistribute work
- Revise team agreements
- Regularly check in
- Relax and reset
Delegating
Mastering the Art of the Request (via HBR)
- Why requests are hard to make… feel they shouldn’t have to, not wanting to encroach on work-life balance
- To be effective: what do you want, from whom, by when, definition of done, context of the request.
- Push back on non-responses such as “sounds good”, “I’ll see what I can do.” Bring the accountability you need.
Leadership Development
Don’t Let Your Company’s Culture Stifle Leadership Development (via HBR)
- Many leaders are encouraged and developed to lead in ways they don’t see modeled or rewarded at their own company.
- “There’s just one way to radically change your behavior: radically change your environment.” — BJ Fogg
- Senior leaders need to define what excellent leadership is, model it themselves, teach it to others, and recognize/reinforce leadership.