woodwardiocom: (Coding)
[personal profile] woodwardiocom
Several jobs ago, I was assigned to track down a particular bug in our firm's main web application. In the process of doing so, I found that, for reasons unknown to me, some of the data was being passed around in comma-delimited strings, like so:

"foo,bar,baz"

Well, okey-doke, if you wanna, sure.

It also transpired that, in this context, a zero-length string could be a perfectly valid piece of data, like so:

"foo,,bar"

Foo, then nothing, then bar.

It also-also was true that the number of pieces of data could vary from zero to some arbitrarily large number.

"foo"
"foo,bar"
"foo,,bar,baz,bax,,scott,jean,hank,warren,bobby"
","

That last, of course, represents two pieces of data, both of them being zero-length, separated by one comma.

It turned out, after (not too) much noodling, that the problem was that this system had no way of distinguishing between "no data whatsover" and "one piece of data, which is zero-length". They're both represented by the same comma-delimited list, "". I ended up having to write an encoder-decoder that turned zero-length pieces of data into something unlikely to occur in actual code, like "[[]]". Not too much later, I moved on to somewhere slightly more sensible.

Profile

woodwardiocom: (Default)
woodwardiocom

February 2020

S M T W T F S
      1
23 4 5678
9101112131415
16171819202122
23242526272829

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Mar. 21st, 2026 12:02 am
Powered by Dreamwidth Studios