Hyderabad Jobs Book Website FREE PowerBuilder Training I Love Hyderabad Hyderabad Colleges
Home Business Emails Hyderabad Classifieds Contact Us
7 Wonders of Hyderabad Web Hosting Yellow Pages Our Network

 
Webpowerbuilder.hyderabad-colleges.com

Advanced PowerBuilder

HomePrevious Lesson: How C++ User Objects Differ from other User Objects ?
Next Lesson: Dynamic Link Libraries

Why Use a C++ User Object?

As you would expect, C++ user objects offer all the usual benefits of objects such as allowing you to use inheritance, to encapsulate functions and make them reusable in other applications, etc. The benefits they add over and above other objects, though, are as follows:
They encapture the raw processing power and flexibility of C++ and so enable you to improve performance.
They allow you to reuse existing C++ class objects. This saves you development time and cost, and allows you to extend your PowerBuilder application.
They provide flexibility and control-C++ lets you get at the internals of the system in a way that scripting languages can't.

Improve Performance

C++ is a programming language that offers you better processing power, flexibility and performance than PowerScript, which is a scripting language. Executing mathematical, arithmetic functions and complex calculations in C++ is faster than using PowerScript-what takes minutes to execute using PowerScript would take only seconds to execute in C/C++. For this reason, C++ user objects give you tremendous power to extend your PowerBuilder application.

You can use C++ for processing intensive tasks while your PowerScript code takes care of what it does best, including user interface development, database connection and data presentation. For example, if you need spell checking capability in your PowerBuilder application, you can create a C++ based spell checker user object. Spell checking is a processing intensive task and so is better executed in C++ than PowerScript. Moreover, if you create a spell checker DLL, you can use it not only in your PowerBuilder application but also in C, C++, Visual Basic or Delphi applications. A spell checker written in PowerScript, on the other hand, isn't reusable across different applications. It remains restricted to the PowerBuilder environment.

As another example, suppose you're designing a PowerBuilder front-end that requires the users to enter the addresses of customers including zip code, city and state. To expedite data entry, you can integrate a zip code lookup class library with your PowerBuilder application. The user enters the zip code and the application automatically populates the city and state fields with matching entries. Or the user enters the city and state and the application retrieves the matching zip code and places it in the zip code field on the data entry screen. Searching for a city and state that matches a given zip code, or vice versa, is a mathematically intensive task. It means searching and sorting through a large database of zip codes, cities and states. This type of task is better suited to C++ than PowerScript.

Reuse Existing Libraries

There are many class libraries written in C++. The fact that you can reuse these libraries with your PowerBuilder application saves you a lot of time and effort.

So, instead of writing your own spell checker, if you have the source code available, you could integrate the class library of a third-party spell checker. You can extend existing class libraries by adding new classes and modifying existing ones. You integrate existing source code using the built-in Watcom C++ editor provided with the Enterprise edition of PowerBuilder.

Flexibility and Control

C++ provides access to the internals of the machine, giving you greater flexibility to carry out complex tasks.

Consider this example: you're designing a PowerBuilder front-end to some mainframe data. What you want to do is design a friendly GUI so that, instead of using the cryptic mainframe commands, users can point and click to access the data. How do you establish a link between your PowerBuilder application and the mainframe data behind the scenes? One way to do this is use a third party DLL, such as HLLAPI.DLL. This is a MS-Windows DLL that can be called by any MS-Windows application to communicate with a mainframe. PowerBuilder doesn't have any built-in functions or user objects that you can use to access mainframe data, so you couldn't link your PB application with the mainframe data using PowerScript code. You need an intermediate link-a DLL.
HomePrevious Lesson: How C++ User Objects Differ from other User Objects ?
Next Lesson: Dynamic Link Libraries

Copyright © 1996 - 2006 HamaraShehar.com Pvt. Ltd. All Rights Reserved.
Domain Registration, Website Design, Website Hosting by HamaraShehar.com