background image
<< Programs Are Hard, Libraries Are Easy | Mock Code >>
<< Programs Are Hard, Libraries Are Easy | Mock Code >>
Separate Form And Functionality
Separate Form And Functionality
HTML is hard to test
It changes a lot
It's hard to parse
Instead of going from XML straight to HTML
...go from XML -> agnostic format -> HTML
Test the XML -> agnostic part
Test the agnostic -> HTML part
Much easier to test when only one of the input/output pair is
formatted.
...and you'll have improved the flexibility of your code.