Phone development: hiccups

When you get beyond simple development, it is sometimes a pain just setting up the tools in order to get things done.

We discovered that today when trying to set up a laptop for installing the app development environment.

We are writing our app in JavaScript, HTML and CSS. The plan is then to embed that in a browser in an app on a phone by using a project called PhoneGap, which lets us use the same code on all phones, instead of writing phone-specific native code (Android uses Java, iOS uses Objective C, then there’s Bada, Symbian, and others to consider).

However, installation is a pain. We need to download and install Eclipse, then download and install the Android SDK, then get Google’s ADT plugin for Eclipse, then download Phonegap (version 2.9.0 – version 3.0 sucks). All of that before we can get the phone to even say “hello world”!

So, while downloading that stuff, we carried on with the coding of the WordChain app.

Last week, we worked on simply creating the user interface – the buttons, etc, that would be shown to the player. We ended up with a simple system that showed a word at the top (cold), another at the bottom (warm), and let you fill in letters in between.

This week, we decided to have the app come up with random problems to be solved.

Sounds simple, right? Not so!

We couldn’t simply choose any two random words. What if there really was no possible solution?

So, we needed not only to choose random words, but also to verify for ourselves that it was actually possible to get from one word to another in only 4 steps using valid words.

recursion

We did this by using a “depth-first recursive algorithm“. That’s fancy-talk for “treat the problem as a tree, and use a simple set of checks at each ‘branch’ to find the solution”. Read the WikiPedia article for some examples.

The solution works, as can be seen in our demo. In Chrome, if you press F12 (in the demo), and choose the Console tab, you can see the word path that the app came up with as a solution. It’s in reverse order, but you can see the solution.

I’ve set some homework such that the app should be adjusted so that the player cannot input invalid words.

What language should you learn?

Zach at Codecademy <contact@codecademy.com> has written a useful post on what language is best for what —

People often ask me what programming language they should learn, and I always say the same thing: “It depends.”

Want to be more web savvy, or build a website? — start with Web Fundamentals. This covers all the basic HTML and CSS you’ll need to know to understand the web.

Want to make a game or app? — give JavaScript a try. This dynamic language will let you create interactive apps that you can use on a smartphone.

Want to process data or explore databases?Ruby or Python are your best bet.

That’s it! Like what you’re learning now? Click here to continue learning.

— Zach

phone app development – week 1

screen1Today,we started up again with the Monaghan Coder Dojo. We introduced ourselves and then asked the kids to break apart into the classes they wanted to attend.

The largest classes, as expected, were Scratch and Advanced Scratch (that one actually sounds very interesting! using Leap Motion to handle actual manual gestures, with no mouse or keyboard needed), and then there were the more advanced classes; Games Development (using Python, I think?), HTML/Web Development, and I’m teaching Phone App Development using Phonegap.

Each class had progressively less students. My own has literally one 😉

We’re holding two class sessions – the first is from now to Christmas, and then from the new year to summer. I expect there will be one or two more students in my class after Christmas.

ANYWAY

To get phone app development up and running, I’m starting off with a Word Chain game.

The first step was to build the user interface and some simple validation, which we did during the first class.

We have not needed to touch any phones yet – all the code was done either online, or locally, in web-pages using HTML, CSS and JavaScript. We’ll probably put the code onto a phone next class (in two weeks).

Here’s what we came up with during this class: Week 1