[caption id="attachment_9496" align="aligncenter" width="618"] During the initial rollout, BlackBerry executives showed off various BlackBerry 10 features. But how easy is it to develop for the platform?[/caption] Remember BlackBerry? For most of us, the company (known for years as Research In Motion) really is just a memory. Back in 2005, it seemed as if every manager and business executive had a BlackBerry device; nowadays, Apple’s iPhone and Google Android basically split the mobile-device market between them. The ascendancy of iOS and Android devastated Research In Motion’s business: from a peak of 46 percent in 2008, its share of the smartphone market (according to research firm IDC) plunged to 4.5 percent by 2012. Ouch. But something funny happened on the way to bankruptcy: Research In Motion decided to make a final Hail Mary pass, in the form of a new mobile operating system named BlackBerry 10. (At the same time it whipped the curtain back from the new platform, the company also announced its formal name-change to BlackBerry.) CEO Thorsten Heins has spent the past few months exhibiting his extreme confidence in BlackBerry 10’s ability to compete with rivals, even going so far as to call the iPhone “outdated.” Indeed, BlackBerry 10 is completely different from previous BlackBerry operating systems—with good reason. Its core assets come from a company named QNX, which Research In Motion acquired in 2010. Blackberry 10 features include “live tiles” that dynamically refresh with new information, as well as a revamped keyboard and security upgrades. But what really makes or breaks a phone is the quality (and quantity) of its third-party apps. So what we'll do here is look at the programming API. That will give us a good grip on what app developers can do with the platform.

The Native API

