public class BigPerformance
{
public decimal Value { get; set; }
}
public class Performance
{
public BigPerformance BigPerf { get; set; }
}
public class Category
{
public Performance Perf { get; set; }
}
If I call:
Category cat = new Category();
cat.Perf.BigPerf.Value = 1.0;
I assume this this breaks the Law of Demeter / Principle of Least Knowledge?
If so, how do I remedy this if I have a large number of inner class properties?
One of my favourite quotes from Martin Fowler:
I'd prefer it to be called the Occasionally Useful Suggestion of Demeter
http://haacked.com/archive/2009/07/14/law-of-demeter-dot-counting.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With