String concatenation considered harmfull (or how is HTML different than XML with regards to creating it)
From Brad, I got to Craig’s post about the bad things that happen when you build XML by string concatenation. His core statement is:
The moral of the story here is that if you find yourself doing something like this:
xml = “" + fooContents + " ”;
then you should lose points on your programming license.
Now, I wonder how is XML different than HTML with regards to creating it. After all, you should probably be creating XHTML anyway, as it’s the most compatible way of doing it. So, you should * also * lose points if you’re doing the following:
output.WriteLine("<FIELDSET><LEGEND>Federation namespace list</LEGEND></FIELDSET>");
Guess where you will find **TONS** of code like that. This is so 1996 of them!!
/kzu
/kzu dev↻d