Python declarative

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Jan 26 07:21:18 EST 2014


On Sun, 26 Jan 2014 08:03:18 +0200, Frank Millman wrote:

> I do not expect anyone to read or edit the XML - it is just a storage
> format. I am sure it could be done in JSON or YAML as well.

But that's not what you originally said. You stated:

"here is how I would write your simple 'About' box"

and compared your XML to actual code written by Chris.

As I said in my previous post, if the XML is intended as a purely 
internal document, written by and read by your application, it's not so 
bad. (But then XML is intended for document *exchange*, i.e. from one 
application to another. If your XML is just used *internally*, with no 
interchange needed, why not use a more efficient internal format?

XML's strength is that it is a well-known standard that allows 
application A to interchange documents with application B. But it's 
weaknesses include, it is neither efficient like a custom-designed binary 
format, not human-editable.

It seems to me that if I were in your position, I would have the GUI 
designer generate source code in some language directly, rather than XML. 
Ah, wait! An idea strikes... if your GUI designer generates XML, you 
could then have a plug-in system to convert the XML to source code in 
whatever languages the plug-in supports. So that's a possible good use 
for XML as an intermediate language.


> One objective is to make it easy for non-programmers to modify forms and
> create new ones. I showed a screenshot earlier that illustrated a
> 'button' definition.

The idea of drag-and-drop GUI designers is hardly new. I was using one 
back in 1986 or '88, Apple's Hypercard. Now that was a user-friendly 
programming language/environment/toolkit.


-- 
Steven



More information about the Python-list mailing list