Discovering Sybase PocketBuilder 2.0: The Basics
What Is Sybase PocketBuilder?
Sybase PocketBuider (PB) is a rapid application development (RAD) tool that came from the PowerBuilder family. If you were familiar with that tool, you will feel comfortable with PocketBuilder as well. Regardless of whether you are a newbie or an experienced user of such tools, it gives you significant power and provides a very productive RAD environment. Hundreds of ready-to-use functions, unique data access technology, mobile database, and synchronization options make PocketBuilder a valuable player in the Windows Mobile development tools arena. This tool was among the finalists of Developer.com Product of the Year Contest during the last few runs. This year, PocketBuilder 2.0 has shown a significant increase in popularity, beating even MS Visual Studio 2005. Thus, it is worth an evaluation.
As was said above, PocketBuilder, with its 4GL IDE transforms many standard yet routine development, takes just several clicks and a few lines of code in a PowerScript language (which is by far not always required). The mainstream philosophy is to provide you with many 'best-practiced' code blocks in the form of available functions and give you the freedom to focus on application logic rather than on implementation details. Take a look; it supports GPS, camera, phone features, and other relatively complex functionality. Just a few things should be be noted: barcode support, sms messages, network connectivity stuff, SIP, POOM, and so forth.
But, if all is so perfect, why don't all developers just forget about C/C++ or C# on the mobile platform? The answer is quite intuitive, as you may suggest. First, it can be used only for Windows development—no cross-platform stuff here. Next, by giving you all that power and exciting opportunities, PocketBuilder puts you in some restricted frame of standard coding blocks. You pay for power by freedom and speed. I don't think this is too bad an exchange, but definitely it has to be weighed before you choose the IDE for development. You can reduce application porting or new development to days and weeks instead of months, but forget about accessing a memory by pointer. Other languages and IDEs can allow you to do many more tricks, and in a significantly flexible way, but putting all effort and responsibility on your own shoulders instead. PocketBuilder offers just another way of the development process.
The next thing to consider is that selecting PocketBuilder as your development environment causes you to use mainly Sybase products on both sides of the pipe to utilize the IDE in the most effective way. PB is tightly integrated with Sybase SQL Anywhere Studio (in other words, with Adaptive Server, Anywhere (ASA), UltraLite, and MobiLink). Nevertheless, when your application needs more capability that is not directly supported in PocketBuilder, you always can create your own libraries in any language supported on the Windows CE platform (my first favorite here is C/C++), export your functions, and then use them in PocketBuilder. This feature leaves you an 'open door' to work around some possible lacks in existing functions. I will describe it in one of the upcoming articles.
Having said all this, turn to your first project with Sybase PocketBuilder.
Creating the "Hello, World!" Application
Your first project
I selected the traditional path all languages and tools follow. Your first application will salute you with the "Hello, World!" phrase. So, the very first step is to create a new project (File/New):
Select Pocket PC Application and simply follow the wizard steps. In this first project, you won't use any database, so just select the appropriate options. As a result, a new workspace will be created along with new target. PocketBuilder follows the usual scheme, offering workspaces to keep multiple targets, which are, in turn, an analogue of the project in other IDEs.
Now, investigate what the wizard has generated for you:
You will find an object, representing the module itself, project, main menu object, main window, and about box window. That's what you have by default after simple code generation. PocketBuilder is an object-oriented tool that supports an inheritance and all other stuff, so you can enjoy creating your own objects if you want to.
Look at the PocketBuilder IDE in general. It provides a number of things that make your development process more convenient. First, you develop with painters. Painters is a set of tools that helps you build your specific component; for example, Window Painter, Database Painter, Library Painter, and so forth. The next cool thing is Clip Window. There, you can name and store the most useful code snippets, so the moment you want to paste it, it is always available handy. And, if that is not enough to convince you to use PocketBuilder, the To-Do List adds one more tidbit. This feature allows you to add, edit, and import a list of development tasks for each target. Such entries can be created automatically by PocketBuilder wizards as well. I don't mention here other nice tools, such as PowerBar, PainterBar, Browser, and so forth. You can discover them on your own. Here, let me point out only that a mainstream of coding will create objects with Painters and set their features in the Properties window.
Now, back to the target. When you double-click on different objects, you can see various Painters in the middle of the screen. Actually, you can customize your IDE as you prefer. But, in the default layout, Painter appear in the middle of the screen. Usually, you see several pages in such Painters; they allow you to manage the window's layout, add and edit event handlers, define variables, and so forth. Just take a few minutes to play around with all this stuff; you will learn its power.
Finally, when you're tired and excited by such a wide range of available features, you might want to observe what all your code will result in. PocketBuilder gives you such an opportunity as easily as clicking one button! Press Run via either the PowerBar or menu, and you can enjoy your "Hello, World!" program right on your desktop, without any additional stuff installed:
PocketBuilder has a lot more features than I have touched on here. This article has discussed only the very first and important ones to let you get started quickly. Later, you will learn about other applicable areas, such as databases or networking, and learn them step by step. Once you become familiar with the main PB IDE features, the next topic I am going to describe is how to work with one of the most useful PocketBuilder techniques—DataWindow. But, in the meantime, I guess you have enough to play with. Have fun!
About the Author
Alex Gusev started to play with mainframes at the end of the 1980s, using Pascal and REXX, but soon switched to C/C++ and Java on different platforms. When mobile PDAs seriously rose their heads in the IT market, Alex did it too. Now, he works at an international retail software company as a team leader of the Mobile R department, making programmers' lives in the mobile jungles a little bit simpler.