ldo/ShaderTools — comment on commit 53c5963d10c0d99e0c42e3f9a9d8e70d9839d4eb
File:  line 0
By ldo:

This is probably the most complex change I have made so far. It is also an example of table-driven/data-driven programming: instead of writing a whole lot of repetitive code, you move the repetition into a data structure, so your code ends up very compact. In effect your data structure defines a “mini-language” interpreted by that code. You might think this doesn’t reduce the complexity, it just pushes it elsewhere, but in fact this technique is usually very effective, as in this case, where I took a 2500-line routine and replaced it with a set of field/attribute definitions and a routine that together total only about 900 lines.