OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: Procedural vs Declarative XML transformation approaches

[ Lists Home | Date Index | Thread Index ]
  • From: "Clark C. Evans" <cce@clarkevans.com>
  • To: Mike.Champion@SoftwareAG-USA.com
  • Date: Sun, 05 Nov 2000 11:09:22 -0500 (EST)

In 1989, when I first started writing programs for 
Windows 3.0 with Petzold's book in one hand, the primary
part of the program (for each window) was the event 
handler -- one huge switch stement:

  switch(wparm) {
     case WM_CLOSE:
       // code to handle the window closing
     case WM_MOVE
       // code to handle the movmement of a window
      ...
  }

These statements could grow to be several pages long,
violating one of the first rules in P.J.Plaugher's 
book on "style" which said that each function should
be only 10-15 lines long.
      
Then, in 1991, I started to use Borland's compiler which 
had a message dispatch (message cracker) mechanism:

  BEGIN_MESSAGE_MAP
    MESSAGE(WM_CLOSE,close_func)
    MESSAGE(WM_MOVE,move_func)
    ...
  END_MESSAGE_MAP

  close_func(LPARM lp) {
     // code to handle window closing  
  }

  move_func(LPARAM lp) {
    // code to handle window moving
  }

This was a huge improvement, since the GUI could help
you write the message map, and would build the stubs 
for you and your event handler methods could now be
10-15 lines long.  Then, shortly there after, C++/MFC 
matured and made this process more transparent and
"object-oriented".

...

I don't necessarly see XSLT as "declarative" as 
much as I see it as "event oriented".  With the 
apply-templates/select and template/match pair 
analogous to the "message dispatching" system
found in modern event-driven windowing libraries
for the C language.  In effect, the template
mechanism breaking down into two manageable parts 
what would have otherwise been a for-each 
with a large, hard to manage choose statement.

Thus, I see James Clark wisely skipped the late 80's
event programming model, and moved us right into 
state of the art in the mid-90's.

I hope this view helps,

Clark





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS