DBMS

C++ Tools For Client/Server Development

By David S. Linthicum
DBMS, August 1996

A Survey of C++ Tools and Add-On Products for Client/Server Application Development.


As time goes on, C++ and client/server development seem to move farther apart. Specialized 4GL client/server tools that support sexy RAD-driven development have taken the limelight. Still, C++ development tools hold their own, cranking out bulletproof, speedy client/server applications by the thousands. In the hands of skilled developers, application development with C++ is fast. C++ also reuses as much code as possible and supports snap-in application frameworks that let developers take advantage of OPC (other people's code). The popularity of the C++-like Java language resulted in renewed interest in C++. Java is now a part of a few C++ development environments including Borland's C++ Developers Suite 5.0. Other companies are releasing Java-only development tools based on their C++ development products such as Symantec's Cafe. (For more information on this, see my column in this issue.)

Today's C++ tools are better than ever. They provide advanced client/server features including built-in database connectivity, real object-oriented development, and integration with advanced service layers such as OLE automation, Distributed Common Object Model, and Object Request Brokers. The latest batch of C++ development tools, including Borland C++ Developer's Suite from Borland International, Visual C++ from Microsoft, Symantec C++ from Symantec Corp., and Watcom C++ from Powersoft, are feature-rich and object-heavy. Let's look at a selection of C++ development tools and add-on products that address client/server application construction.

Tradeoffs

Although C++ offers an advanced development environment, there are tradeoffs when using it for client/server development. C++ is a hybrid language, which means there is support for both object-oriented and structured features. Developers can thus mix and match both object-oriented and procedural code in the same system. This is an advantage for those of you who want to upgrade legacy systems incrementally (such as moving from C to C++), but it can undermine the advantages of the pure object-oriented development model (such as reuse).

C++ applications are compiled and thus able to run much faster than other client/server applications that use an interpreter. However, C++ is also a complex language that takes some time to learn and can be dangerous if not used properly. For instance, C++ developers can quickly crash an operating system if pointers are not used correctly.

Fortunately, the problems with C++ development are not as prevalent as they were just a few years ago. Today the development and debugging environments are built to guard against potential application downfalls such as memory leaks, file corruption, and unreachable code that never executes. Moreover, database connectivity is now encapsulated into the C++ development environment, which allows developers to work directly with live data just as they do in the world of RAD.

Libraries and Frameworks and Objects, Oh My!

C++ gets praise for its ability to incorporate native, application-specific, and third-party libraries into the development environment. This means that developers can extend the power of the C++ tool to meet the exact requirements of the application. This includes native GUI controls, database access, external messaging APIs, the Internet, and application-related classes. (See Figure 1.) In many respects, C++ development tools are only as good as the libraries they can use.

For example, the days of embedding your own GUI APIs (that is, Win16 and Win32) directly into your C/C++ code are gone. Today you can use a class library such as Microsoft Foundation Classes (MFC) to provide the GUI controls and components to your applications through the object-oriented feature of inheritance. Developers simply link the application to the proper GUI libraries, the act of which automatically incorporates them into the application. The advantage of this is twofold: You do not have to write the controls with a low-level API, and you do not have to worry about upgrading the controls as GUIs change. The migration from the 16-bit Windows 3.11 to the 32-bit Windows 95 or Windows NT environment is simply a matter of swapping out your native GUI library, including support for threading.

Using the same GUI control libraries concept, several C++ libraries provide multiplatform capabilities. These libraries keep the operating system and GUI-specific features in their own set of libraries, which lets developers create applications through a high-level API. Using this architecture, developers port applications without modification to other platforms simply by switching the native operating system and GUI-related libraries.

The handy library concept is not limited to low-level GUI-related controls, however. You can also integrate application-specific libraries such as financial functions, inventory control, and accounting functions. You can purchase these libraries from third-party C++ library vendors or build them in-house and share them among organizational applications. This reuse mechanism saves hundreds of hours of development. You create an application using as much existing code as possible. By default, this helps enforce organizational standards such as common look-and-feel and business rules.

C++ Development Environments

There are numerous C++ compilers out there for all types of operating systems and GUIs. For client/server development there are four significant products: Borland C++ Development Suite, Microsoft Visual C++, Symantec C++, and Watcom C++. Let's look at Borland's and Microsoft's products.

The Borland C++ Development Suite (see Figure 2) gives C++ developers the ability to create both 16-bit Windows 3.1 and 32-bit Windows 95 applications, with added support for Java application development. Borland C++ supports OCX integration and OLE automation and can interface with MFC. Borland C++ provides advanced features such as AppExpert (which lets you build applications quickly), support for multithreading, and support for visual database application development.

At the heart of Borland C++ is its GUI control library: ObjectWindows Library (OWL). OWL contains all of the common Windows 3.1 and Windows 95 controls you need to create Windows applications. You simply link your application hierarchy to OWL using whatever GUI control classes you need to create the application. For example, if an application requires a file dialog, you need only reuse the file dialog included with OWL. You can take the file dialog as is or modify it to meet the requirements of the application. The same concept applies to data windows, list boxes, menus, or other GUI controls. OWL also includes many new Windows APIs such as WinSock, MAPI (Mail Application Programming Interface), and WinG (a graphics acceleration program for Windows). OWL supports both Win16 and Win32 development, including Win16 emulation for almost all Win32-based common controls.

In addition to OWL, Borland C++ supports MFC compilation native to Microsoft Visual C++. This lets you use MFC with the Borland compiler. MFC is functionally the same as OWL. Borland C++ Developer's Suite also includes a 32-bit integrated graphical debugger that lets you set breakpoints, examine variables, or examine the CPU. You can also view the low-level assembly code and debug multithreaded applications. Borland C++ has integrated Win32 resource editors, as well as bitmaps, icons, menus, cursors, and dialog editors. Borland C++ also supports VBX and OLE controls (OCXs) in both Win16 and Win32 applications. Borland supports standards as well, including the ANSI/ISO C++ language specification and C++ templates.

Borland C++ is one of the first C++ development environments to provide integrated Java language support using Sun's Java Development Kit (JDK). Using the Java tools, developers can create Java applets that are ready to run in Java-enabled browsers. Borland C++ also provides a graphical Java language debugger and the ability to generate generic Java applications using AppExpert.

Microsoft's Visual C++, like Borland C++, provides an easy-to-use, integrated C++ development environment that includes everything you need to create Windows 3.11 and Windows 95 client/server applications. (See Figure 3.) With the use of many Custom AppWizards, there is no need to write C++ applications from scratch. AppWizards (similar to Borland's AppExpert) provide "boilerplate" applications to help create target applications, including MFC applications, dynamic-link libraries (DLLs), OLE controls, and OLE automation servers.

