Jump to content

VisualAge C++: A Panoramic View: Difference between revisions

From EDM2
Created page with "by Dale R. Nilsson VisualAge C++ Version 3.0 has a number of new and improved components over its predecessor, C Set++ Version 2.1. This article will focus on the Visual App..."
 
No edit summary
Line 1: Line 1:
by [[Dale R. Nilsson]]
by [[Jim Williams]]


VisualAge C++ Version 3.0 has a number of new and improved components over its predecessor, C Set++ Version 2.1. This article will focus on the Visual Application Builder, which is a new component of the product and is derived from IBM VisualAge Smalltalk.
VisualAge C++ for OS/2? What happened to C Set ++?!! The name of Version 3 was changed to highlight the arrival of the next generation of C and C++ application development New and very powerful visual programming tools are introduced Many of the tools from C Set ++ have been completely rewritten to make them faster and easier to use The Visual Builder, Data Access Builder, Compiler, Browser, Editor, Debugger, and Performance Analyzer work seamlessly together and are designed to help you through each stage of the development process.


The Visual Builder has complete facilities for graphical user interface (GUI) painting based on the user interface components in the IBM Open Class Library, including new controls such as a Toolbar, Animated button, and FlyOver help (also known as 'bubble' help or 'hover' text). The Visual Builder also has the unique ability to combine visual and nonvisual parts by connecting events, actions, and attributes to construct applications. The Visual Builder can generate the C ++ code for an application, which is then compiled to create executables.  
==To Help You Code...==


==The Visual Builder==
The visual programming tools go beyond the scope of simple GUI builders These tools allow the construction of entire applications from predefined parts with minimal coding required


You use the Visual Builder to create visual parts, nonvisual parts, and applications by combining these parts. Because this is a new component, I have found that most users want to understand the definition and generation technology. In this article I'll briefly cover the C++ parts architecture, and then go through the steps to create a simple nonvisual part. Then I'll use the nonvisual part in a simple application.
===VisualAge C++ Visual Builder--Object-Oriented Visual Application Building===


==C++ Parts Architecture==
With Visual Builder, you can rapidly prototype and build OS/2 applications, with all standard OS/2 controls, such as menu bars and list boxes In addition, the builder lets you use the sophisticated IBM Open Class Library extensions, such as canvasses and graphic push buttons


To implement a 'construction from parts' paradigm similar to IBM 's VisualAge Smalltalk, we added a Notification Framework to the IBM Open Class Library. This framework and how it works is documented in the book Building VisualAge C++ Parts for Fun and Profit (which is one of the books in the VisualAge Extended Reference Manuals set, part number 30H1680). The Notification Framework is based on the same event/action/attribute paradigm used in VisualAge Smalltalk:
You use Visual Builder to connect the graphical user interface to the logic and data of your application, then automatically generate the C++ source code This advanced but easy-to-use, object-oriented visual application development tool goes beyond the scope of a simple GUI builder A powerful visual editor enables you to create complete applications, often without writing code


* Events have a notification identifier and can signal other parts of a change in state using the notifyObservers function. An example in the user interface is the buttonClick event of a push button. Events can trigger actions or attributes.
The builder provides an extensive library of prefabricated parts, and C++ language support for creating new parts As you develop a library of your own unique parts, tailored to the special requirements of your business, even large and complex applications can be created simply by visually arranging and connecting parts


* Actions are public member functions within a class which are triggered by events. For naming consistency, actions should be verbs. Examples include the show action for a window and the add action in a Calc nonvisual part (which we will build later).
Visual Builder helps realize the advantages of object-oriented (OO) programming, the ability to reduce programming time and improve code quality, by making it easy and practical to develop using a library of reusable components


* Attributes are public data within a part that specify a property of the part . Attributes have a notification identifier and can be notified by events or can notify other attributes. Attributes are accessed with a get function and changed with a set function.
===VisualAge C++ Data Access Builder--Build Classes to Access Relational Data===


The Open Class Library has added notification to the classes so they can be used in the Visual Builder. The INotifier class that has been added to the Class Library has two subclasses:
Do your applications need to work with a relational database? Accessing data through C++ classes was once a labor-intensive and error-prone chore The Data Access Builder lets you create new object-oriented database applications more quickly and reliably by generating the source code and embedded SQL for you Add, update, delete, and retrieve methods are generated for each class


* IWindow, which contains the protocols (or behavior) for visual parts, including IControl and IFrameWindow
You can use database parts directly in your programs, or you can import them into the Visual Builder By using Visual Builder to connect them to the GUI, or other parts, you can create high-quality applications quickly Some of the key features of Data Access Builder are


