Mobile archaeology: BlackBerry
Everything described in the Mobile Archaeology series assumes that the answer to questions like “Why didn’t you just do it this way?” is always exactly one: there was nothing ready-made, it wasn’t allowed, forget about any libraries — they didn’t exist. The NDA expired long ago, some projects are gone forever, so I can talk about them. For me this is not just about code: it is a story about decisions in conditions where there are no ready-made tools.
Orders
Back in the day BlackBerry was a gadget for serious guys with equally serious money — suffice it to say that they were among the first to advertise in movies. If you’re a businessman, you have a BlackBerry.

It had a perfect keyboard. It was well built. It was status; it was the best device for work. So orders for BlackBerry apps poured in, and Axmor, where I worked at the time, made good use of that. In fact, of everyone doing app development back then, they knew and could do more than anyone: there were too many large projects.
Development
At the same time, BlackBerry development was sheer hell — even J2ME felt nicer to work with, somehow.
Tooling
IDE JDE
This is roughly what the thing that proudly called itself BlackBerry JDE (Java Development Environment, not some IDE) looked like:

It was a Swing app that looked awful, ran unreliably, and generally did badly everything it possibly could. Completion worked every other time and only on holidays. Basically, the only thing you could do reasonably well there was debug. And that’s because back then I couldn’t cut the debugger out of it and move it into a normal IDE. In the end I wrote code in NetBeans, after trying this in a dozen IDEs of the time.
That’s when I got the developer’s first and only negative experience after which he never uses a product again: I installed IntelliJ IDEA, spent a day wrestling with project setup, got a pile of strange configs in the .idea project folder, couldn’t figure out what a facet meant in their terminology, and eventually went back to NetBeans.
Let’s be honest — the UI in IDEA back then was, to put it mildly, not great:

The irony is that I joined JetBrains after the mobile developers on the team I led showed me Android Studio, built on the updated IntelliJ platform. It had not only the most convenient interface of anything I’d worked with, but working with code was noticeably nicer and faster.
And right before it died, BlackBerry did manage to release an Eclipse plugin, which worked so badly that I stayed on my own stack for a long time.
Binaries
As a result of compilation you got a .cod file, which was sometimes a .cod file (the final binary) and sometimes a zip archive with a bunch of .cod files. So to let a client download the next version of the app you had to:
- Assemble the build
- Unzip it
- Upload all the files somewhere
- List them all in the
.jadfile
Somewhere along the way the whole bundle had to be signed on BlackBerry servers, which took anywhere from a couple of minutes to a couple of days (you never knew exactly how long). But even building the builds and publishing them was already a problem. At Axmor, before me, it was done by hand. I still remember a conversation with my PM, from whom I actually learned everything:
- Listen, I’m fed up, let’s come up with something already
- Stas, there are only three files

That’s when I decided to automate the process and, with bb-ant-tools, wrote a simple little script that generated everything automatically, uploaded the files to FTP and produced HTML for the builds page. A couple of weeks later there were three builds and nine files.
Then there were five builds, seven files each.
Then everyone started using my script, because otherwise it was impossible.
The device version zoo
BlackBerry was the first to invent a senseless and merciless zoo of screen resolutions, JDK versions, and versions of pretty much everything you can imagine. All devices worked sort of the same way, but in reality slightly differently.
A crude example: there’s a call log, and there’s an object of type CallLog. You need to pull the phone number out of it and do something with it in the app. In version 4.3 the API returned String. In 4.5 — Object, which could contain either String or CallLog. In 4.7, according to the docs, it was supposed to return CallLog, but in reality it returned String. In 5.0 it returned CallLog with an empty number. Or just null. So what?
And that’s how it was with everything. A new screen resolution? Okay, we have built-in layouts, everything’s fine, right? No, not fine. Nobody used their built-in components, because you could design roughly nothing on them. It was impossible to override the rendering of a TextField entirely; you had to draw it from scratch on Graphics. My holy grail was a universal GUI library, which I built across six or seven projects. In the end I stopped — and it was a deliberate decision: even if you wanted to write a GUI from scratch, there simply wasn’t time to write the entire standard control library.
Another fine example of the zoo was the maximum file size on the filesystem. We were building a voice recorder with recordings up to an hour long, and it turned out — again, roughly — that different OS versions had different maximum file size limits, and the limit was strictly empirical and nowhere clearly documented. A one-hour .amr file was much larger than that limit, so for no good reason we had to build an index of recording chunks and join them back together when uploading to the server.
Networking
Today someone saying “opening an HttpConnection is extremely hard” would look slightly insane. With BlackBerry, libraries had to be written for years just to open a connection.
When opening a connection you had to send the device a string identifying the connection type. And there were several types:
- Direct TCP (a.k.a. mobile network). By the way, you had to set the APN manually, because it is far from always detected automatically.
- WiFi (two kinds, I don’t remember which exactly)
- BES/BIS, a.k.a. BlackBerry Enterprise Server and BlackBerry Internet Service
- MDS (Mobile Data System, whatever that means)
Naturally, to make the developer’s life harder, the methods that checked whether a particular connection was available did not work properly, so at the very end you had to try opening a short test connection to some arbitrary Google. By the way, if it did not work, then:
- Maybe BIS, BES and other MDS were configured any old way (for example, they simply did not support HTTPS). And really, why would they?
- Maybe the carrier had an HTML page on the first login to the internet (later we learned to catch it manually and open a web view so the user could click Next and get onto the internet)
- Maybe there are a billion other reasons, because gladiolus
To make the developer’s life even harder, the stock HttpConnection simply could not upload large files. The official documentation said something like: if you need to upload a large file, split it into small chunks and reassemble them on the server. Can’t do that? Well, go chew bamboo.

