Professional Development – 2023 – Week 46

Image Credit: https://www.flickr.com/photos/54585499@N04/

.NET

Measuring Code Performance The Right Way | Code Cop #008 (via Nick Chapsas)

  • Benchmarks are only as good your understanding and the benchmark technique itself.
  • Be wary of black/white statements (e.g., always use Count() over Any()) without resources to back those up.
  • The problem in this example, was the benchmark was done against a database, not an in-memory construct. Also, there’s an additional layer because Entity Framework turns LINQ into DB queries (which have their own optimization issues).
  • Use deterministic data for benchmarks (e.g., randomized by the same seed) so that when comparing runs to one another, you’re not having to deal with data as a variable.

Should You Use The Async Suffix in C#? (via Nick Chapsas)

  • The history is that methods were synchronous until C# 5 (when the async keyword came about), so we needed some way to differentiate the two so they could coexist. (It’s a compiler error to have two methods with the same name, even if one is declared async.)
  • Controllers by convention don’t have the “async” suffix because it’s implied. They are called by something external, rather than from within other C# code.

AI/ML

Improve Your Company’s Use of AI with a Structured Approach to Prompts (via HBR)

This article talks about creating an internal prompt-query alignment model (PQAM). This consists of (1) a library of crafted prompts that help with querying, clarifying, comparing, and predicting, (2) ways to customize prompts, and (3) a feedback loop to ensure the system improves over time.