* IStandardNotifier, which provides the protocol for all the nonvisual parts
* Quick or custom mapping The Data Access Builder offers a quick map feature that allows you to do a column-to-attribute mapping By using inheritance, you can customize your classes to suit your needs You can create one class or many classes from any table Both C++ and SOM IDL code are supported


So C++ parts are specialized classes which have the Notification Framework and a part interface.
* Visual display of your mapping The Data Access Builder graphically displays the mapping of your database tables to the object classes This view allows visual editing and uses icons for tables and classes and arrows to show the mappings


[[Image:VAC-Fig-1.gif]]
* Connection and transaction services Separate services are provided for connection and disconnection from your databases In addition, commit and rollback operations are provided to handle transaction services


==Building the Sample Application==
* DB2 family support Access to DB2/2 in a stand-alone environment or access to a remote DB2 through the DB2 Client Application Enabler is supported


To illustrate the technology used to create applications with the Visual Builder, let's develop a simple Calc application and I'll explain what is happening along the way. First we'll build the adder nonvisual part, make the visual Calc part, then combine the two parts using connections, and generate and build the application.
===IBM Open Class Library--A Comprehensive Set of C++ Building Blocks===


==Creating Nonvisual Parts==
The IBM Open Class Library offers you a comprehensive set of classes from basic input/output operations and string handling through abstract data types and user interface support


Nonvisual parts can be built using the Part Interface Editor (PIE) in the Visual Builder. To define a new part (for example, adder), first select New from the Part menu, which brings up a dialog box where you can enter part information . For the Class name enter adder, and for the Part type select Nonvisual part ( this automatically sets the base class for the part to IStandardNotifier). Now press the Open button to open the PIE for the adder part. The PIE is a notebook where you specify the attributes Number1, Number2, and Result. In the Attribute name field, enter Number1. In the Attribute type field, select int from the drop -down list. Use the Add with defaults button to save this attribute. Repeat this process for the Number2 and Result attributes. Go to the Action page and enter the add action; use Add with defaults again. Add with defaults will add the default C++ code for the get and set member functions in the adder part .
Classes in the IBM Open Class Library support consistent programming interfaces across the entire range of platforms supported by VisualAge C++, OS/2, AIX, and Sun Solaris This makes cross-platform porting faster, easier, and less error prone And the VisualAge C++ family is growing We ll soon be starting VisualAge C++ Beta programs for OS/400, MVS, and OS/2 for the PowerPC When recompiling your application for execution on different platforms, you don t need to modify source statements written to use the classes and member functions in the IBM Open Class Library Use the powerful programming abstractions in the IBM Open Class Library rather than the low-level system specific APIs