In addition, Visual C++ provides a database of reusable application components known as the component gallery. These components can be C++ classes, OCX controls, or OLE automation servers. The component gallery is like a convenience store - you can browse through all the components available on your system. Some of the components come with Visual C++, and others may come from third parties. You can drop them directly into the Visual C++ applications.

Like Borland C++'s OWL, MFC is the heart of Visual C++ and provides all of the Win16 and Win32 control that you need to build Windows applications. You may also extend the MFC, adding custom common objects for integration inside Visual C++ applications. MFC Extension is a DLL that lets you add capabilities not originally in MFC by deriving new custom classes from existing MFC classes. MFC also supports OLE, WinSock, MAPI, and access to databases using Data Access Objects (DAOs). Like Borland C++, Microsoft Visual C++ is ANSI/ISO compliant and supports C++ templates.

RAD and C++ Converging

Beyond the traditional C++ development environments (such as Borland C++ Developer's Suite and Microsoft's Visual C++), there are new tools that attempt to take C++ closer to RAD by tightly integrating visual development and C++. These tools include Optima++ Developer from Powersoft, Protogen+ Client/Server Suite from ProtoView Development Corp., Visual SQL from Blue Sky Software, the Elements Environment from Neuron Data, and VisualAge C++ from IBM.

Optima++ has a component-centric architecture that uses OLE. Optima lets you assemble applications from prebuilt OCX controls, OLE automation servers, and native components built with an integrated C++ compiler. Optima++ can also leverage the Internet by using application development wizards to build Java applets rapidly. In addition, you can use Optima++ to build Web server-side applications.