I’m still proud that I wrote my own HTTP over Socket for Evernote, which, with cleverly chosen socket flags and other dark magic, could push megabytes in one piece. flush? I told you: it won’t work — the first flush closed the connection. Mine, by the way, didn’t.
The old-timers will remember that later — again, when the platform was already dying — BlackBerry released an API that automatically picked the best connection.
It existed. And it also crashed after the first flush. But we used it anyway — the connection-opening component got even fatter.
And to finish off this same developer, every carrier’s infrastructure worked unpredictably. I know what I’m talking about — for four years I sorted through bug reports from all over the world, and exactly half of them boiled down to letters to the carrier saying something like “Dear Sir, would you be so kind as to enable HTTPS?”
It only works in the documentation
Once the manager had a dangerous idea: the client had no proper server and wasn’t willing to build one, and we were already tired of fighting with the connection. What if we sent files in chunks over email and reassembled them on the BlackBerry backend? The built-in emulator for this flow worked only on paper, and only on Sundays. We spent a month, and still had to convince the client to build a proper backend. A year later we got a fine — the first and last in my career. Not that I was strongly against it at the time, but, apparently, after that I said that if there was another case like this, I would put my resignation on the table. There were no more fines.
In Evernote we used the standard browser component to display rendered notes. It crashed when trying to load a note with roughly 2 MB of HTML. Or 4, I don’t remember anymore. The HTML was valid, everything was written correctly, the browser thread just crashed no matter what async we moved the loading into and what we did with it. The app seemed to crash along with it.
At the end of such notes there was a button: “Sorry, it won’t work, here’s a preview, go to the web version, thanks, bye.”

java -source 1.3
No collections. Here’s Vector and HashSet, off you go. java.regexp? Come on, what regex? By hand, all by hand. Well, almost — I had my own chunk with relatively normal collections, java.regexp and a bunch of other stuff, ported from Java 1.6 by spending a week cutting out generics and JNI. When I ran a test regex and printed the correct result to the console (the first run after deleting the last red piece across two thousand files), I almost jumped for joy.
JNI? What JNI?
It didn’t exist. We needed to convert .amr to speex, as I recall. That was the requirement — the client’s backend was for a Windows Mobile app, which I also built, and there we converted .amr to speex on the fly easily and effortlessly. Just a C++ library and there you go — a small, convenient file. Here, even just to record a chunk to a file, you had to keep a queue of a couple of seconds of audio, because recording had such a delay (how we masked it is a separate long story). Never mind conversion — I remember the proof of concept worked, but was about twenty times slower than the C++ reference. In the end we moved conversion to just before the file upload, and edited the recording using recorded and indexed .amr chunks (yes, we had not only overwriting but also inserting into an arbitrary place in an hour-long recording).
Fast? What fast?
Once we had to build a screen in the app that parsed a contact’s vCard and displayed it in detail. It also let you edit all that.
With standard controls the screen scrolled at a pixel per second. No, we weren’t accidentally loading it with something. No, there were no heavy threads in the background. We just threw a bunch of strings at it and drew. That’s all. Well, maybe a couple of drawings, and not very large ones.
In the end we rendered the whole page on Graphics with double buffering and updates of the visible part of the screen. Well, I mean, I implemented it. It was painful, but the screen scrolled easily and effortlessly. That’s when I learned the magic of periodic small System.gc(). Why? Because memory filled up instantly, and a full GC caused noticeable pauses, even though there were no leaks at all. The small one worked quietly and didn’t buzz. Naturally, all this is bad and wrong. But what can you do if there was no other way?
It’s cool to be a senior, but not a BlackBerry one
At some point I was the only developer who had written a lot of BlackBerry projects, and predictably they started dumping their support on me, small tasks that came from clients, and so on. I started to feel sad: everyone else was already living in paradise with normal Java, or at worst Objective-C. I reached the edge — I started missing Windows Mobile 2003.

At some point my PM noticed I was tired and gave me a couple of projects where I could breathe.
Death
BlackBerry died slowly. There were attempts to reformat, make large screens, add touch, port to QNX — you name it. But it died anyway. First serious guys started buying iPhones with the slogan “it’s beautiful, but typing is more convenient on BlackBerry.” Back then they shamefully hid their iPhones in their pocket and took them out with an apologetic look — like, I can’t resist progress, you understand.
And then BlackBerry just disappeared. And, honestly, nobody was upset.