dry but why?
TRANSCRIPT
DRY: But Why?
The warning signs, symptoms, and cure for repetitive html syndrome
By Michael Knueppel
Monday morning<Developer’s Phone Rings…>
Developer: “Hello?”
Client: “I need you to make me a website”
Developer: “Sure!”
Client: “I want the site to have 100 web pages. I need it done by tomorrow morning”
Developer: “No problem. I type 120 wpm, so I can have it deployed by tonight”
Client: “Sounds good”
The warning signEach web page needs to have the same header
The developer begins coding View #1
All 100 web pages have the same header
The developer is a fast typer, on a tight deadline, so the html block is copy/pasted 100 times
The app is completed in record time!
The Symptom
<Client’s phone rings>
Client: “Hello?”
Developer: “All done”
Client: “Wow, the header looks great! But it has a spelling error. Can you fix it?”
<Developer is overcome with gloom>
What went wrong?
The header was copy/pasted into each view
Even a minor change, such as correcting a spelling error or syntax error, requires editing many files
In this case, 100 files needed editing
The cureExtract repetitive html into a partial template
To correct the spelling error, only one file needs to be edited (the partial template)
Partial templates provide the infrastructure for a low-maintenance app
The implementation
For an example of how to implement a partial template, see my 2nd-to-last blog entry at
michaelknueppel.com