#52WeeksOfCode Week 12 – Java ME

Week: 12

Language: Java ME

IDE(s): Java ME SDK32


The question for this week is why would anyone develop in Java ME? Java ME (Micro Edition) is designed for devices with limited memory, display and power capacity such as cell phones, PDAs, MP3 players, set-top boxes and Blu-Ray disc players. The most popular such devices are cell phones but they don’t support it. Android supports ‘real’ Java with their own framework. Apps for Apple’s iPhone and iPod Touch are built with Objective C and Windows phones don’t support Java in any form. In fact, according to NetMarketShare Java ME is in 3rd place in mobile operating systems with a 4.44% market share as of February 2014.

Not so fast. One place where Java ME thrives is in feature phones, the precursors to today’s smartphones. While smartphone shipments worldwide finally outpaced those of feature phones in 2013, about 42 percent of cell phone sales (839 million) were feature phones. In fact, if you’re living outside of the US and living on $10 a day, chances are pretty good that you don’t have an iPhone, Android or Windows phone. Facebook’s recent acquisition of WhatsApp was in part because of the app’s worldwide reach. Basically, it runs on everything, including Java ME devices. The market of the developed world is relatively small compared to the 3 billion other people on the planet who don’t have smartphones.

Now, if I were a developer (and as the official World’s Slowest Programmer(™), clearly I’m not), I wouldn’t readily dismiss this potential market.


As always, the first step is to get the software. The first thing you notice is that the latest version (3.4) is only available for Windows, so if you want to develop on Mac OS X, you have to use an earlier version (3.0). If you use Linux, however, you’re out of luck. You’ll have to use version 2.5.2 but you won’t have access to the emulator so you can’t test your software.

I have access to both Windows and Linux but since (as I’ve pointed out) I Am Not A Developer, I set up the IDE on my MacBook. Oracle does not make it easy to find any non-Windows version of the IDE. Even then, you have to register for a (free) user account on Oracle’s website. However, eventually I managed it.JavaME_IDE.png

If you prefer, you can also use Eclipse Pulsar and the default download comes with plug-ins for NetBeans. If you want to set up a new project, you can either import an existing wireless project or create a new one. But the demos give you plenty of code to play with and tutorials are readily available.

I set up a new project, taking the defaults. When I built and ran it, the software emulator automatically started and ran the app:HelloJ2MEApp.png

It’s similar to the Android SDK, except our graphic comes up as a feature phone (appropriately enough).



#52WeeksOfCode Week 11 – Android

Week: 11

Language: Android

IDE(s): Eclipse for Android


Android developers have both a huge opportunity and a huge problem. Both of these can be laid directly at Google’s doorstep as they spring straight out of Google’s Android Strategy:

1. Create a mobile operating system that is ‘good enough’ and give it away at no cost.

2. Let others modify the platform any way they want

Number 1 means that Android gets wide distribution very quickly. Last year Android devices made up almost 80% of global smartphone shipments and according to Google’s numbers there are 900 million Android devices out in the wild. Great news! Sounds like becoming an Android developer is a license to print money with all of those potential customers out there.

Not so fast, Hoss.

The problem comes with step 2. Smartphone companies get to decide for themselves what version of the operating system to use and what features they’ll support. So those 900 million phones are not all running the same OS and so your choice is to either support every active version available (thus costing you money and time) or just support the latest versions (plus or minus a release or two) and cut down on your potential customer base.

This isn’t even going into the problem of fragmentation on the hardware side. Storage capacity, memory size, screen sizes and resolutions…so your app still may not work on all devices even if they’re running a supported version of the OS. The major problem with Android (particularly for Android developers) is fragmentation.

Google, however, has an idea that they think will fix this. Simply put, they plan to restrict access to Google Mobile Services (GMS) to devices that ship with up-to-date versions of Android. So if you’re a smartphone maker and want to be able to ship apps like Google Maps, Google Drive, Google Play, Google Calendar and Gmail, you’re going to need to make sure you comply.

