John R. Durant's WebLog

Office and a short, bald man

Microsoft Office Development- Object Models or Declarative XML

As enhancements are made to the programmability story of a core product like Word, Excel, Outlook, PowerPoint, Visual Studio, etc., there is a fundamental question: should enhancements be made via the OM or should they be made via an XML schema? The same question holds true for Office developers who create their own add-ins and customizations.

For my own part, I like to advance the declarative model in a lot of situations. We use for things like Research Services in Office 2003 with really great results. We also use for Smart Tag lists in Office 2002 and Office 2003 with great success.

The core OM is just that- the core OM. We can't imagine Word without Application.Documents.Document as the OM hierarchy. It makes sense as does Application.Workbook.Worksheet in Excel. We are comfortable with the convention. We know what to expect. But, what about a more niche-oriented feature? Rather than expose some functionality via the OM, there are advantages to using declarative XML.

First, it is schema based. Developers learn the schema, and they are off and running. They can use their favorite XML tools to get the job done. New tools and utilities can spring up in the community or be developed by ISVs to enhance the dev experience. This also happens for OM development, but not as easily. The declarative approach lends itself to a more open architecture in the long run. One key scenario is the dynamic generation of the XML at runtime. So, based on certain conditions, the XML file gets created and then imported programmatically (via the OM!) by the app. The app then behaves according to what the XML file contained. This is really slick model, because the XML can be created asynchronously, even if the target app is not even running (or not yet installed).

Let me know your thoughts on the question. I am doing some planning, so I am curious to know what you think.

 Rock Thought for the Day: You must check out this list of the 101 lamest pop songs of all time. I'm a Johnny Cash fan, but he earned #67 in this list. It's hard to argue with most of them, but the list should be a little longer to make room for more song by Creed, No Doubt, Michael Jackson, and Nancy Sinatra. William Hung's version of "She bangs" (which I detest) is better than Ricky Martin's. How sad.

Rock On

Published Thursday, August 04, 2005 12:49 PM by johnrdurant

Comments

 

Stephane Rodriguez said:


Is this an open question? Xml often if not always is declarative as long as it fits a particular domain space, whose Word run-time for instance can handle.
But ISVs out there will have to tightly conform to that Xml if they hope to integrate well. So it's not like everyone does its own Xml if at the end of the day the Xml must be compatible with Word.
This domain-specific Xml, for rendering purpose, could be Avalonized in the short future, and for printing purpose could be Metroized. You'll probably introduce those Xml in Office 13.

The biggest difference in paradigm is that the OM and Xml fit two great non-overlapping purposes. Xml lets you declare stuff, but then this stuff needs to be given to a run-time, and this run-time does not really loop back asking for more.
The OM however lets one execute some whatever sequence of actions, and loop over and over again to produce incremental changes.
Thus for that reason the OM and Xml have enough room to coexist.
For instance if you use Xml to type a formula, then you are stuck with it. The run-time is the only piece of code that will give it life, and by that time it does that it's out of your hands. OM however let's you make a call, expand the formula, compute the variables, read/update values in the document, and then proceed with another.
Now if you make Xml live as a real typed object within the OM, this could become a different story.
August 4, 2005 4:52 PM
 

Peter said:

My girlfriend has a MAC and I have a PC. Both have the latest version of software. In Excel the date reads 8/10/1955 from the MAC but when I copy it to a new spreadsheet the date changes. The spreadsheet I got from the MAC I changed the date to a value and that spreadsheet will read the date different from the PC. You can even type in a value on the MAC Spreadsheet and type that exact same number on the PC spreadsheet and get a different date. This has turned into a nightmare. What the FUCK they are both MS Excel. This is a FUCKING joke. This problem has been around for a while FIX IT ASSHOLES
August 6, 2005 1:39 PM
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker