PowerBuilder 9 in review

This article was originally published in VSJ, which is now part of Developer Fusion.
When was the last time you were asked to develop an application that sat on a desktop machine and had no connections to databases or web sites, no collaborative documents, no group workflow? Everything seems to be 'connected' now, and your applications are likely to pull information from at least one back-end data source, and make the results available to a range of others.

PowerBuilder describes itself as a RAD for building enterprise distributed, web, and client/server applications, so is obviously looking at the right market. The latest release of the software, version 9.0, comes with support for JSPs, XML and Web Services. It also has support for application server platforms including IBM WebSphere and BEA WebLogic.

Those of you with long memories will remember PowerBuilder as essentially a RAD tool for database development, but the product has moved on to much more general areas where it offers competition for other general development software such as Visual Studio.

The package includes Adaptive Server Anywhere, Sybase's relational database that is designed for use either in client/server or single machine use. You also get PowerDynamo, a suite of tools for building and managing database-hosted web sites and mobile workforce Intranets; and InfoMaker, a data access, management, and reporting tool. It also has a good set of tutorials to guide you through building a client/server application, a PowerDynamo web application, and a JSP Web Services application.

Looking at the new features of this release, one of the major developments is improved XML and Web Services support. You can now import and export XML in the DataStore and DataWindow objects using XML template objects. If you're using the Enterprise Edition of PowerBuilder, you can make use of PBDOM, the PowerBuilder implementation of the Document Object Model (DOM), a programming interface defining the means by which XML documents can be accessed and manipulated. On the Web Services front, you get a wizard that creates a custom tag with the information necessary for calling a Web Service in a JSP. There's also a JSP Web Target wizard that creates a PowerBuilder target in the form of a JSP page with Source and Build folders and a deployment configuration. If you prefer Windows Web Services, a PowerBuilder application can now act as a client consuming a Web Service.

RAD is helped along by a variety of wizards and pre-built programming objects
RAD is helped along by a variety of wizards and pre-built programming objects

The option of creating a PowerBuilder application to act as a client to an EJB component running on an application server that is J2EE compliant (such as Sybase EAServer, IBM WebSphere or BEA WebLogic) will be important to developers working in a Java context. Other more general improvements include a runtime packager, resource monitor, and inclusion of the PowerBuilder Native Interface (PBNI), a standard programming interface that you can use to create extensions to PowerBuilder, or to embed the PowerBuilder virtual machine into C++ applications.

Development environment

PowerBuilder can be used to build applications or server-side components, jointly referred to as "targets" by the software. You work in a workspace that can contain one or more targets.

A PowerBuilder project can be designed for multiple "target" environments
A PowerBuilder project can be designed for multiple "target" environments

When creating a target in PowerBuilder you get a choice of several types of target, including a template application that uses a wizard to help you build the application by answering questions such as which objects should be generated and which database you want to connect to. Other options include components to run against the application server that is included with PowerBuilder; COM/MTS/COM+ components; JSP targets, web sites, and automation servers.

Each of the targets guides you through the basic steps of setting up an application, so you end up with all the supporting elements. For example, if you just accept all the defaults in the target application and pick a suitable database, you 'create' a number of HTML pages including an 'about' page, a main page plus three sheets with links from the main page, all with appropriate properties for whether they are re-sizeable, what background colours are used, whether they have a control menu, what the connection settings are, and so on.

Further into the development process, you work in a set of painters. In general, you start by using a wizard to get the basic layout and design created for you, but you can then go on to manipulate the appearance of your design using design-time controls. You can switch views to see the script behind your visual design, or, where appropriate, the way that the current HTML page will appear at run-time. Once you're happy with the details of your application in terms of the way it looks and works, and the scripts behind the scenes, you can choose your output option – your "project" in PowerBuilder terms. This might be an application consisting of an executable file and optional dynamic libraries; an automation server; or a COM/MTS component. You can also choose to create various EAServer elements, including an EAServer component that can be used with other EAServer clients or components; an EJB client proxy that can be used by a PowerBuilder client to access functions in an EJB component on an application server. If you're developing for the Web, you can choose a Web DataWindow container to make your data windows (of which more later) available to EAServer. More generally, you can also create a Web Service Proxy that can be used by a PowerBuilder client to invoke a Web Service defined in a WSDL (Web Services Description Language) file.

