Last month in our blog on Software Testing for State Machines with Altova UModel we discovered unexpected behavior in our model of an air conditioning system and challenged readers to improve the design. This post describes one possible solution. When we ran the Tester application for our model, we saw that the Power switch did not turn the system off when it was in the Standby state. In the state machine diagram in our original model, the only route into Standby from Operating mode is via the Standby button, and the only way out of the Standby state is to press the Standby button again, as seen in the detail below. We can create an alternate exit to power off the system from the Standby state simply by drawing a new transition line from Standby to the Off state, and assigning powerButton() as the event that triggers the transition. UModel makes assigning the trigger easy by providing a pop-up window listing events that are already defined in the model. Our completed revision to the model with the new transition from Standby to Off looks like this: After regenerating the Java code and compiling the new version, we can run the Tester application again. The Debug output message window shows that the system entered Standby in Event 3. Event 4, activation of the Power button, now sets the state to Off. Find out for yourself how you can enhance the logic of your own state machine diagrams with Altova UModel – download a free 30-day trial today!
Tags: data mapping, MapForce, v2011r2
In response to several user requests, the if-else component in MapForce has been enhanced in MapForce 2011 Release 2 to accommodate any number of variables. This feature, which is equivalent to a switch statement in many programming languages, enables you to easily control the flow of data in a mapping project by matching a value to a selected criterion. For example, the screenshot below shows the if-then component used in combination with other components to analyze temperature data and produce the following results:
- If temp is greater than 20, true is passed on to bool1 and "high" is passed on to value-true1.
- If temp is less than 5, true is passed on to bool2 and "low" is passed on to value-true2.
- Only one of the value-true parameters can be true for any given temperature, and that is the one that is passed on to the desc attribute in the target component.
The screenshot above is taken from the sample file Classify Temperatures.mfd included during the MapForce installation, so you can immediately process the sample data or modify the mapping to see the output for yourself. The new expandable if-else functionality helps developers build data mappings more rapidly, creates a mapping diagram that displays the conditional test more effectively, and facilitates testing and debugging because the expanded if-else function is much easier to read than a cascading structure of individual components. This is even more obvious when you have to evaluate a large number of conditions. The screenshot below shows a conversion from string to number where the string consists of a three-letter abbreviation of the month. (To save space here, this if-else function only processes strings for the first six months of the year.) In a copy-paste oversight we forgot to update the output constant for May from the value 4 to 5. That’s a much easier error to find and fix when you can see all the logic in one view!(UPDATE: We originally created this example to illustrate the advantages of Expanded If-Else over nested or cascading If-Else mappings that can quickly grow too large to view on a single screen. For a better design for solving this and other similar conversions using a look-up table, see the Switch Statement vs. Look-up Table in MapForce blog post.) Find out for yourself how easy it is to use expanded if-else functions in your own data mapping projects. Download a free 30-day trial of MapForce.
Tags: agile development, software modeling, software tools, UML, UML tool, UModel, v2011r2
Many varieties of software testing have gained prominence as developers search for ways to improve quality and meet project deadlines – code review, unit testing, regression testing, beta testing, test-driven development, and more. Regardless of a project’s goals or the source code language employed, it’s well accepted that the earlier a defect is found, the easier, cheaper, and more rapidly it can be fixed. Code generation from UML state machine diagrams, a new feature introduced in Altova UModel 2011 Release 2, can be used to validate conceptual logic very early in project development. Real-world design in a state machine diagram An example included with UModel provides a simple and realistic state machine diagram with a small test application you can run to see for yourself how easily it can be to test the logic of a design. The state machine diagram in the AirCondition.ump project in the UModel 2011 examples folder describes the operation of a typical heating and air conditioning system. The system includes a power button shown on the left side in the transition from the Off state, a modeSelect function that selects heating or cooling, a speedSelect function for the fan, and a standby button that puts the system in the standby mode shown on the right. The example project folder includes all the code generated for the diagram by UModel in Java, C#, and Visual Basic. To try out the Java version, all we have to do is use the command javac STMTester.java to compile the code and java STMTester to run it. The tester application displays a simulated control panel with information windows about the heating and air conditioning unit. The operating buttons appear along the top, the current state is described in the first window, and output messages generated by changes in the system appear in the second window. As shown above, the system initializes in the Off state, the mode is set to heater, and the fan is off. Before you operate the system, you might want to resize the control panel and state machine diagram to follow the actions of the tester application in the diagram itself, as shown in the reduced size image below. Operating the state machine When we click the powerButton, the Current state window is updated and a detailed description of the operations that occurred are listed as Event 1 in the Debug output messages window. If it’s a hot day, we might want to change the mode to Cooling and increase the fan speed, which we can do by clicking the modeSelect and speedSelect buttons. The Current state window updates with each click, and Event 2 and Event 3 are added to the output messages window. Now we can see how the tester application lets us fully exercise the logic of our state machine diagram by clicking every possible sequence of button selections to see if they produce the expected results. For instance if we put the unit in Standby mode (Event 4 below), then press speedSelect, we see in the output messages for Event 5 that no state change occurs in the substate named RegionSpeed. Compare Event 5 to Event 3 in the output messages window as shown below. Now that the system is in Standby mode and we don’t need any heating or cooling, let’s save energy by pressing the Power button to turn it off. Wait a second – it looks like nothing happened. No transition took place in Event 6, and the Current state in the top window is still Standby! Looking back at the state machine diagram, we can see the only way out of Standby mode is to press the Standby button again. Is that really the behavior an average user would expect, that the Power button would not turn off the system from Standby mode? Just imagine how expensive this issue could be to fix if it was first identified much later in product development when the prototype was being tested by a regulatory agency! Here’s a challenge we’ll throw out on the table for our readers: how would you design another more direct route from the Standby state to the Off state? Testing your own state machines You can use the UModel state machine code generation example projects as templates to create test applications for your own designs. You will want to take advantage of the UModel feature that automatically creates operations in a class as you add operation names to transitions in your state machine. Also, the UModel Help system includes detailed information about code generation from state machine diagrams and also uses the AirCondition.ump project file as an example. Find out for yourself how you can improve project development by testing the logic of your own state machine diagrams with Altova UModel – download a free 30-day trial today!
Tags: Altova XMLSpy, Blog, BPMN, data mapping, database charts, database reports, diff merge tool, DiffDog, file comparison, MapForce, MissionKit, reporting tool, software tools, SQL Server, UML, v2011r2, XML charts, XML Editor
The industry is abuzz with the latest news announcing our release of the MissionKit Version 2011 Release 2. The release is loaded with new features for chart and report creation, enhanced data mapping capabilities, new XML Schema editing functionality, support for the latest version of BPMN, and a really cool new feature for comparing and merging Microsoft® Word documents. Dr Dobb’s and SQL Server magazine are just a few of the industry publications and blogs that covered the launch. Read what the industry is buzzing about and then download a free 30-day trial of the MissionKit and check out for yourself all the powerful new features now available in our suite of XML, database, and UML tools!
Tags: StyleVision, v2011r2
We’re listening.Altova clients have been asking us when they would be able to include barcodes in their StyleVision templates and now they can! StyleVision 2011r2 users can generate barcodes with a single click and insert them into an SPS template for use in eForms, as well as HTML, RTF, PDF, and Word 2007+ output. This brings even more advanced functionality to stylesheet and report design for XML, database, and XBRL data in this unique tool. Simply click on Insert Barcode from the Insert menu, define the type from the Barcode4J library and add the value used to generate the pattern (“text”). StyleVision gives users complete control over the presentation and appearance of barcodes – other properties that can be controlled via the dialog box include size, alignment, colors and borders. You can even use an XPath expression to assign a barcode to a property value.Altova is really excited about providing our clients with the ability to include barcodes in StyleVision-generated output. From larger companies supporting enterprise systems to smaller organizations looking to facilitate electronic data exchange without the use of middleware, StyleVision supports the goals of a broad range of users.Please note that a Java Runtime Environment 1.4 or later (32-bit or 64-bit as appropriate) must be installed to support this feature.
Tags: v2011r2, XML Editor, XML Schema, XMLSpy
Let’s take a look at some of the new features for working with XML Schemas in the latest release of XMLSpy.
Sorting in Schema View
When you’re working in the graphical XML Schema editor, you can now sort some or all of the schema components alphabetically with a single click. This is a huge time saver when you need to organize large schemas that have evolved over time and for understanding new schemas that come across your desk. Simply click the A-Z button in the Schema Overview window and select the sort options you prefer. Your components are instantly sorted in the graphical view… …and when you click over to Text View, the schema code itself is reordered and organized.
Another new feature that’s invaluable when working with complex schemas or ones inherited from other developers is schema refactoring support. Taking advantage of XMLSpy’s powerful Find in Schemas functionality, you can quickly locate all the instances of a global element or type across a schema – and all imported and included schemas – and then rename that component in each place it occurs. This makes schema refactoring easy while ensuring the validity of all impacted schemas.
Intelligent Support for Changing Types
You may also find the need to change the type of an element or a base type, which previously meant reconfiguring all the facets associated with that component. This new feature gives you the option to preserve any facets or attributes that are compatible with the new type.
Customizable XML Schema Documentation
Another option schema developers have requested quite often is the ability to customize the comprehensive XML Schema documentation generated by XMLSpy. This is now possible via integration with StyleVision. The StyleVision stylesheet design tool provides countless advanced options for customizing the documentation templates, from adding your company’s logo and branding to changing the appearance and organization of the documentation completely. StyleVision integration also gives you the option to generate documentation in PDF in addition to the HTML, Word, and RTF output options available for the fixed documentation in XMLSpy. Here’s an an example of XML Schema documentation we customized for the fictional Nanonull corporation: XMLSpy 2011r2 also ships with several useful documentation templates that can be used as is or customized further in StyleVision:
- XML Schema Structure Overview: documents the structure of global elements and complex types to the number of levels you specify
- All XML Schema Type Derivations: displays all simple and complex types and their derived types in a tree format
- XPath List: generates all possible XPath statements that are possible for a schema based on a user-specified number of levels
- Statistics: lists the numbers of elements, types, attributes, groups, etc., for the overall schema, and for each associated schema file
To use a custom schema documentation template, you must have XMLSpy and StyleVision installed. If you are a MissionKit customer, you already have both tools and can take advantage of this feature and countless other options for working with XML Schema, from stylesheet and report design, to data mapping, and more. If you aren’t currently a StyleVision customer, grab a free trial from our Web site. The XBRL and WSDL documentation generated by XMLSpy may also be customized using StyleVision. As always, we rely on your input and feature requests when planning each release – please let us know what you think of these new features and what you’d like to see in the next product version by leaving a comment here on the blog.
Tags: Altova, Altova XMLSpy, DatabaseSpy, MissionKit, StyleVision, v2011, v2011r2, XMLSpy
Altova first added support for charts and reporting the Altova MissionKit with the launch of Version 2011 last September. The v2011 reporting functionality includes options for line charts, 2D and 3D bar charts, 2D and 3D pie charts, round gauge and bar gauge charts. Here are a few examples:
Advanced chart features in v2011r2
Version 2011 Release 2 of the Altova MissionKit, introduced on February 16, adds an exciting group of enhancements to the chart and reporting features in XMLSpy, StyleVision, and DatabaseSpy. The chart design options and user interface work the same way in all three applications, so MissionKit users can work intuitively and productively as they move from processing XML data in XMLSpy, to preparing charts for a business intelligence report with StyleVision, and even when they create graphical displays directly from SQL query results in DatabaseSpy. The wide range of new customizable charting features introduced in version 2011 release 2 includes:
- Stacked Bar charts
- Area charts
- Stacked Area charts
- Candlestick charts
- Chart overlays
- Background images and color gradients
- Ability to change position of axis labels
- And more!
Now you can create attractive and informative charts to represent a wide variety of data sets without exporting data to a dedicated charting application. Charts created using the Altova MissionKit are not limited to any specific presentation technology – for instance you can use StyleVision to include charts in HTML, Microsoft Word, RTF, or PDF documents, or you can save charts created in DatabaseSpy in a variety of image formats at the custom resolution you specify. In this post we will show some examples of the new charts and features available in all three MissionKit reporting and charting applications – XMLSpy, StyleVision, and DatabaseSpy.
Stacked bar charts
Stacked bar charts are a variation on bar chart presentation and are especially useful when multiple ranges of data need to be illustrated. Stacked bar charts are also useful to more clearly illustrate data in a smaller area. The image below shows a stacked bar chart to illustrate the performance of a sales team by region over two years Note that the combined height of each stack in the Stacked Bar Chart represents the total sales over the two-year period for each Territory, since the sales for Last Year are added above the Year To Date numbers. Stacked bar charts complement regular bar charts and 3-D bar charts to offer users the greatest flexibility in illustrating SQL query results. If the user prefers horizontal bars, a checkbox labeled Draw X and Y exchanged in the Change Appearance tab selects that orientation. This orientation option is also available for other 2-D bar charts, line charts, area charts, and candlestick charts.
Area charts are similar to line charts, with shading applied to make a more graphically appealing display. The area chart below shows a record of temperature and humidity changes by hour over the course of one day. Creative application of color can emphasize the point! To successfully build an area chart, the analyst must consider the values in each data category. As the area chart is constructed, each category forms an opaque layer on top of the layers for data retrieved previously. In the case illustrated above, Temperature was always a larger number than Humidity, so a SQL query was constructed in DatabaseSpy to retrieve the Temperature value before Humidity to prevent Temperature from acting like a curtain to hide the Humidity data. However, if the data columns appear in a sequence with values in increasing order, the last layer would overlap and hide all the preceding layers. In that case, the chart tab heading titled Select Data lets the user add and delete columns from the results to re-sequence the data correctly. The Select Data column also lets the user edit the names assigned to each column on the X-axis label. As alternative solution, the Transparency option in the Change Appearance tab lets the user adjust color levels to allow hidden layers to show through.
Stacked area charts
As implied by their name, Stacked Area charts layer the columns of a data set to illustrate the overall sum of a data series. Stacked Area charts also eliminate the potential overlapping data problem that can occur with regular area charts. The chart below shows a table of air passenger revenue miles traveled by month, with individual regions for domestic and international travel. The Stacked Area chart creates a graphical representation of the total of Domestic and International miles, even though the total miles value was not part of the provided data. This is apparent at the top of the January entry, where the International region intersects the Y axis just below 600 (the original data showed 392 million Domestic miles and 181 million International miles, for a total of 573). A strategic data analyst will always consider the nature of the data to be reported when choosing any particular chart type. For instance in the weather example we used above, adding temperature and humidity values in a stacked bar chart would not be logical!
Candlestick charts were originally developed by a wealthy Japanese businessman who began trading at the local rice exchange around the year 1750. He kept records of the local market psychology, learning to boost his profits by carefully monitoring prices and not rushing into trades. Today, charts are used to represent financial data such as stock prices over a period of time. Every day the market is open, each stock has four relevant data points that can be rendered in a candlestick chart: the price at market opening, the price when the market closed, the high price during the day, and the low price during the day. Investors and financial analysts like to view these indicators to gauge the stock’s performance over a period of time. In the candlestick chart below, each solid bar represents the range between the opening and closing price and the thin vertical line through each bar shows the extent of the high and low prices for the day. In this version of the chart, following common convention, the color of each bar signals whether the stock was up or down for the day. If the bar is green, the stock was up for the day– it opened at the price indicated by the bottom of the bar and closed at the price indicated by the top. If the stock was down for the day, the bar is red and the symbolism is reversed – the stock opened at the price indicated at the top of the bar and closed at the price shown by the bottom. Numerous options are available to set line and fill colors, the Y-axis range and values, and more. Because they were intended to be printed in black and white, the original candlestick charts used empty bars to indicate the price increased and solid bars to indicate price decreases. The Altova MissionKit offers this option: Another candlestick chart variation omits the opening price and simply illustrates the range by a vertical line and the closing price by a horizontal line. This option is automatically supported when a data set only includes the high, low, and closing prices.
The Overlays feature lets you combine multiple charts in a single image. Each overlay chart has unique settings and can even be generated from a separate data file. The image below shows a candlestick chart of a stock’s daily prices with the daily sales volume in a bar chart overlay.
Support for background images & color gradients
The ability to specify background color gradients and background images gives you even more flexibility for creating customized, eye-catching charts. Overlaying one chart on another lets you visualize multiple data sets with different Y-axes and types. The Change Appearance dialog lets users select a background image, as in the Winter Games chart above, or apply a background color gradient, as in the Summer 2010 chart below. If you’d like to see for yourself how easy it is to use Altova tools to create attractive charts from XML and database data, download a free trial of the Altova MissionKit.