KBD

Keith Devens .com

Saturday, November 22, 2008 Flag waving
Mongol General: "What is best in life?" Conan: "To crush your enemies, to see them driven before you, and to... – Conan (Conan the Barbarian)
← That's the LAST time I buy any UMAX productDialectical tension →

Daily link icon Friday, October 31, 2003

Data often needs context

A lot of times we don't pay attention to it, but in many instances, data, to be meaningful, requires more context than we often give it. For instance, character data, to be meaningful, needs to have some character encoding specified. Like, you can give someone a text file, but is it ASCII, Unicode (UTF-8, UTF-16 (BE, LE, or BOM-distinguished)), SHIFT-JIS, EBCDIC, etc. etc.

Same goes for times (is it UTC, or some other time zone?). I was thinking about this in the context of my data being stored in MySQL. There're no time zones associated with my dates and times, and there's no character encoding information stored with my character data. That makes me uncomfortable. For instance, without being really careful about what date it was when a time was entered, I can't even go back and figure out what time something was really written or entered into my database... was it daylight savings time or not during that time? So, if I were to convert it all to UTC (GMT), I'd have to be careful about whether DST was in effect. And then, for instance, if I were to display a past weblog entry, the time displayed might not actually be the time the post was written.

There are other times data needs context... for instance, a data file format might need a version number for it to be meaningful. Also think of the problem that RSS had, where the <description> field was never well defined. Some people started put HTML in there and applications were built to match, so if you put plain text and had something that looked like HTML in it you'd have a problem.

By the way, this is the criterion by which I usually decide whether something in XML has to be an attribute or a value. If it's "context", and describes the value, then it should be an attribute. If it's the main data you want then it should be a value. Of course, there are times when something could be either, but I see often see cases where the I think the designer made the wrong choice according to this criterion.

What other cases of this are there?

← That's the LAST time I buy any UMAX productDialectical tension →

Comments XML gif


Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

November 2008
SunMonTueWedThuFriSat
 1
2345678
9101112131415
16171819202122
23242526272829
30 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 4 posts

Recent comments XML

Calif. Supreme Court to take up gay marriage ban

I would argue the point is not​definitional.  While the word​marriage is su...

Justin: Nov 20, 4:37pm

Java join function

Meh, don't have null strings in​your string arrays imo, but you're​welcome ...

Keith: Nov 19, 7:51pm

Girls, please don't get breast implants

sorry but another thing i have to​make a comment on about you​men...the men...

happynow: Nov 17, 11:36pm

Books by Vincent Cheung

to all Cheung​fans:

read:

http://www.progin​osko.com/aquascum/cheung.h...

Zamir: Nov 16, 9:07am

Generated in about 0.242s.

(Used 8 db queries)

mobile phone