> foreach (var by in Gen.Random.Numbers.Integers(1, 
> 1000).ToEnumerable().Take(100)) > Quick, where does Integers come from? I 
> have no idea.

It took a minute or so to determine that Gen is a static class with a property 
called Random which returns an IRandom, Numbers is a property of IRandom that 
returns an INumbers, Integers is a method of the INumbers interface ... the 
implementation is determined by the specific IRandom returned by Gen.Random, 
namely new RandomLink(new GenLink()). RandomLink(...).Numbers returns new 
NumbersLink(_gen), and NumbersLink.Integers can be found in 
[https://github.com/aliostad/RandomGen/blob/master/src/RandomGen/NumbersLink.cs](https://github.com/aliostad/RandomGen/blob/master/src/RandomGen/NumbersLink.cs)
    
    
            public Func<int> Integers(int min = 0, int max = 100)
            {
                if (min >= max)
                    throw new ArgumentOutOfRangeException("min >= max");
                
                var random = this._genLink.CreateRandom();
                
                return () => random.Next(min, max);
            }

Of course none of that is immediately obvious, and can't be made immediately 
obvious through namespaces or naming conventions. An IDE would be helpful, but 
only because everything is static ... in many cases this sort of thing can only 
be determined at runtime.

But two totally different issues are being conflated here: readability, and 
clashes/ambiguities between names. Namespaces address the latter; they really 
don't have anything to do with the former. 

Reply via email to