dynamic naming for hierarchical problem
Roman Suzi
rnd at onego.ru
Sat Aug 11 13:30:01 EDT 2001
On Sat, 11 Aug 2001, Peter Hansen wrote:
>(Of course, follow XP principles regardless: if you
>have to spend significant time learning and implementing
>the solution with XML, don't go there. Just pick something
This is true. However, XML could be gradually entered...
without any XML at first. For example, when you
change the following "legacy":
data:
0 (0, 0, 0) 0
0 (0, 0, 0) 0
0 (0, 0, -) 0
0 (0, 0, -) 0
code:
for l in f.readlines():
m = re.match("(.*) \(.....", l)
rec = m.groups()
# rec[i] == "-" -> 0
# ... etc
into:
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 - 0
0 0 0 - 0
for l in f.readlines():
rec = split(l)
- this is one step closer XML. Then:
0 0 0 0 0
0 0 0 0 0
0 0 0 - 0
0 0 0 - 0
for l in f.readlines():
a, b, c, d, e = split(l)
...
- even closer!
(there could be one more step with special object
to allow
line.a, line.b ... access
And then:
a=0,b=0,c=0,d=0,e=0
a=0,b=0,c=0,d=0,e=0
a=0,b=0,c=0,d=0,e=0
a=0,b=0,c=0,d=None,e=0
a=0,b=0,c=0,d=None,e=0
is already almost XML!
Next logical step is XML itself: context information is now in data!
(of course, this example is too simple and better suited for RDMS
than XML, but format could be more advanced)
So, it is not necessary to jump XML right now:
system could be gradually prepared for it by
letting context info into data.
Then it will be one quantum leap and:
<myproblem:recordset>
<a>0</a><b>0</b><c>0<c><d>0</d><e>0</e>
<a>0</a><b>0</b><c>0<c><d>0</d><e>0</e>
<a>0</a><b>0</b><c>0<c><d>0</d><e>0</e>
<a>0</a><b>0</b><c>0<c><e>0</e>
<a>0</a><b>0</b><c>0<c><e>0</e>
</myproblem:recordset>
or something similar.
>simple, as Alex said and you agreed, and get it working.
>You can always plan on refactoring once the basic thing
>is working and you can focus on learning XML without the
>pressures of trying to make the system work at the same
>time.)
Sincerely yours, Roman Suzi
--
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Saturday, August 11, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "After a hard day, it's nice to come home to a warm cat." _/
More information about the Python-list
mailing list