Scrap Your Boilerplate
暂无分享,去创建一个
Many programs traverse data structures built from rich mutually-recursive data types. Such programs often have a great deal of “boilerplate” code that simply walks the structure, hiding a small amount of “real” code that constitutes the reason for the traversal. ”Generic programming” is the umbrella term to describe a wide variety of programming technology directed at this problem. All these techniques aim to provide mechanical support for the “boilerplate” part, leaving the programmer free to concentrate on the important part of the algorithm. Such generic programs are much more robust to data structure evolution because they contain many fewer lines of type-specific code.