Optima++ works directly with Power-Builder, sharing DataWindows, OLE components, and PowerBuilder reports. Optima++ links to databases through data-aware bound controls as well as DataWindows. By exploiting the capabilities of Watcom C/C++'s advanced optimizing compiler, Optima++ generates native executables or DLLs for both Windows 3.11 and Windows 95 applications.

Protogen+ Client/Server Suite takes a different approach to C++ development. Rather than provide the developer with an IDE and a compiler, Protogen+ Client/Server Suite generates the ANSI C code for submission to a compiler. Using Client/Server Suite, you can create and connect several components to form a 16-bit or 32-bit application, as well as generate the C code. Protogen+'s RAD capabilities let you create the application visually, defining the characteristics of the application without coding. You can take the application as generated or make changes to the code to meet the particular needs of the application. Workbench leaves the custom code alone in future code regenerations and provides database connectivity for its applications as well.

Visual SQL can extend the client/server development and database query capabilities of Visual C++ by using several new wizards that can generate MFC code for use in client/server Visual C++ applications. Like Visual C++, Visual SQL uses ODBC to make its database connections, and the Visual SQL design environment is integrated with Visual C++ using Microsoft's Developer Studio.

Both VisualAge C++ and the Elements Environment mix RAD and C++ development by providing a visual means by which to create the application and the ability to define the behavior of the application using C++ code. The lack of a true 4GL for RAD does surprise a few client/server developers. However, both of these tools are a natural evolution of C++ development tools that want to hold on to a quickly changing market. These development environments are the next-generation tools for today's C++ developers.

C++ Meets Database Servers

All of these neat features for building applications won't do you any good if you can't access the data. There are two ways to access database servers from C++ development tools: Use native database libraries that come with the tools, or use third-party database libraries that integrate with your particular tool. Borland C++, for instance, provides a native subsystem called Visual Database Tools (VDBT), which grants database access capabilities directly from Borland C++ applications. VDBT is built on top of the Borland Database Engine (BDE). BDE is shared across Borland development tools, including Paradox for Windows, Delphi, and dBASE for Windows, and it can connect to database files and remote database servers such as Sybase, Interbase, SQL Server, Oracle, Informix, or databases using ODBC. You can create database applications without code simply by dragging visual database components to forms. VDBT lets you view live data as you build the application. This is far better than making cryptic API calls, relying on schema printouts to understand the database, or knowing the nuts and bolts of how to bring the data into the application environment.

VDBT provides database access functionality inside COM (Component Object Model) objects. Using this architecture, you can access data in one of three ways. First, Borland C++ can encapsulate the BDE API. You access the database through standard database-enabled API calls. Second, using the COM wrapper, you can use the OLE interface to access the capabilities of the BDE. OLE resides between the application and the database. Finally, you can use an OLE automation server to control the BDE. The method you select depends on the requirements of the application. VDBT components are available from the Dialog editor found in the Borland C++ IDE. Using the Dialog editor, you can use the "Database" function to establish persistent connection with the target database. The "Table" function retrieves data from the database through the BDE, and the "Query" function passes SQL statements directly to the database. There are even advanced image-processing functions such as "DBImage" that can connect to binary graphic data stored in Binary Large Objects (BLOBs) and display the data inside the application.

Microsoft's Visual C++ gives you two ways to set up data access: via mechanisms in the MFC, and via the Component Gallery and wizard subsystems. First, you may use the ODBC API to access the data held in databases that provide ODBC drivers. Second, Visual C++ (the 4.0 release) now supports data access objects (DAOs) through a new class in MFC. DAO is a carryover from Microsoft Access for Windows 95 and Visual Basic. The development tools and the data formats are identical. DAOs let you manipulate databases and record sets as well as display and alter data inside of forms. As with Borland C++, DAO classes exist inside the OLE COM interface, which is linked directly to Microsoft's Jet database engine. You can also access ODBC-compatible databases directly through DAO. You set up database access through an AppWizard, which can connect to a target database and generate the code you require to support the proper MFC classes. Visual C++'s ClassWizard works with the database classes to link to the target database.

