[Tidbit] making your D code more modular & unittestable

Moritz Maxeiner via Digitalmars-d digitalmars-d at puremagic.com
Wed Mar 8 13:54:27 PST 2017


On Wednesday, 8 March 2017 at 21:34:19 UTC, H. S. Teoh wrote:
> [...]
>
> tl;dr: Whenever you have a data structure or a function that 
> depends on a concrete type like File that introduces a 
> dependency between modules, templatize it!  In fact, templatize 
> your code whenever possible -- the more the better.  D 
> templates make your code cleaner, more modular, and more 
> unittestable. And you get attribute inference for free.  Learn 
> to love templates! :-P

Interesting read, thank you. Would you consider writing a blog 
post about this (you know, for community growth enhancement 
purposes ;p )?


More information about the Digitalmars-d mailing list