Installing the BlackBerry Native SDK is easy. So easy, in fact, that installer states: “Respond to each prompt to proceed to the next step in the installation. If you want to change something on a previous step, click 'Previous.’” (Um, thanks for the handholding.) It also says, “The name of the installation directory must not contain any white space. BlackBerry Native SDK will not work otherwise.” Seriously? The developers at BlackBerry don't know how to write code that can handle spaces in path-name strings? The BlackBerry 10 operating system includes a few different levels for programming. The lowest level is the native API, for which you use C or C++. Once installed, you get a version of Eclipse that's customized for BlackBerry 10 development. Eclipse is re-branded as QNX Momentics IDE, and it has the QNX logo on the front screen. There are two sample apps that you can start with; one is a “falling blocks” game. Opening the sample code, there's a single .c file, filled with code like this:
app_t *app = (app_t *)calloc(sizeof(*app), 1); if (!app) {

    return EXIT_FAILURE;

} app->boxes = (box_t *)calloc(sizeof(box_t), MAX_BOXES); if (!app->boxes) {

    return EXIT_FAILURE;

Yes, folks, calloc, not new, because this is C, not C++. Want to use C++? Sure, just add the headers and make the calls into the C functions supplied. That's right: there are no classes provided, just C functions; and you pass pointers—not references—like this:
glview_initialize(GLVIEW_API_OPENGLES_11, &frame); glview_register_initialize_callback(&initialize); glview_register_finalize_callback(&finalize); glview_register_event_callback(&event_handler);
It sort of reminds me of 1993 when I learned 16-bit Windows programming using C. That's 20 years ago; nothing like the old days, right? But seriously, you can certainly use C++ here, and the compiler will compile the code just fine. And most of us would probably prefer to use C++. But the API library itself is in C. Aside from my snarky comments about using old C-style coding, notice those four function calls I just demonstrated start with “gl.” That would be “GL” as in “OpenGL,” specifically OpenGL ES 2.0. BlackBerry has developed its own wrapper code around the OpenGL API.

The API: Some Old, Some New

The documentation mentions QNX in many places. Googling some of the function names, I found something interesting: documentation for the QNX CAR Platform. BlackBerry still owns the CAR APIs and is apparently still developing for that market, although their long-term intentions remain unclear. The CAR platform includes a full API that is almost identical to the BlackBerry 10 API. This is no surprise, really, considering the BlackBerry 10 is a descendent of this platform; but the CAR Platform seems to have evolved as well, with BlackBerry adding some of the new BlackBerry 10 features back into the software—including, for example, the higher-level WebWorks system for HTML5 and JavaScript. Back to the BlackBerry API, which is divided into several categories (as is any good API). There are some interesting parts, such as a regular expression library also inherited from the CAR Platform. And there's an audio section—If you're looking for development ideas, maybe you can develop a kick-ass car audio system. There’s also a gestures library, a camera library, a Bluetooth library, a geocoding library, and a security library that includes OpenSSL support. Generally speaking, what you have is a complete API for accessing the inner workings of the device.

The UI Library

BlackBerry has bragged about the UI library. The new BlackBerry 10 devices do have a nice UI system, and the company has won some praise for that. There are two aspects to it: The low-level operating systems API, for managing windows and controls, and then a higher-level library that lets you use the Qt4 system, which is a version of the Qt library. (Qt itself has evolved over the past 18 years, originating in mid 1995 as a cross-platform framework; the company that started it was later acquired by Nokia, the phone manufacturer that competes with BlackBerry.) The library is actually pretty decent. BlackBerry includes support for QML, which is a modeling language for targeting Qt. To use it, you create your declarative QML code, which looks like this:
import bb.cascades 1.0 Page {

    Container {

        layout: DockLayout {}

        Label {

            text: qsTr("Greetings")

            textStyle.base: SystemDefaults.TextStyles.BigText



It's sort of a JavaScript-like language, but without as many colons and commas. It's also not just declarative; you can even include actual JavaScript code inside it for handling events. Qt itself is written in C++; and unlike the native API, here you do have to use C++ to load the QML files and manipulate the GUI in your native code. That means you can work at two levels: include some JavaScript code in the QML files, and also use C++ compiled code. The documentation for doing this is pretty nice, with samples that include how to integrate your C++ classes with QML. In my opinion, it was wise for BlackBerry to adopt Qt and QML, because this is a proven open-source framework that works well and is easy to use. This might encourage people to port existing code, although I doubt we'll see many existing Qt apps actually ported to BlackBerry. If you prefer the lower level, the API is what you would expect to find in a full windowing API. For example, you can make C-calls into the library like this:
rc = screen_create_window(&screen_win, screen_ctx);
where you pass a screen context and a pointer to a variable that will receive back a screen handle. You can also work with screen buffers and do bit-blit operations—good old windowing API stuff.

Gaming Engines

BlackBerry has included several gaming engines to help with game development, including Unity and Marmalade. Looking at the samples, the games created for the devices seem pretty impressive. Better than what you can find in the iPhone and Android? Of course not. Equal? Probably. But remember: In order for a device (or any product, really) to rise from a low-single-digit market share, the device needs to offer compelling reason for people to switch. If BlackBerry wants to capture the mobile gaming market, their devices can't just be equal to the others; they need to be far superior. And so far I'm not seeing anything like that.

Higher-Level Development

If you don't want to write code in C or C++, there are other platforms available with BlackBerry 10. One is called WebWorks, through which you can develop apps using HTML5 and JavaScript. At the heart of WebWorks is Sencha's Ext JavaScript API. So if you're familiar with mobile web development, you can probably get going pretty quickly here. You can also use Adobe AIR, or even Java, which brings me to the question of porting.


BlackBerry is really encouraging developers to port apps to BlackBerry 10, hoping that—as the masses start ditching their “outdated” iPhone and Android devices, because of course that will happen—customers will have their favorite apps and games ready to download. But if you’re going to port an app, I'm skeptical that you would be able to easily port a C++ app—although if you're using QML, it might not be too bad. If you have an app that uses Sencha or AdobeAIR, then porting probably wouldn't be bad at all.

Conclusion: Outdated?

In the end, it's clear that the BlackBerry 10 API and underlying system are a mixture of old and new. The API is based on an older API that has been evolving for over a decade—there are other frameworks that are certainly more modern. What you really have here is a POSIX-based operating system and a complete API, and you're targeting a tiny device. Because the CEO called the iPhone “outdated,” I couldn't help but point out the age of many of BlackBerry 10’s underlying software components. That aside, there's no doubt the operating system is good, and the company is going to great lengths to encourage development. They offer plenty of code samples, decent documentation, lots of blogs and articles about development and best practices, and so on. They have spent a lot of time building up a foundation for a good development community. But is the device better than iOS and Android? All of these operating systems are descendants of Unix. The new BlackBerry devices contain the same caliber of hardware as many rival devices. And the UI certainly feels as “modern” as its rivals. On the developer side, the API for programming really is good; I was able to use QML and C++ and create an app pretty quickly. Even if BlackBerry manages to attain somewhat-equal footing with its rivals, will that pull in developers who have a lot of choice in mobile development platforms? That’s not an easy question to answer—BlackBerry will first have to show that developers can make good money from their apps for BlackBerry 10. And that partially depends on BlackBerry 10 phones selling well to consumers and businesses, which will create a market for those apps. Can BlackBerry build that significant market presence? Personally, I doubt it. I see a long, struggling path that will last a decade (maybe slightly less) and then bankruptcy. If BlackBerry wants to avoid that fate, it will need a series of top-notch devices backed by smooth rollouts and solid advertising campaigns; it will also need to resist the temptation to drop its hardware division and rebrand itself as some kind of software consulting-and-licensing group. But most of all, it needs to keep the new phones (and updated software) coming—without new products in the pipeline, the company will whither and die. No pressure, BlackBerry.   Image: BlackBerry