Objects, wizards and data handling

Having created your target, you can then go on to add things to it, including your own PowerBuilder Objects. The PowerBuilder environment has a range of wizards that you can use to create functions, menus, standard and custom classes, structures, visual classes, EAS components, automation servers, and COM/MTS/COM+ components. You also get wizards to guide you through the creation of a range of web objects – web/JSP pages, 4GL web/JSP pages, data aware web pages, frameset pages, cascading style sheets, and JSP Web Service proxies. 4GL web pages are enhanced web pages containing extensions to generate template code for dynamic web pages. They use the object model to deal with data transfer, HTML generation, and Java or JavaScript generation for server scripts. 4GL pages work with sites that use PowerDynamo or JSP.

One of the original reasons for PowerBuilder's popularity was the easy way it provided for creating data aware forms. In PowerBuilder, these are referred to as DataWindows, and while there's much less of an emphasis on pure database development in PowerBuilder, the facilities continue to be improved. In this release, you can choose between eleven types of window, including group, grid, freeform, label, N-up (which displays two or more rows of data next to each other), graph, and crosstab. DataWindows are great to work with.

Once you've chosen a DataWindow type, you then get to choose how the information will be pulled from the database – via a query, a SQL Select, a stored procedure, external data, or a quick select. If you choose the latter, you work through the databases and table in your chosen data source until you've picked the table, columns, selection criteria, sort options – all by pointing and clicking. The query option looks for a query you've already defined, using PowerBuilder's query generator, a cross between query by example and a SQL builder. In addition to creating queries, you can also manipulate databases, and set up data pipelines that take data and send it to another database, optionally carrying out data transformation services on the way.

PowerScript

While you can do a lot of the work in PowerBuilder using the various screen painters, sooner or later you're probably going to have to write code. In PowerBuilder, this means using PowerScript. This is event driven, comes with a good range of pre-built functions, and has an auto-complete facility called AutoScript.

While PowerBuilder lets you edit objects such as applications, windows, menus, DataWindow objects, and user objects in visual painters, the script behind the scenes is always there, and you can switch between the views by choosing the Script tab on the Painter Window. From there you can edit the scripts for events and functions, define and modify user events and functions, declare variables and external functions, and view the scripts for ancestor objects.

The language itself won't scare the horses; here's an example that commits an EASServer transaction:

// Instance variables:
// CORBACurrent corbcurr
integer li_rc
boolean lb_rv
long ll_rc

...

lb_rv = corbcurr.BeginTransaction()
IF lb_rv THEN
	ll_rc = myconnect.CreateInstance(CmpnyAcct)
	// handle error
	li_rc = CmpnyAcct.dopayroll()
	IF li_rc = 1 THEN
		corbcurr.CommitTransaction()
	ELSE
		corbcurr.RollbackTransaction()
	END IF
ELSE
	// handle error
END IF
Keeping track of your code within PowerBuilder is easier in this version. It can be used with external SCC-compliant source control systems (and you're no longer required to register your PowerBuilder objects in a separate work PBL before you can check them into or out external source control systems), or alternatively you can make use of the PowerBuilder native (PBNative) utility.

Conclusion

PowerBuilder is easy to use with a good set of wizards and painters for creating the elements of your applications. The language uses familiar concepts, and the package can be used to produce a wide range of application types. Database handling is strong, and the inclusion of Adaptive Server and the other extras gives you a complete development environment.
  • PowerBuilder Enterprise costs £2,460 (upgrade £1,180), PowerBuilder Professional costs £1,120 (upgrade £480), and the Desktop edition costs £250 per licence (upgrade £110)
  • PowerBuilder 9 is available in the UK from: PC Ware, 08700 500 125, www.pc-ware.co.uk


Kay Ewbank is an experienced database programmer who has followed the development of database technology from dBase through to today's SQL servers.

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“My definition of an expert in any field is a person who knows enough about what's really going on to be scared.” - P. J. Plauger