Great idea. There’s one teensy little problem, though. You don’t have to ship Google apps with your Android device. That’s exactly what’s happening in China, which has almost 300 million Android users, 70 percent of whom don’t use Google apps.


I want to be clear, this is not some kind of anti-Android or anti-Google screed. I have an Android phone and I rely on Google apps quite heavily (I’m typing this post in Google Docs, for example).

The reason China is rejecting GMS is because China and Google are having a fight over China’s censorship of Google search results.

So maybe the problem is about control. Perhaps if you want to give away software (and please note I’m a big fan of Open Source and Free Software), maybe you have to be willing to give up control and rely on what value you can provide through services and have your services compete openly with others rather than try to lock in your customers and rely on that to control them.

But I’m just a Simple Country Lawyer. (Metaphorically speaking.)


Getting the Android Software Development Kit (SDK) was pretty easy. You can do your development on Windows, Mac OS X or Linux and you can even use your own IDE, as long you download and install the SDK tools and whatever other Android packages you’re going to need.

I decided to go with the full bundle, so after I agreed to the Terms and Conditions, I went ahead and grabbed the approximately 450 MB download of the Android development platform for my MacBook. And though I have an Android phone, the kit comes with a software emulator so I won’t have to risk bricking my smartphone.

Android software uses the Java programming language and the IDE of choice is Eclipse. (You can also use the SDK tools from the command line but you’re still going to be programming with Java.) The download was a ZIP file consisting of two folders, eclipse and sdk. I followed the setup instructions and unpacked the ZIP in a folder called Development.

When I launched Eclipse, I was given a window with a button labelled “New Android Application” and three tutorials, “Build Your First App”, “Design Your App” and “Test Your App”. Selecting “Build Your First App” takes you to the Android Developer tutorial page where you’ll begin a walkthrough.

Like most modern IDEs, Eclipse has a New Project wizard that walks you through setup in order to make sure that you don’t miss anything. For this tutorial I created a project called “My First App”.

First problem – the simple act of creating my app (remember, I haven’t built or run it yet) generating a list of errors 337 lines long. This does not bode well. The full error log is here, if you’re interested. I’m going to soldier on, however.

One of the features that interests me about mobile application development is being able to test your app in a virtual device. As I’ve said, I have an Android phone but I’d like to try the emulator first.

The primary advantage of using the emulator is that you get to test your app on different hardware models with different versions of the Android OS. I launched the Virtual Device Manager (VDM) from the Eclipse toolbar and the first thing I see is a window with six error messages in it about multiple virtual devices that failed to load. As I haven’t created any devices yet, these may be older versions of the API that were not included as part of the SDK I installed. So I soldier on.

The next thing I notice is that my model phone is not on the list of devices available. I have an Galaxy S3 and the nearest I can find is the S4 so I pick that. The only Android API version available to my emulated device is level 19, which might explain why the other versions failed to load earlier. For the rest of my options, I take the defaults. My VDM window now shows that I have a valid Android Virtual  Device. I select the device, click on ‘Start’ and shortly a window pops up and I get what looks like an Android boot screen. At first it looks like it’s not doing anything but in a couple of minutes, I get a home screen. It’s a little pokey, but that’s to be expected. I have to use my laptop keyboard for the controls but the Android folks provide a helpful table for this.

The first run didn’t work but once I closed the emulator window and ran the app again it did.  Here’s what it looks like:MyFirstApp.png

Overall, it looks like getting started on Android development is fairly straightforward, as long as you ignore the Looming Spectre of Fragmentation (as discussed above). Like everything else, there are still issues. But, as the Buddha says:

What is the noble truth of suffering? Birth is suffering, ageing is suffering and sorrow and lamentation, pain, grief and despair are suffering.

He was a pretty fun guy.

#52WeeksOfCode Week 10 – Windows Presentation Foundation

Week: 10

Language: Windows Presentation Foundation

IDE(s): Microsoft Visual Express


“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”

C.A.R. Hoare (British computer scientist, winner of the 1980 Turing Award)

Sometimes it seems to me like Microsoft exists in some parallel universe which only occasionally intersects with our own. I come by this opinion honestly. I’ve watched for decades as Microsoft rejects perfectly good technology (such as DNS) time after time and invents their own, incompatible version (like WINS).