Native database access subsystems are not the only way to access database servers from a C++ application. You can use one of several third-party database access libraries. A good example of a foundation library that provides most of the classes you need to interact with relational database servers is DBTools.h++ from Rogue Wave Software. DBTools.h++ handles all the low-level database interaction functions, and it can transform rows and columns found in relational databases into native C++ objects that are easily manipulated by C++ applications. DBTools.h++ comes with a core library that provides the core database access functionality as well as separate native access libraries for particular database servers and ODBC. You access the relational data using a base class that provides a consistent interface to the data.

Another handy third-party database manipulation tool for C++ is SQL*C++ from MITI. SQL*C++ is an interface to C++ that lets you perform join queries directly from in memory. Performance is the key to SQL*C++, as queries can execute up to 90 percent faster than if executed on the host database server. SQL*C++ allows the information from the database to reside in arrays, which vastly improves client/server application performance.

C++ and Client/Server

As you may have gathered from this article, C++ and client/server will not part company any time soon. In fact, new C++ tools and related products continue to bring C++ closer to mainstream client/server development. C++ development provides the ultimate in flexibility and lets you literally customize the tool for the application.

However, C++ is not for everyone. Developers who want to toss together a simple two-tier client/server application may find that C++ is a bit more trouble than the available 4GL-based wonder tools. For those types of applications, you'll need a 4GL to protect you from the details you don't have time to think through. C++ applications usually require a rigorous design process and more time and attention to detail.

Complex distributed client/server applications that encompass enabling technologies, such as distributed objects, TP monitors, and heterogeneous databases, benefit most from C++ development. In these sorts of complex systems, you need the flexibility of C++ to tie all the services together, both at the back end and at the desktop. As client/server marches on toward the enterprise, these types of applications are more in vogue, and the need for C++ development tools and talent is more prominent than ever.


For more information on C++ development tools, see the DBMS Buyer's Guide and Client/Server Sourcebook on the DBMS Web page at http://www.dbmsmag.com.


David S. Linthicum is a widely published author, speaker, computer science professor, and technical manager with AT&T in Vienna, Virginia. You can email David at 70742.3165@ compuserve.com, or visit his home page at http://ourworld.compuserve.com:80/homepages/D_Linthicum/.


* Blue Sky Software Corp.; 619-551-2485 or fax 619-551-2486; http://www.blue-sky.com.
* Borland International Inc.; 408-431-1000 or fax 408-431-4122; http://www.borland.com.
* IBM Corp.; 914-765-1900 or fax 800-242-6329; http://www.software.ibm.com.
* Microsoft Corp.; 206-882-8080 or fax 206-936-7329; http://www.microsoft.com.
* Neuron Data Inc.; 415-528-3450 or fax 415-943-2750; http://www.neurondata.com.
* Powersoft Corp.; 508-287-1500, or fax 508-369-3997; http://www.powersoft.com.
* Protoview Development Corp.; 609-655-5000, or fax 609-655-5353; http://www.protoview.com.
* Rogue Wave Software Inc.; 800-487-3217 or fax 541-757-6650; http://www.roguewave.com.


Figure 1


C++ Development environments allow developers to extend the power of the C++ tool to meet the exact requirements of the application. This includes native GUI controls, database access, external messaging APIs, the Internet, and application-related classes. In many respects, C++ development tools are only as good as the libraries they can use.

Figure 2


The Borland C++ Development Suite lets C++ developers create both 16-bit Windows 3.1 and 32-bit Windows 95 applications, with added support for Java application development. Borland C++ supports OCX integration, OLE automation, and can interface with Microsoft Foundation Class (MFC).

Figure 3


Microsoft's Visual C++ provides an easy-to-use integrated C++ development environment that includes everything you need to create Windows 3.11 and Windows 95 client/server applications. Using the Custom AppWizards, you never need to write C++ applications from scratch.


Table of Contents - August 1996 | Home Page
Copyright © 1996 Miller Freeman, Inc. ALL RIGHTS RESERVED
Redistribution without permission is prohibited.
Please send questions or comments to mfrank@mfi.com
Updated Monday, August 12, 1996