Skip to main content
Share Your Experience: Take the 2024 Developer Survey
4 votes
Accepted

OneOf with multiple steps and early returns

Anytime I see something like this that goes against long established conventions, I look for these things: Does the new thing make it easier to test the creation of a new Car? Does the new thing ...
Greg Burghardt's user avatar
3 votes
Accepted

Invariant rule in Liskov Substitution Principle

Why this invariant rule? A class invariant is a condition that is guaranteed to be true for the lifetime of an object, i.e. once the object construction is finished, up to the start to its destruction,...
Christophe's user avatar
  • 77.9k
2 votes

Use of environment variable or appsettings as a counter, good or bad practice

If you want to store and make accessible the number of requests hitting your website, log it as a metric and query your metrics in a report. You can do this out of the box with most logging solutions, ...
Ewan's user avatar
  • 76.4k
2 votes

Use of environment variable or appsettings as a counter, good or bad practice

Environment variables are terrible: they're for passing hidden parameters into new processes, and should be avoided otherwise. You could put it in settings, but it's not a setting? What do you want to ...
pjc50's user avatar
  • 13.6k
2 votes

OneOf with multiple steps and early returns

This reads like a better use case of a tryXXXXX() pattern, it would let you break out early on any failures to handle errors better. bool tryBuildSteeringWheel(input, out OneOf<SteeringWheel, Error&...
Ian Jacobs's user avatar
2 votes

Invariant rule in Liskov Substitution Principle

An Invariant is a statement about "property" of a type, in the plain english sense. A precondition refers to the state before a method or function So, ShippingStrategy.FlatRate being greater ...
Ewan's user avatar
  • 76.4k

Only top scored, non community-wiki answers of a minimum length are eligible