It is very helpful to put these new items on the preferred list for making connections. Go to the Preferred page and select the add action using mouse button 1, then press mouse button 2 to open the pop-up menu. From the menu select Add >> to put add on the preferred list. (That's good use of your mouse buttons! ) Repeat these steps to add Number1, Number2, and Result to the preferred list .
These classes help build robust, reliable applications, having been tested and used extensively, including in IBM s own products The four parts of the IBM Open Class Library are


To generate the stub code, select Class Editor from the View menu. Enter ADDER.HPV in the User .hpv file field and ADDER.CPV in the User .cpv file field. This specifies the C++ files that will be generated by the Visual Builder that include the attributes we've just added and can be edited by the user . (The Visual Builder always appends to these files.) Then from the File menu , select Save and Generate, then select Part source. This will save the ADDER .VBB part and generate the .CPP and .HPP files. Select Save and Generate and then Feature source.... Select the Generate all button to get the .CPV and .HPV files.
* C++ User Interface Classes, providing a comprehensive set of classes for programming graphical user interfaces on OS/2, AIX, and Windows These classes simplify the coding of GUI applications and result in a more portable, reusable OO user interface IBM Open Class Library gives you a consistent way to write user interface code without having to program to the low-level system APIs The IBM Open Class Library exploits the underlying operating system services for you (for example, the user Presentation Manager services on OS/2)


[[Image:VAC-Fig-2.gif]]
Using the User Interface Classes, you can easily and quickly


Nonvisual parts still require you to code in C++ (yes, the Visual Builder has no facility for reading your mind). You must edit the add member function at the bottom of the ADDER.CPV file and insert the logic to add Number1 and Number2 as a set function of Result:
** Create and display windows using title bars, varying sizes and styles, and more
** Include controls such as menus, buttons, text, list boxes, sliders, notebooks, and containers, with new support for animated push buttons
** Draw canvasses with flexible window layouts that allow automatic redrawing and aligning of cells independent of the display device
** Provide direct manipulation (drag/drop) support
** Add multimedia with classes for constructing many different devices, such as a MIDI sequencer, WAV file playing and editing, digital video players/ recorders, programmable CD players, amplifier and mixer, and the master audio control
** Provide 2-D graphics support for drawing primitives (lines and arcs), plus support for reading and displaying various graphic formats, such as GIF, PIF, and BMP
** Create and manage a tool bar, including being able to move, change, and resize it
** Create parts, using the parts notification framework, for the new Visual Builder
** Communicate between OS/2 applications running on the same machine using dynamic data exchange (DDE)
** Display help, define contextual help, and handle help keys, plus use new fly -over help that comes up automatically when the mouse pointer is on an object
** Cut, copy, and paste to and from the clipboard


Adder& Adder::add()
You can use all of these classes as provided or extend and tailor them, and combine them with the other class libraries to easily develop complete object-oriented applications
{
setResult(iNumber1 + iNumber2); // user added code
return *this;
}


Of course, you can easily include, subtract, multiply, and divide actions . By keeping the logic in a separate part, the Visual Builder promotes good object-oriented design through the separation of model and view objects. You have created a reusable adder part that can be used in a number of applications. This is a different approach to most other application builders, which bury code under UI controls. (Such builders don't allow reuse and create maintenance problems. )
* The Collection Classes, offering a complete set of abstract data types, such as sequences, sets, bags, trees, and so on The classes are designed and implemented for optimum application performance There are several underlying implementations to chose from, each optimized for different requirements array, linked list, hash table, AVL tree, and B*-tree All provide the same programming interface; as you tune the performance of your application, you can select the best underlying implementation for the same data type abstraction, without changing your source code


If you have existing classes that you want to use in the Visual Builder, you must edit the source code of your classes to add the notification. Each attribute and event needs to have a notification ID like the code generated for ADDER .CPV:
* Application Support Classes, providing the basic abstractions needed during the creation of most C++ applications, including String manipulation classes, Date and Time classes, and Error Handling and Trace classes


// Feature source code generation begins here...
* Standard Class Libraries, consisting of the de facto standard I/O Stream library for C++ input and output, and the Complex library for manipulating complex ( imaginary) numbers
INotificationId adder::Number1Id = 'adder::number1';
INotificationId adder::Number2Id = 'adder::number2';
INotificationId adder::ResultId = 'adder::result';


Then you need to add a notifyObservers statement after attributes are set, as seen by the code generated by the adder part for the Number1 attribute:
===VisualAge C++ Browser--Fast, Easy Access to Program Information===


adder& adder::setNumber1(int aNumber1)
The introduction of the OO paradigm in C++ has resulted in a marked shift in programming techniques and requirements If you are a C programmer, you deal with large collections of modules, data types, or functions As a C++ programmer you now must deal with large and sometimes complex collections of interrelated classes in class libraries The Browser helps you understand and use these class libraries with the following features
{
if (](iNumber1 == aNumber1))
{
iNumber1 = aNumber1;
notifyObservers(INotificationEvent(adder::Number1Id, *this));
} // endif
return *this;
}


You must also add enableNotification so the messages get sent. Then make an import file using the .VBE file format (which is also documented in Building VisualAge C++ Parts for Fun and Profit). To see a sample .VBE file, select Export interface from the Part menu on the main Visual Builder dialog. The generated code from this sample will help you see what is needed to add notification to your own classes. You can also use your existing C++ classes and C .DLLs as nonvisual parts.
* Graphically displaying the subtle nuances of C++ inheritance, including the complexities of multiple inheritance


==Making the Visual Part==
* Presenting complex C++ programs and class libraries quickly, in an accurate, easily understood graphical format Other class browsers might be equally fast, but require you to recognize and filter invalid data


Now create a Calc visual part that is derived from IFrameWindow. First select New from the part menu and enter Calc for the Class name. When you select Open, the Visual Builder will bring you into the Composition Editor, where you can combine the visual parts with the nonvisual parts. Add an entry field by selecting the IEntryField control from the Data entry category and dragging it to the Calc part canvas. Repeat this step for two more entry fields. Then use the IStaticText control to make three labels over the entry fields. Edit the labels to say Number1, Number2, and Result. From the Frame Extensions category add an IToolBar control by dropping it on the frame window title. You can edit the window title by pressing the Alt key and mouse button 1; then enter Calc Sample. You can do some sizing or aligning as desired, but it is not critical for this sample. Each of the parts has a Settings notebook that is activated by double-clicking on that part. In the Settings notebook you can change all the attributes of a part, such as its part name and label. For this simple sample we will use the defaults. In a 'real' calculator you would add a numeric-only handler to each of the entry fields (this is done on the Handler page of the Settings notebook).
* Browsing C++ source code without needing to compile first, using the built- in QuickBrowse feature Other browsers require you to be able to either compile or even link your program or library before you can browse its contents


Bring the adder nonvisual part to the Composition Editor by selecting Add part from the Options menu. Specify adder* as the part class (remember--it is case sensitive) and give it a name like 'adder' for easier reference. The asterisk (*) is required in the class name because the adder class does not have a copy constructor and must be called by reference. This is a good design because there is a lot of overhead associated with copying classes at run time.
===VisualAge Editor--A Powerful, Language-Sensitive Editor===


==Making Connections==
A new and impressive editor has been integrated into VisualAge C++ s suite of tools This editor is fast, simple to use, powerful, helpful, and easily modified to meet your personal preferences


First we will connect the attributes. Move the mouse pointer over the first entry field and press Alt+mouse button 2. When the pop-up menu appears, select valueAsInt and point the mouse at the adder icon; press mouse button 1 to make the connection. Point to Number1 in the preferred connections list and press mouse button 1 to make the connection (shown in the Composition Editor as light gray or cyan when online). This connects the valueAsInt attribute of the entry field to the Number1 attribute of the adder part (valueAsInt is required because the Number1 attribute is type int). Do the same for the second entry field (the Number2 attribute). Now point at the adder icon and press Alt+mouse button 2. Select More , which brings up the connection dialog. Select Result from the attribute list and point to the Result entry field; press mouse button 1 to make the connection. This is necessary because there is an implied source and target for the attribute-to-attribute connections since the connections are bi-directional (indicated by the filled-in and hollow arrows).
You can compile, browse, make, build, debug, or issue other VisualAge C++ commands without leaving the editor It performs all the common editing tasks such as insert, delete, split and join lines, find, block and manipulate text, undo changes, create and find marks, and move between different source file views However, it does much more to make programming simple and error free


Now connect the buttonClickEvent of the Toolbar button to the add action in the adder nonvisual part. At run time, when the Toolbar button is clicked, the event will notify the adder part to invoke the add action (member function). This makes an event-to-event connection, shown in dark gray or green when online.
* It is language sensitive, with highlighting in different fonts and colors for different types of language constructs It provides automatic indenting and dynamically performs simple lexical error checking You can check your work by quickly navigating through each error without having to compile or leave the editor


[[Image:VAC-Fig-3.gif]]
* It presents several views of the source that help you review and understand the code For example, display only function headers in the file to quickly see what is in the file and locate a function of interest You can also display the program s flow of control or insert programming templates


There are many far more complex connections (such as passing parameters to connections) that are similar to attribute-to-attribute connections but are unidirectional and are shown in purple. Also, for each connection, exception handling is incorporated in the generated code. This makes it possible for you to connect the exceptionOccurred event to a message box showException action, which is a good built-in mechanism for error detection. For example, in a 'real' calculator you would want to 'throw' an exception when a divide-by-zero operation is attempted. You would then 'catch' the exception as described above.
* It is fully customizable


==Code Generation==
* It can record a sequence of keyboard events as an LPEX REXX command and that can be modified to be reused as an external command


Now we need some C++ code, so select the Generate button, which will save the Calc part as CALC.VBB in your working directory. Then the Visual Builder generates the following:
==To Help You Generate Fast Applications...==


*CALC.HPP with the declarations
===C/C++ OS/2 Compiler--Generate Highly Optimized 32-Bit Code===
*CALC.CPP with the definitions
*CALC.RCI with externalized resource text (in order to externalize all text you must go to the class editor for the part and specify a starting resource ID)
*CALC.H for the resource file


Because this is the entry point for our application, we need to generate a C+ + main(). From the file pull-down, select Generate main to generate CALC. APP, CALC.RC, and CALC.MAK (if you have Generate makefile checked in your options). If you started via Workframe, you will need to select MakeMake from the Project menu to generate a makefile. You then compile and run the application from Workframe (select Build from the Project menu), or from a command prompt, as follows :
Applications that perform well require tools that generate highly optimized code and make efficient use of disk and memory space The VisualAge C++ compiler and linker represent state-of-the-art technology; the applications you write will be fast and won t hog your system resource Code can be optimized for any Intel architecture processor from the 386 to the Pentium


[D:\ibmcpp\working] nmake calc.mak >error.dat
Performance of applications is always important, but you don t want to be kept waiting because of a slow development environment VisualAge C++ s compiler and linker are fast and highly usable In this release, compile time performance has been improved, especially with the use of precompiled headers Also, our new 32-bit ILINK linker with automatic template resolution (without prelinking) provides major improvements in link time, while removing many of the limitations of our earlier linker You can expect link times up to two times faster than with earlier linkers


==Running the Calc Sample==
Memory leaks are a common problem in C and C++ programming, and one of the most difficult problems to diagnose We ve extensively enhanced our memory debugging support to help you find those persistent problems VisualAge C++ for OS/2, Version 3 also includes support for user heaps to give users even more flexibility in implementing their applications


When you run the application it will look like this:
===Direct-To-SOM (DTS)===


[[Image:VAC-Fig-4.gif]]
Direct-to-SOM (DTS) is an exciting new technology that combines familiar and powerful standard C++ syntax with the robustness and portability of IBM s System Object Model (SOM) DTS is not a tool but a standard for implementing flexible and reusable objects, supported by the tools of VisualAge C++


You can enter integers in the first two entry fields, then press the button on the toolbar and the result will appear. All this is the result of writing only one line of C++ code! The application is a positionable, sizable Presentation Manager (PM) window with minimize and maximize capabilities and a system menu. The toolbar can be made to float by dragging it off the frame window, and it can be repositioned to the sides or the bottom of the frame window by dragging and dropping it. This is a simple application, but it shows all the basic steps required to go from design to implementation.
To build a SOM object, it was once necessary to go through the time consuming process of writing IDL (Interface Definition Language), then generating C++ bindings with the SOM compiler, then compiling C++ files with a C++ compiler Now you can generate SOM objects directly from the C++ compiler, simply by turning on a compiler option And the compiler will also generate the corresponding IDL for use in interlanguage or DSOM applications The VisualAge C++ Browser shows SOM objects in a different color than C++ objects The Data Access Builder has options which generate SOM classes (or IDL code) Best of all, the VisualAge C++ Debugger now lets you debug SOM objects as easily as regular C++


==Summary==
DTS has several advantages over native C++ programs including
 
* Release to Release Binary Compatibility ( RRBC) breaks the tight dependency between the code that implements a class and the client code that uses it
 
* Extensive dynamic facilities allow a degree of flexibility and configurability familiar to programmers using Smalltalk or the OS/2 Workplace Shell
 
* Distributed SOM (DSOM) allows access to objects between processes, or even across networks
 
If you are an experienced SOM user, who programmed SOM from C or non-DTS C++, you will welcome the power and flexibility that DTS provides And, because you write C++ directly, you can use C++ features in your SOM classes that weren t available before DTS (features such as templates, operators, constructors with parameters , default parameters, static members, and more)
 
===VisualAge Performance Execution Trace Analyzer--Time and Tune Your Code===
 
This tool enables you to time and tune your applications, analyze program hangs and deadlocks, view multithread interactions, and better understand your code It gives you a view of your program s runtime behavior that you just can t get through debuggers or browsers By collecting execution trace data and presenting it in several graphical diagrams, the Performance Analyzer can provide information on
 
* Timing and tuning The trace file contains a detailed record of function calls and returns Performance Analyzer can display the trace in a chronologically-scaled format This helps you find the hot spots in the code and the cause of those hot spots
 
* Program hangs and deadlocks Performance Analyzer provides a complete history of the events leading up to the point the program stopped You can view the function call stack any place in the application
 
* Multithread interactions You can look at the sequencing of procedures across threads, which can make problems with critical sections visible
 
==To Help You Test and Debug...==
 
===VisualAge Debugger--Find and Fix Coding Errors Fast===
 
Your ability to develop robust OS/2 software quickly and efficiently is directly related to how fast you can find and fix coding errors The VisualAge Debugger is your primary tool for this process
 
Efficiency comes from debugging at the source level, which means that you can look at your code exactly as you wrote it Efficiency also comes from an optimized user interface that provides access to all the common debugger functions with a single mouse click--these include step, run, set/reset breakpoints, monitor variables, display call stack, display registers, and display storage
 
In addition to all the functions commonly expected in a state-of-the-art debugger, the VisualAge Debugger also provides an array of unique built-in tools to help locate problems and fix code quickly
 
* The Window Analysis tool displays a three-dimensional view of all the windows your program creates, including the window characteristics and relationships


The Visual Builder is a powerful application development tool that has complete GUI definition and uses the unique 'construction from parts' method . This method provides a visual metaphor to connect visual and nonvisual parts using the event/action/attribute paradigm. You still need to perform object- oriented (OO) analysis and design for applications because the Visual Builder does not prevent you from making implementation errors. But the Visual Builder makes it a lot easier and faster to create C++ based OO applications and lets you focus on the domain-specific coding required for the nonvisual parts.
* The Message Queue Monitor actively monitors Presentation Manager messages


==Good part design==
* C++ debugging features include template support, locate overloaded functions , class display, and debugging code in include files


Most well-designed, general purpose parts require parameters. Here's a tip to remember when implementing these parts: You should supply as many default parameters for your classes as possible. Each parameter without a default will require a connection to complete the part definition. This can make the part diagram a bit cluttered and create a lot of unnecessary overhead for these trivial connections.
* Automatic heap checking helps to isolate memory management problems by checking for memory overwriting each time your program stops executing


==MultiCellCanvas==
The Debugger also recognizes 16-bit CodeView debug information This means you can debug all the pieces of your product with one debugger--both 16-bit and 32-bit It is also the only OS/2 debugger fully capable of debugging multithread Presentation Manager applications Naturally, being fully integrated with the rest of the tools of VisualAge C++, you can edit, browse, or recompile your code, directly from your debugger session


When you make a new visual part that is derived from IFrameWindow, the part has an ICanvas placed inside as a client of the window frame. In most cases, you should remove the default canvas and use MultiCellCanvas, which allows controls to expand as the window is stretched at run time. You must designate which columns and/or rows will be expandable within the Settings notebook of MultiCellCanvas . You can use the Apply button to test setting changes while the Settings notebook is open. This lets you see when you make the correct expanding columns or rows, and prevents expanding buttons or fixed-length fields that expand.  
==To Help You When You Need Help...==


Now, all VisualAge C++ manuals are online, with a powerful look-up tool to guide you to what you want to know The Help menu of each tool includes access to all of VisualAge C++ s manuals in addition to the help for the tool itself


==Summary==


This article has provided a panoramic tour of the entire VisualAge C++ for OS /2, Version 3 development environment Currently in Beta testing, the production version will be shipping very soon In future issues of The Developer Connection News, we ll be examining other VisualAge C++ programming topics


'''Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation'''


[[Category:Tools Articles]]
[[Category:Tools Articles]]

Revision as of 23:54, 3 September 2013

by Jim Williams

VisualAge C++ for OS/2? What happened to C Set ++?!! The name of Version 3 was changed to highlight the arrival of the next generation of C and C++ application development New and very powerful visual programming tools are introduced Many of the tools from C Set ++ have been completely rewritten to make them faster and easier to use The Visual Builder, Data Access Builder, Compiler, Browser, Editor, Debugger, and Performance Analyzer work seamlessly together and are designed to help you through each stage of the development process.

To Help You Code...

The visual programming tools go beyond the scope of simple GUI builders These tools allow the construction of entire applications from predefined parts with minimal coding required

VisualAge C++ Visual Builder--Object-Oriented Visual Application Building

With Visual Builder, you can rapidly prototype and build OS/2 applications, with all standard OS/2 controls, such as menu bars and list boxes In addition, the builder lets you use the sophisticated IBM Open Class Library extensions, such as canvasses and graphic push buttons

You use Visual Builder to connect the graphical user interface to the logic and data of your application, then automatically generate the C++ source code This advanced but easy-to-use, object-oriented visual application development tool goes beyond the scope of a simple GUI builder A powerful visual editor enables you to create complete applications, often without writing code

The builder provides an extensive library of prefabricated parts, and C++ language support for creating new parts As you develop a library of your own unique parts, tailored to the special requirements of your business, even large and complex applications can be created simply by visually arranging and connecting parts

Visual Builder helps realize the advantages of object-oriented (OO) programming, the ability to reduce programming time and improve code quality, by making it easy and practical to develop using a library of reusable components

VisualAge C++ Data Access Builder--Build Classes to Access Relational Data

Do your applications need to work with a relational database? Accessing data through C++ classes was once a labor-intensive and error-prone chore The Data Access Builder lets you create new object-oriented database applications more quickly and reliably by generating the source code and embedded SQL for you Add, update, delete, and retrieve methods are generated for each class

You can use database parts directly in your programs, or you can import them into the Visual Builder By using Visual Builder to connect them to the GUI, or other parts, you can create high-quality applications quickly Some of the key features of Data Access Builder are

  • Quick or custom mapping The Data Access Builder offers a quick map feature that allows you to do a column-to-attribute mapping By using inheritance, you can customize your classes to suit your needs You can create one class or many classes from any table Both C++ and SOM IDL code are supported
  • Visual display of your mapping The Data Access Builder graphically displays the mapping of your database tables to the object classes This view allows visual editing and uses icons for tables and classes and arrows to show the mappings
  • Connection and transaction services Separate services are provided for connection and disconnection from your databases In addition, commit and rollback operations are provided to handle transaction services
  • DB2 family support Access to DB2/2 in a stand-alone environment or access to a remote DB2 through the DB2 Client Application Enabler is supported

IBM Open Class Library--A Comprehensive Set of C++ Building Blocks

The IBM Open Class Library offers you a comprehensive set of classes from basic input/output operations and string handling through abstract data types and user interface support

Classes in the IBM Open Class Library support consistent programming interfaces across the entire range of platforms supported by VisualAge C++, OS/2, AIX, and Sun Solaris This makes cross-platform porting faster, easier, and less error prone And the VisualAge C++ family is growing We ll soon be starting VisualAge C++ Beta programs for OS/400, MVS, and OS/2 for the PowerPC When recompiling your application for execution on different platforms, you don t need to modify source statements written to use the classes and member functions in the IBM Open Class Library Use the powerful programming abstractions in the IBM Open Class Library rather than the low-level system specific APIs

These classes help build robust, reliable applications, having been tested and used extensively, including in IBM s own products The four parts of the IBM Open Class Library are

  • C++ User Interface Classes, providing a comprehensive set of classes for programming graphical user interfaces on OS/2, AIX, and Windows These classes simplify the coding of GUI applications and result in a more portable, reusable OO user interface IBM Open Class Library gives you a consistent way to write user interface code without having to program to the low-level system APIs The IBM Open Class Library exploits the underlying operating system services for you (for example, the user Presentation Manager services on OS/2)

Using the User Interface Classes, you can easily and quickly

    • Create and display windows using title bars, varying sizes and styles, and more
    • Include controls such as menus, buttons, text, list boxes, sliders, notebooks, and containers, with new support for animated push buttons
    • Draw canvasses with flexible window layouts that allow automatic redrawing and aligning of cells independent of the display device
    • Provide direct manipulation (drag/drop) support
    • Add multimedia with classes for constructing many different devices, such as a MIDI sequencer, WAV file playing and editing, digital video players/ recorders, programmable CD players, amplifier and mixer, and the master audio control
    • Provide 2-D graphics support for drawing primitives (lines and arcs), plus support for reading and displaying various graphic formats, such as GIF, PIF, and BMP
    • Create and manage a tool bar, including being able to move, change, and resize it
    • Create parts, using the parts notification framework, for the new Visual Builder
    • Communicate between OS/2 applications running on the same machine using dynamic data exchange (DDE)
    • Display help, define contextual help, and handle help keys, plus use new fly -over help that comes up automatically when the mouse pointer is on an object
    • Cut, copy, and paste to and from the clipboard

You can use all of these classes as provided or extend and tailor them, and combine them with the other class libraries to easily develop complete object-oriented applications

  • The Collection Classes, offering a complete set of abstract data types, such as sequences, sets, bags, trees, and so on The classes are designed and implemented for optimum application performance There are several underlying implementations to chose from, each optimized for different requirements array, linked list, hash table, AVL tree, and B*-tree All provide the same programming interface; as you tune the performance of your application, you can select the best underlying implementation for the same data type abstraction, without changing your source code
  • Application Support Classes, providing the basic abstractions needed during the creation of most C++ applications, including String manipulation classes, Date and Time classes, and Error Handling and Trace classes
  • Standard Class Libraries, consisting of the de facto standard I/O Stream library for C++ input and output, and the Complex library for manipulating complex ( imaginary) numbers

VisualAge C++ Browser--Fast, Easy Access to Program Information

The introduction of the OO paradigm in C++ has resulted in a marked shift in programming techniques and requirements If you are a C programmer, you deal with large collections of modules, data types, or functions As a C++ programmer you now must deal with large and sometimes complex collections of interrelated classes in class libraries The Browser helps you understand and use these class libraries with the following features

  • Graphically displaying the subtle nuances of C++ inheritance, including the complexities of multiple inheritance
  • Presenting complex C++ programs and class libraries quickly, in an accurate, easily understood graphical format Other class browsers might be equally fast, but require you to recognize and filter invalid data
  • Browsing C++ source code without needing to compile first, using the built- in QuickBrowse feature Other browsers require you to be able to either compile or even link your program or library before you can browse its contents

VisualAge Editor--A Powerful, Language-Sensitive Editor

A new and impressive editor has been integrated into VisualAge C++ s suite of tools This editor is fast, simple to use, powerful, helpful, and easily modified to meet your personal preferences

You can compile, browse, make, build, debug, or issue other VisualAge C++ commands without leaving the editor It performs all the common editing tasks such as insert, delete, split and join lines, find, block and manipulate text, undo changes, create and find marks, and move between different source file views However, it does much more to make programming simple and error free

  • It is language sensitive, with highlighting in different fonts and colors for different types of language constructs It provides automatic indenting and dynamically performs simple lexical error checking You can check your work by quickly navigating through each error without having to compile or leave the editor
  • It presents several views of the source that help you review and understand the code For example, display only function headers in the file to quickly see what is in the file and locate a function of interest You can also display the program s flow of control or insert programming templates
  • It is fully customizable
  • It can record a sequence of keyboard events as an LPEX REXX command and that can be modified to be reused as an external command

To Help You Generate Fast Applications...

C/C++ OS/2 Compiler--Generate Highly Optimized 32-Bit Code

Applications that perform well require tools that generate highly optimized code and make efficient use of disk and memory space The VisualAge C++ compiler and linker represent state-of-the-art technology; the applications you write will be fast and won t hog your system resource Code can be optimized for any Intel architecture processor from the 386 to the Pentium

Performance of applications is always important, but you don t want to be kept waiting because of a slow development environment VisualAge C++ s compiler and linker are fast and highly usable In this release, compile time performance has been improved, especially with the use of precompiled headers Also, our new 32-bit ILINK linker with automatic template resolution (without prelinking) provides major improvements in link time, while removing many of the limitations of our earlier linker You can expect link times up to two times faster than with earlier linkers

Memory leaks are a common problem in C and C++ programming, and one of the most difficult problems to diagnose We ve extensively enhanced our memory debugging support to help you find those persistent problems VisualAge C++ for OS/2, Version 3 also includes support for user heaps to give users even more flexibility in implementing their applications

Direct-To-SOM (DTS)

Direct-to-SOM (DTS) is an exciting new technology that combines familiar and powerful standard C++ syntax with the robustness and portability of IBM s System Object Model (SOM) DTS is not a tool but a standard for implementing flexible and reusable objects, supported by the tools of VisualAge C++

To build a SOM object, it was once necessary to go through the time consuming process of writing IDL (Interface Definition Language), then generating C++ bindings with the SOM compiler, then compiling C++ files with a C++ compiler Now you can generate SOM objects directly from the C++ compiler, simply by turning on a compiler option And the compiler will also generate the corresponding IDL for use in interlanguage or DSOM applications The VisualAge C++ Browser shows SOM objects in a different color than C++ objects The Data Access Builder has options which generate SOM classes (or IDL code) Best of all, the VisualAge C++ Debugger now lets you debug SOM objects as easily as regular C++

DTS has several advantages over native C++ programs including

  • Release to Release Binary Compatibility ( RRBC) breaks the tight dependency between the code that implements a class and the client code that uses it
  • Extensive dynamic facilities allow a degree of flexibility and configurability familiar to programmers using Smalltalk or the OS/2 Workplace Shell
  • Distributed SOM (DSOM) allows access to objects between processes, or even across networks

If you are an experienced SOM user, who programmed SOM from C or non-DTS C++, you will welcome the power and flexibility that DTS provides And, because you write C++ directly, you can use C++ features in your SOM classes that weren t available before DTS (features such as templates, operators, constructors with parameters , default parameters, static members, and more)

VisualAge Performance Execution Trace Analyzer--Time and Tune Your Code

This tool enables you to time and tune your applications, analyze program hangs and deadlocks, view multithread interactions, and better understand your code It gives you a view of your program s runtime behavior that you just can t get through debuggers or browsers By collecting execution trace data and presenting it in several graphical diagrams, the Performance Analyzer can provide information on

  • Timing and tuning The trace file contains a detailed record of function calls and returns Performance Analyzer can display the trace in a chronologically-scaled format This helps you find the hot spots in the code and the cause of those hot spots
  • Program hangs and deadlocks Performance Analyzer provides a complete history of the events leading up to the point the program stopped You can view the function call stack any place in the application
  • Multithread interactions You can look at the sequencing of procedures across threads, which can make problems with critical sections visible

To Help You Test and Debug...

VisualAge Debugger--Find and Fix Coding Errors Fast

Your ability to develop robust OS/2 software quickly and efficiently is directly related to how fast you can find and fix coding errors The VisualAge Debugger is your primary tool for this process

Efficiency comes from debugging at the source level, which means that you can look at your code exactly as you wrote it Efficiency also comes from an optimized user interface that provides access to all the common debugger functions with a single mouse click--these include step, run, set/reset breakpoints, monitor variables, display call stack, display registers, and display storage

In addition to all the functions commonly expected in a state-of-the-art debugger, the VisualAge Debugger also provides an array of unique built-in tools to help locate problems and fix code quickly

  • The Window Analysis tool displays a three-dimensional view of all the windows your program creates, including the window characteristics and relationships
  • The Message Queue Monitor actively monitors Presentation Manager messages
  • C++ debugging features include template support, locate overloaded functions , class display, and debugging code in include files
  • Automatic heap checking helps to isolate memory management problems by checking for memory overwriting each time your program stops executing

The Debugger also recognizes 16-bit CodeView debug information This means you can debug all the pieces of your product with one debugger--both 16-bit and 32-bit It is also the only OS/2 debugger fully capable of debugging multithread Presentation Manager applications Naturally, being fully integrated with the rest of the tools of VisualAge C++, you can edit, browse, or recompile your code, directly from your debugger session

To Help You When You Need Help...

Now, all VisualAge C++ manuals are online, with a powerful look-up tool to guide you to what you want to know The Help menu of each tool includes access to all of VisualAge C++ s manuals in addition to the help for the tool itself

Summary

This article has provided a panoramic tour of the entire VisualAge C++ for OS /2, Version 3 development environment Currently in Beta testing, the production version will be shipping very soon In future issues of The Developer Connection News, we ll be examining other VisualAge C++ programming topics