The Obvious Final Step -- Andrzej Krzemieński

During the construction of an XML file when you write an element, it is obvious that the last thing that you do is to write the closing tag. By obvious we mean: writing it down adds no new information (there is no other possible final instruction for this task), and it would be a bug if this instruction wasn’t there.

The Obvious Final Step

by Andrzej Krzemieński

From the article:

The title may be misleading, as I had to invent a new short term for the pattern that occurs in the code once in a while. Example first:

// write an element of an XML file

xml.attribute("name", name);
xml.attribute("location", loc);
xml.end_element("port");  // <-- the obvious final step

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.