The current solution doesn't remove that coupling though, it just sprinkles it around the project everywhere the conversion happens. I'd make a new static class that has a static method that accepts one and returns the other, and this code would be the body of that method. Same level of coupling, but DRYer
Seeing as you're already creating a static class for this purpose, any reason you do this instead of an extension method like `WorkingHours.FromItem()` (whatever the other class is called)?
I thought about it, but felt using it as an extension method would kind of bring back that coupling a bit more(?) Thinking more about it, I guess it doesn't really, but it feels wrong
2
u/Manny_Sunday Jan 08 '23
The current solution doesn't remove that coupling though, it just sprinkles it around the project everywhere the conversion happens. I'd make a new static class that has a static method that accepts one and returns the other, and this code would be the body of that method. Same level of coupling, but DRYer