Re: how to store list of varying types
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Tue, 01 Jul 2008 14:48:41 -0400
See below...
On Tue, 1 Jul 2008 18:17:08 +0200, "Giovanni Dicanio" <giovanni.dicanio@xxxxxxxxxxx>
wrote:
****
"Joseph M. Newcomer"
Thanks for your historical perspective, Joe.
On the other hand, the data structures discussed by the OP are very
trivial structures;
they do not have complex nesting, or need to be checked against various
complex
predicates. The cost of parsing what is essentially a "flat" structure is
very small. So
it is not clear the efficiency arguments are quite as compelling. While
the text can be
xml, a simple parser is a tiny effort to write (a few hours at most for a
flat structure.
I wrote an XML parser from scratch for a complex nested structure in six
hours, including
all the high-level parsing, and I will publish it when I release the
program on my MVP
Tips site, Real Soon Now)
Joe: you can't consider yourself a "benchmark" for programming :) I mean,
you are superior of the "average programmer". If that work took to you 6
hours, I believe for the average programmer it will took much more :)
Moreover, I understand that you have deep knwoledge of compiler technology
(and I think that the parser is a sub-system of compiler technology), so you
must be very familiar with this kind of stuff and parsing algorithms.
I was writing this stuff 44 years ago; it isn't deep or complex at all. It doesn't even
require a deep understanding of compiler technology. I've got to finish the project and
do the writeup, but fundamentally, it is very straightforward. I used to assign projects
like this to beginning programming classes...it gives them a feel about how things that
they think are overly complex are really straightforward.
****
*****
Frankly speaking, I would write an XML parser only for learning purposes
(and time spent for learning new things is of course quality time), but for
production code I would use a well written and well tested 3rd party XML
parser like TinyXML (or XmlLite).
(It is kind of like STL containers: I wrote some linked-list and array
classes for learning and practicing some C++, but for production code I
prefer using robust well-tested STL.)
I wrote it because I had asserted here that I could write an XML parser in an afternoon,
and I did (much of the time spent was not on the parser itself, but on designing and
implementing the data structures for my application. I went through a couple iterations
before I finished). Now, having written it, it demonstrates that in the simple case this
is very straightforward (the lexer was coded in under an hour) and I plan to use the code
as a tutorial on doing simple parsing. Too many things to do...
joe
****
Joseph M. Newcomer [MVP]
My 2 cents.
Giovanni
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: how to store list of varying types
- From: Joseph M . Newcomer
- Re: how to store list of varying types
- References:
- Re: how to store list of varying types
- From: Tom Serface
- Re: how to store list of varying types
- From: Giovanni Dicanio
- Re: how to store list of varying types
- From: Joseph M . Newcomer
- Re: how to store list of varying types
- From: Giovanni Dicanio
- Re: how to store list of varying types
- Prev by Date: Re: strange behavior using CWinThread
- Next by Date: Re: Book recommendations
- Previous by thread: Re: how to store list of varying types
- Next by thread: Re: how to store list of varying types
- Index(es):
Relevant Pages
|