Basic Search  Advanced Search   
Topics Resources Free Library Software XML News About Us
   Ask PerfectXML
   .NET XML KB Articles
   XML Certification
   Events Calendar
   Product Reviews
   Book Reviews
   Books & Magazines
   Getting Help
   Microsoft & XML
  Sample Chapters
   By Subject
   By Publisher
   Web Services
   Native XML Databases
   Web Services
   XSLT Editors
   XML Editors
   Development Tools
   Contact Us

  You are here: home Info Bank Articles » Introduction to x++ Saturday, 14 July 2007

Introduction to x++

Article by: Kimanzi Mati E-mail

x++ is an object-oriented programming language that makes use of the XML 1.0 syntax.

Some of the benefits of using the XML syntax to write the object-oriented code include:
  • It can be parsed (not necessarily processed) by any XML parser.
  • Ability and ease to dynamically generate x++ programs by using various XML tools and other XML family of standards, such as XSLT. Infact, x++ programs can be written to generate other x++ programs.
  • x++ brings object-oriented programmability natively to XML. This means that when XML is sent across the wire, it can now have programmable objects sent instead of the plain data.
On June 14, 2002, I published the beta 0.1 of x++ after working on it for about a year. The x++ project is open source and licensed under the terms of the GNU Lesser General Public License (LGPL). The External link x++ Web site is hosted on SourceForge and contains all the documentation for x++ including a lexicon. The x++ site also contains the source code as well as the executables for all the x++ related software.

The publication of the language was met with interest from many programmers who have been interested in an easy flexible programming language based on XML. In addition, various people sent in requests for features and modifications. I rolled some of these into beta 0.2 which was released in late June. Since then my work on x++ has been devoted to the construction and release of Templx, the x++ IDE.

I have solicited aid on the further development of x++ and various programmers have gotten involved in various aspects of it. If you are also interested in helping out in some capacity or another feel free to send me an e-mail at E-mail

As mentioned earlier, x++ brings object-oriented programmability natively to XML. The XML sent across the wire can now have programmable objects sent instead of plain data. This brings the potential of developing intelligent agents to perform messaging instead of simple messages.

To give you an analogy, let's take an example of sending a courier package via services such as FedEx or UPS. When the package arrives at the destination, there are various possibilities, such as the intended recipient being unable to receive the package or message. The courier person can then ask if there is someone else to receive the package or message and make many other relevant decisions, all without returning to the source. This is what an intelligent messaging agent can do. On the other hand, recent convention with protocols like SOAP appears focussed on sending simple messages. If the message is not properly received then the return code must be sent all the way back to the source. Then the source must determine to send another message to the destination. As you can see, this can evolve in a real situation into a thrashing back and forth which can clog up internet bandwidth. Thus we find that courier messaging is superior to simple messaging for that reason. x++ presents objects which can encapsulate XML data and serve as couriers for the message transaction.

You might think that XML is too verbose to support a programming language. But, you know what? I agree! XML is verbose and so is x++. The verbosity serves the purpose of making x++ statements easy to understand, as you can quickly find out from looking at the External link lexicon of the x++ language. Okay, but what about the problem of programmers having to type many characters to enter x++ code? Here's the answer:

Templx: the x++ IDE
Templx is the IDE created to help write x++ programs, and is available for free download at the External link x++ site.

Templx allows use of templates to shorten the amount of typing that you must do. The verbose commands of x++ can now be automatically typed for you by clicking on buttons on the screen. These buttons paste in the template code for the x++ statements. All that is left to do is to fill in the blanks. These can quickly be navigated to using the F7 and F8 keys. The effect is that x++ programs can quickly be keyed in by a programmer. The result is that you have programs rendered in an XML format and ready for transmission across the Web via HTTP and SOAP.

There are other improvements lined up for Templx that will not only make keying in x++ programs even easier, but also make programming more design oriented. A GUI for class diagrams as well as program logic is slated for development in the near future as part of Templx. This will allow the coders to develop class diagrams for their applications and then the x++ code will be auto-generated from them. The reverse creation of class diagrams from existing x++ code will also be possible. This is useful from a design perspective as it allows programmers to examine the class hierarchy and the relationship between the classes in the hierarchy that they are using for their application. The use of the program flow diagrams will help to present various levels of detail in the program logic. This will enable programmers to either focus in on or abstract away from the details of the program at various sections. And since pictures speak a thousand words, the GUI features should really help to make x++ even easier to use for programmers.

Current Implementations of x++
The x++ interpreter has been implemented so far only on the Microsoft Windows NT/2000/XP operating systems. The interpreter source code as well as the IDE source code is written in C++. There are four implementations of the x++ interpreter that have been built to date.
  • XppTester.exe
    XppTester.exe is a standalone x++ interpreter that is a Windows application. XppTester can also be run from the MS-DOS console using command-line arguments. XppTester was originally created as a testing application for x++ programs. It however is very useful because it allows you to quickly run an x++ program and then examine the following x++ facets:

    1. run-time memory: the memory space for a program containing references to instantiated objects and their contents, rendered as an XML document
    2. run-time class memory: the memory space for class definitions used in a program, rendered as an XML document
    3. exception object: contains the last exception raised in the x++ program, rendered as an XML document
    4. modified program: x++ allows for programs to modify themselves, so this is a means to get at the current definition of the program after execution
    5. output stream: the output of an x++ program rendered as a string
    6. input stream: the input parameters passed into an x++ program as an XML document

  • XppEngFilt.dll
    XppEngFilt.dll is yet another x++ interpreter, but implemented as an ISAPI filter that supports Web server x++ scripting. This is fairly useful for reasons that need not be stated at this point in the development of the Web. In other words, XppEngFilt.dll allows you to encapsulate XML data within x++ objects that allow the XML, firstly to be encapsulated in a manner native to XML (because the x++ objects themselves are XML), and secondly to provide adaptability to the XML data. The arguments in the URL are converted into an input stream XML document that is accessed within the x++ program in the Web resource accessed via the URL.

  • XppEngCOM.dll
    XppEngCOM.dll is the interpreter implemented as a COM object that supports automation, allowing scripting clients to process the x++ programs.

  • Templx.exe
    Templx.exe allows you to type in x++ programs and then run them on the fly without saving them. It also allows running saved x++ files. This is an easy way to test x++ programs.

Further Work and Future Direction
There are many ideas that I and others have for where x++ could go. Here are some of the more important items:

  • Port x++ interpreter implementation to various other platforms.
  • Develop a native code compiler for x++ on different operating systems.
  • Develop a Java bytecode compiler for x++ so that it can compile to run on the JVM.
  • Develop a MSIL compiler for x++ so that it can compile to run on the .NET CLR.
  • Develop the ability to access C libraries within an x++ program.
Hopefully, by now you have some idea of where x++ came from and where it is going. Feel free to download the binaries from the External link x++ Web site and direct any comments to me at E-mail
  Contact Us | E-mail Us | Site Guide | About PerfectXML | Advertise ©2004 All rights reserved. | Privacy