This is not to say that the software in the Microsoft universe (Microverse?) is inferior but it’s as if they refuse to believe other software developers exist. The Windows Presentation Foundation is a good example of this. It uses MVVM, (Model-View-ViewModel), a Microsoft-developed descendant of the venerable MVC (Model-View-Controller) design model. It also uses their own version of XML (Extensible Markup Language) known as XAML (Extensible Application Markup Language). See? Like our universe, but different in many subtle ways!


WPF, as the name implies, is a User Interface (UI) framework. As such, I’ll readily admit that it makes creating a graphical interface extremely easy with simple drag-and-drop of a rich library of UI controls. In many ways, it reminds me of Apple’s Interface Builder, which offers similar functionality but is a separate application from their IDE, XCode. WPF, by contrast, is fully integrated with both MS Visual Studio and MS Visual Express.

Once I got Visual Express installed and running, I used one of the many good tutorials available to quickly work up some code. Building the UI was as simple as advertised and, since I didn’t need to do anything fancy, I added a single line of code and produced something that compiled and ran properly. (Basically, it was a button and textbox in a window. When you clicked on the button, “Hello World!” would appear in the textbox. The code is so trivial I’m not even going to bother embedding a link to it.)

That was really all the code I was looking for at this time, so I decided to get a sampling of opinions from developers about the technology. The ones that like WPF and XAML seem to do so because it’s a very clean separation of UI and programming logic. In addition, they like it because it’s so much better than what they used to use.

The ones who don’t like it, on the other hand, seem to do so because it’s not as good as what they used to use. They cite problems such as a poor design experience, bad animation performance, weak support for drag-and-drop (ironically enough) and that WPF makes the hard things trivial but the trivial things hard.

#52WeeksOfCode Week 9 – Google Maps

Week: 9

Language: Google Maps API

IDE(s): MAMP, TextWrangler


Everybody gets so much information all day long that they lose their common sense.

Gertrude Stein

(Sorry about the late post this week. Real Life[™] sort of caught up with me.)

Common sense would indicate that the more information we have, the better decisions we should be able to make. We currently have the ability to collect and access more information than at any other time in history. This should be a Golden Age where we can solve problems and find answers to questions that have bedeviled mankind since the dawn of time.

This is the premise (somewhat) of what is popularly known as “Big Data”. We have more information than ever and that turns out to be a problem. First, information is not the same as wisdom. We need the tools to analyze information so we can draw conclusions out of it. Unfortunately we have so much of it that most of our current tools are overwhelmed by the sheer volume that needs to be processed.  In addition, information is traditionally kept in ‘silos’, isolated from related content so that it’s difficult to get a complete picture. There is also the trust issue. In other words, it’s hard to convince people or organizations to share their information.

But many companies are still soldiering on, convinced that if only they just knew enough things about enough things, they could accomplish miracles.

No company presents a more public face for Big Data than Google. They not only gather and process massive amounts of information (Google Search, Google Maps, Google News, YouTube, Google Scholar) but they also sell massive amounts of information (targeted ads based on your search terms, your online video preferences, your Gmail messages) as well as give others the ability to process their carloads of data as well (Google Analytics, Google BigQuery). In fact, I use Google Docs for much of my writing and I notice links pop up in the research pane based on what I happen to be typing.

“My internet browser heard us saying the word Fry and it found a movie about Philip J. Fry for us. It also opened my calendar to Friday and ordered me some french fries.”

– Hubert Farnsworth, Futurama, “The Luck of the Fryish”


Google Maps data is accessible to IOS, Android or Web developers. There is plenty of documentation available and I started here. Similar to working with Twitter, you need to create a key to identify yourself when your software talks to Google’s servers. Fortunately this process went much more smoothly than my Twitter experience.

So I used some sample code and, in keeping with the tradition of these posts, modified the HTML code to produce a map that centers on Hello World Communications. Here’s a grab of the browser window:HWC.png

The code I used is here (my API key has been redacted).