Monthly Archives: August 2014

The Dark Art of Java Programming

To add another string to my bow, I have decided to learn how to write apps for the Android operating system (For those not in the know, there are basically 3 types of smart-phone/tablet: 1) Windows Phone/Tablet (Microsoft), 2) iPhone/iPad (Apple) and 3) Android (made by Google). if your smart-phone is not an iPhone, and is not Windows, it is almost certainly running Android).

Android

Android

The base code for writing programs for Android is called Java. You may have seen Java Updates in the corner of your PC screen. It is a well established computer language, and is used in all manner of ways on web-pages. You may also have seen this chirpy fellow on phones, apps, and elsewhere. He is the mascot/logo for Android. Wherever you see him, you know that you are looking at something for the Android system.

So, back to writing apps. I learnt some basic programming a long time ago, in a language known, appropriately, as BASIC. While it still exists, BASIC is not used very much any more, as languages have evolved, and new, better ways of writing code have been developed alongside new technologies.

Java was originally called Oak, and was developed for Interactive televisions in the early 1990s, but was far ahead of its time. It was renamed in honour of the large amounts of coffee drunk by the development team, and published by Sun Microsystems in 1995. Quickly included into most Web Browsers, Java Applets (small sections of Java code) became very popular for adding interactive features to web pages.
But enough of its history. What of its future? In particular, its future in my hands!

First, I needed a goal. What was my App going to do? I decided upon a Character Reference Sheet for D&D.* To play the game, each player needs to keep track of their Character’s capabilities and skills. Each Character has a Profession, which gives them access to unique abilities (such as a Wizard’s ability to learn Arcane Spells, or a Warrior’s rapidly advancing combat capability). Add in their Power Levels, Hit Points (how many times they can be ‘hit’ in combat before succumbing to their injuries), and several other things that need recording, and it seemed like a reasonable task, that could be built up piece by piece.

Character Sheet App

Character Sheet App

So, I’ve been reading through tutorials, looking over examples, and typing up my own code. After what seems like months of tracking down error messages, figuring why what looks to be correct code produces garbled output (or no output at all!), and generally hammering my head on my keyboard for hours on end, I have produced a simple program that records and displays some of the more important facts and figures needed. I have learnt a lot along the way, including many ways NOT to do things, and as the app grows, I find myself having to rewrite it from scratch, trying to reuse as much code as possible under new structures, as the old code becomes tangled and unwieldy.

I did have a chat over a beer with a friend who knows a lot more about this that I do, and he has pointed me in the right direction in several parts of the program. Hopefully, the next version will be tidy, efficient, and cover most of what is required!

If anyone is interested in a copy of the App, they can contact me at the usual email address: support@thecrystalwizard.co.uk

(Disclaimer: All characters appearing in this work are fictitious. Any resemblance to real persons, living or dead, is purely coincidental. Photos and names blagged unceremoniously from one of the tutorials I found very helpful: )

*Dungeons and Dragons, a tabletop Role Playing game where players take on the roles of Warriors and Wizards to do battle against Evil foes such as Goblins, Orcs and Dragons.