[Tidbit] making your D code more modular & unittestable

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Mar 10 21:12:26 PST 2017


On 3/8/2017 1:34 PM, H. S. Teoh via Digitalmars-d wrote:
> [...]

Bingo.

If your algorithmic code includes code to read / write files, that's a big sign 
things are not properly encapsulated in the code.

Using ranges is a great way to accomplish this, and as you discovered, a bonus 
is that the range can be replaced with an array for easy unit testing.



More information about the Digitalmars-d mailing list