Sunday, February 9, 2014

Documenting APEX Development

Most of us started programming using the Edit -> Compile -> Link -> Test cycle.  Whether we edited our source code in a simple editor like vi or in a development environment like Eclipse, we always had a source code file that we could print, or share with co-workers, or save in a repository.  The source code was a record of exactly how we solved a particular problem.

In declarative programming environments like APEX, we don't have any source code.  We develop pages by working through the APEX wizards in a browser window. Yes, we could export a page; but the resulting exported code isn't intended for mere human readers, and it's certainly not a road map to developing a similar page. Someone reading the export could not easily see what choices the developer made, or when the developer took the defaults.

So, how can we document what the APEX developer sees as they work through the widgets?  We could take a lot of screen shots and paste them into an MS Office or OpenOffice document.  Many of the APEX wizards display a page that would take four or five screenshots to document; pasting all the snapshots into another document is a pretty clumsy process.  We need a way to capture the whole browser page in fell swoop.

Printing the browser page does a good job of document everything on the page, but rather than printing to paper, we can print to the Microsoft XPS printer.   XPS is a device-independent document format describing the layout and properties of a document using XML.  The Microsoft XPS printer prompts the user to save the XML document in a file, and these files can be viewed using a XPS viewer.

The XPS files aren't source code, but in a declarative programming environment, they're the next best thing. Now you never need to wonder again how you defined a control, configured security, or defined a region. Just print the definition as an XPS file. Be sure any text areas are large enough to display all code that you entered, and then print the page, choosing XPS as your printer.  Save the XPS file with a descriptive name, and you will have saved a record of how you defined the object.  Now we have file that we can view later, share with co-workers, or save in a repository.