VisualAge C++: A Panoramic View
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.
- 1 To Help You Code...
- 1.1 VisualAge C++ Visual Builder - Object-Oriented Visual Application Building
- 1.2 VisualAge C++ Data Access Builder - Build Classes to Access Relational Data
- 1.3 IBM Open Class Library - A Comprehensive Set of C++ Building Blocks
- 1.4 VisualAge C++ Browser - Fast, Easy Access to Program Information
- 1.5 VisualAge Editor--A Powerful, Language-Sensitive Editor
- 2 To Help You Generate Fast Applications...
- 3 To Help You Test and Debug...
- 4 To Help You When You Need Help...
- 5 Summary
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) 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.
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.