Professional Development – 2024 – Week 24

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

.NET

Microsoft Is Breaking Your Code in C# 13 (via Nick Chapsas)

  • Auto-properties (e.g., public int Number { get; set; }) is hiding a private field that is being accessed via a method (e.g., set_Number, get_Number).
  • You can’t access the generated backing field without implementing things by hand with a separate private backing field. But in the new version, you can use the field keyword (e.g., get => field * 2).
  • Warning: If you have a property named “field”, your code will not compile. However, you can escape it using the at-symbol (e.g., get => @field * 2).

Stop Using Primitives to Represent Domain Ideas in C# (via Nick Chapsas)

  • Nick talked about the antipattern primitive obsession, where you use common, built-in types to represent values.
  • The alternative — having restrictive types for every property — can get tedious to manage.
  • A way to get some syntactic sugar from C# is to declare type aliases. For example, using EmailAddress = string lets you define variables of type EmailAddress, even though it’s a string under the hood. This approach makes the code more readable, however you don’t get any validation.

Leadership

5 Traps to Avoid as You Gain Power as a Leader (via HBR)

  1. Savior trap — “Being identified as the authority can lead to the trap of frequently giving advice, having all the answers, and being overly helpful.”
  2. Complacency trap — “Because you think you know everything, you ask fewer questions. You assume you understand the problem and fail to solicit further.”
  3. Avoidance trap — “[A position of power] also allows you to avoid tasks that are unpleasant by outsourcing them to others, or, when possible, by dodging them altogether.”
  4. Friend trap — “The friend trap is acting like a peer when you are not. These leaders overly rely on their personal power, and forsake their positional power, in an effort to be liked and to minimize their authority footprint.”
  5. Stress trap — “To avoid being in the firing line of your stress, your direct reports can minimize bad news, or fail to tell you when things aren’t going well until it’s too late. People can’t think clearly and creatively in an atmosphere of overwhelm.”

3 Ways to Compassionately Hold Your Team Accountable (via HBR)

  • People perceive accountability in one of two ways: threatening (reprimand people for failures, create a culture of threat and blame) or worthy challenge (owning a task is an opportunity of growth, missteps are a chance to improve).
  • “Accountability occurs when leaders can mentalize what’s likely to happen when they give someone a task or directive — that is, create a mental image of the task and communicate it in a way that ensures shared understanding.”
  • “Because we unconsciously track the people who keep their promises and those who don’t, someone who is fastidious about executing on promises — large and small — can become a person others trust deeply.”
  • “When stakes are high, failures are bound to happen. What matters most is that leaders respond to those failures with an impulse toward learning, not punishment.”