Mobile App Development – Much Easier Than You Think

mobiledev

Are you one of these people who loves all the different apps on your phone, and thinks, “I wish I could write apps – and maybe make some money!” Maybe this thought enters your mind every few months, and you set a To Do reminder to look into it,… but you never seem to get round to it. Or maybe you did get round to it, and had a look at a few websites, but quickly got scared? Don’t worry – if you’d still like to get into it, but don’t quite know how I’ll impart some of my experiences, and who knows? It might spur you into action!

Ok, I’m still reading…

When I said “Mobile App Development – Much Easier Than You Think”, please note I didn’t actually say “Mobile App Development – It’ll Only Take You A Couple Of Days To Become An Expert” – because it won’t. In fact even today, after many, many years of developing software, I’m still learning how to code! Don’t panic though – keep reading – that is a good thing – it totally levels the playing field. If that wasn’t the case, then to get to (say) my level you’d have to invest years and years of your life too. But actually, because technology is always changing, improving, a lot of what I’ve learned over those many, many years is today utterly obsolete – I kid you not! That means even if you have no programming experience you can take a huge short cut to becoming as proficient as most developers. So, whilst you’re still going to have to put a fair amount of effort in, it’s nowhere near as much as think.

So what makes a good mobile app developer? And more importantly, have you got those skills? Well, if I could breakdown the kind of expertise you’d need to acquire to write mobile apps I reckon it comes down to these three things:

  1. How to think logically, procedurally and in terms of objects that are things, have things and can do things.
  2. The basic syntax of a suitable programming language for writing apps.
  3. The names of and how to use all the library functions that the programming language provides to make your app do the stuff you want it to.

And, er, that’s pretty much it. And I think you’ll find out shortly that all three are achievable to you without too much effort.

Let’s look at each in turn:

How to think logically, procedurally and in terms of objects that are things, have things and can do things

Maybe you’ve already had some experience in life writing computer programs, but keep reading as it’s all about objects these days, and early programming languages couldn’t handle that concept. Just skip the parts you already know…

Computer programming languages are essentially a way for a human (hopefully soon, you!) to tell a computer what things you would like it to do, what order you would like those things to be done, and perhaps some conditions under which some of things might not be done. Any computer language provides different types of data structure, starting with basic variables – essentially memory storage of numbers, text strings etc. by reference. Here are some examples:

var apples = 5
var oranges = 7
var firstName = "John"
var lastName = "Doe"
var sex = "male"
var wearsGlasses = true
var hasPassedDrivingTest = true

The var keyword means you are about to assign a value to a new variable name, which you will reference later on in your program. Normally, when you assign a name to a variable, it is lowercase, but to make code more readable, you may need for than one word. To do this, simply stick all the words together and make the first letter of the subsequent words uppercase, like this: “myNewIncrediblySelfExplantoryVariableName“. The more information in the name, the more readable your code will be to another person.

Once you have a bunch of variables, you can start manipulating them. Let’s start with numbers – we can add two numbers together like this:

var applesPlusOranges = apples + oranges

Pretty straight-forward stuff, eh? The answer here would be 12. You can also add strings, like this:

var fullName = firstName + lastName

Because the variables here are test strings not numbers, the computer will know to concatenate the two strings together to get “JohnDoe”. Hmmm, not quite right, so we’ll need to debug our code by adding a space between the first and last name, like this:

var space = " "    // This is needed to create a gap!
var FullName = firstName + space + lastName

Now the result is “John Doe” – all good. You’ve just fixed your first bug. Get used to this, because your code will likely have loads of bugs, and you’ll need to think like a computer to solve them – computers will do exactly what you tell it, and nothing else – and this, whilst logical, will infuriate you at times, because it’s not how we work as humans!

But what’s with the “// This is needed to create a gap!“? Won’t that confuse the computer? The good news is no, because its actually a comment. If the computer sees “//” it simply ignores that and the rest of that line. You’ll eventually find out that the more comments you have in your code, the more your code will make sense when you come back to it years later!

You can already see the beginnings of procedure, essentially the order in which program instructions are to be carried out. The computer will start at the top and execute each line of code in turn until it gets to the end of the program. We can modify this behaviour using conditional instructions, like this example:

if wearsGlasses is true
  var fact = fullName + " wears glasses."
else
  var fact = fullName + " does not wear glasses."

Here, depending on the value of a particular variable we can execute one statement or another. Notice that we’ve been clever here and added the space required after the name in each of the two text strings.

Ok, so far so good. We can step up a level now and look at grouping lines of code together and give that grouping a name, called a function, like this:

function wearsGlassesAndCanDrive()
{
  if wearsGlasses is true and hasPassedDrivingTest is true
    return true
  else
    return false
}

The “{” and “}” indicate to the computer everything inside that function, and a function typically returns some kind of value (it doesn’t have to though). So now we can simply call the function any time we want:

if wearsGlassesAndCanDrive()
  var fact = fullName + " wears glasses."
else
  var fact = fullName + " does not wear glasses."

In essence, functions allow you to structure your code in a meaningful way, particularly for operations that you think you’ll use over and over again.

Ok, we could go on, but I hope that in just the minute or two it took you to get here you’re now thinking, this is pretty easy stuff. Let’s finish our mini-tutorial then and talk about objects:

In life everything is objects, and objects are things, sometimes they have things, and generally they can do things. Take cars, for example. They are things like a make, model and colour. They have things like a built-in Sat Nav or air-conditioning. And they can do things like move around. Modern computer languages allow you define a class, which incorporates everything about a particular object, like this:

class Car
{
  var make = ""
  var model = ""
  var colour = ""
  var horsePower = 0
  var hasSatNav = false
  var hasAirConditioning = false
  var currentLocation = "Dealership"
  var previousLocation = ""

  function moveCarTo(var newLocation)
  {
    previousLocation = currentLocation
    currentLocation = newLocation
  }

  var chipTheEngine()
  {
    horsePower = horsePower + 100
  }
}

Ok, the variables we have created seem sensible – but look, this class has functions inside too – that’s starting to get powerful – because these functions relate only to this object.

Ok, let’s try to use this new car class in a meaningful way. Perhaps we want to write a  computer program that allows the user to build and maintain a list of all the cars they’ve ever owned. We start like this:

var myFirstEverCar = Car()

Ok, straight away, this variable is not like the others – it’s not just a simple number or test string any more – it’s an entire class! How can we use this new variable then? Easy – like this:

myFirstEverCar.make = "Mini"
myFirstEverCar.model = "Cooper"
myFirstEverCar.colour = "A pretty horrid shade of green"
myFirstEverCar.horsePower = 100
myFirstEverCar.hasSatNav = false // Are you joking??
myFirstEverCar.moveCarTo("StreetNextToMyFlat")
var myCurrentCar = Car()
myCurrentCar.make = "Aston Martin"
myCurrentCar.model = "DB10"
myCurrentCar.colour = "Silver Lightning"
myCurrentCar.horsePower = 425
myCurrentCar.chipTheEngine()
myCurrentCar.hasSatNav = true
myCurrentCar.moveCarTo("My lengthy driveway")

I think without me saying too much, you’re beginning to see how objects work. Let’s make a list of our cars:

var allMyCars = array()
allMyCars.add(myFirstEverCar)
allMyCars.add(myCurrentCar)

Computer programming languages also allow lists (called arrays) of particular types of variable – in this case were creating a list of cars, then adding our two cars to that list. But once they’re in the list how do we get the information out? Easy, like this:

var index = 0
var checkColour = allMycars[index].colour
index = index + 1
var checkHorsePower = allMycars[index].horsePower

Can you figure out what the results would be, just by looking at the code?

Ok, enough of our mini programming tutorial then – I’m hoping that you’re already seeing that thinking logically, procedurally and in terms of objects that are things, have things and can do things is actually pretty straight-forward. If that’s the case then you’re already a third of the way there to becoming a half-decent mobile app developer. Really? Yup.

Let’s see how you get on with the next third…

The basic syntax of a suitable programming language for writing apps.

So, here you’re going to have to think about what mobile platform you’re going to start working with. There are essentially two platforms to choose from if you want maximum coverage; Android and iOS. Hmmm… let’s stop for a moment. Is that really true? What about Microsoft, Blackberry etc. Well, of course there are other platforms outside of Android and iOS, but take a look at this:

 

pie2

The market is currently dominated by Android and iOS, and if anything Android’s share of the market is growing year on year – it might even reach 60% in 2016. You might think it’s a foregone conclusion then that you should pick Android, but wait… there’s more too it than that. If your ambition is to make money then in my experience Android is not the way to go. I’ve developed on both Android and iOS, and revenues from Android were only ever 10% of iOS. Why is that? Well, it could be because iOS users typically already have credit cards applied against their iTunes accounts, which makes it easy for them to buy (your app is just a single tap away). On Android it’s not the same. That means if a user is interested to buy your app, if they don’t already have a credit card associated with their Google Play account then you’re app is going to have to be something pretty special to make they add a card. Hmmm, unless you’ve written the next Halo app then that’s a tall order!

Another problem with Android is that is that there are literally thousands of Android devices in the market, all different shapes and sizes, and you’re going to have to work hard to make sure your app works perfectly on them all. And if there’s another thing I’ve learned with mobile app development is that your customers will not hesitate to leave you bad reviews if your app (which works great on Samsung Galaxy) does not work properly on their own particularly obscure Android device.

Contrast this with iOS where there are relatively few device types to support, and your prospective customers already have the means to buy your app with one tap.

Have I put you off Android yet? Sorry. But if you’re out to make money and it’s your first app, then you should choose your platform wisely.

But what if you want to have your cake and eat it? – you want access to all the mobile platforms in one go? Well, you can! You can use one of these cross-platform developer tools:

X_Mobile_FrameworksPlatforms1

The idea is simple – you write using their own language, and it automatically translates what you write into the various platforms. Sounds great eh? But there are some drawbacks:

  • The concept seems sound, but the reality is never as clean – your look and feel will still vary across platforms, so much so that you’ll tear your hair out
  • There is usually a licence fee to pay
  • Your app is limited to the common denominator of what all the platforms support, so if one platform has a super-duper capability (say fingerprint reading) that is not available on some of the other platforms then you can’t easily use it
  • If they go out of business you’re stuck

More on the pros and cons of cross platform support here. I would say that if your app has a relatively simple user interface, and uses widely available mobile phone features (phonebook, location etc.) then one of the above cross-platform tools could work for you.

But… let’s get real for a moment – if its money you want then go where the money is, and you may conclude (as I did the hard way) that the money is actually in iOS. And if you get rich with iOS you can always re-invest that cash into other platforms… But let’s get rich first, yeah?

Ok, I’ll let you into a little secret – if you pick iOS as your platform then a great language to use is Swift. And because it’s a totally brand new language – one which I’ve only been using for a few months now – it would only take you a short amount of time to know how much I know about it. Yes, I may know lots of other programming languages, like C, C++, Java, but those languages (which the exception of Java) are all-but-dead today.

So, if you choose Swift then just just need to learn the syntax (i.e. how to write in Swift – what keywords and symbols to use. That should not take you too long in fact, and Apple provides a Swift Playground so you can start writing code straight away, experimenting with things as much as you want without causing real-world armageddon. You can get started with this right away – just search “swift playground” or try this one I found here.

Ok, hopefully after a few hours effort you’ll be reasonably proficient in the basic Swift syntax, and then you’ll be almost ready to create your first app.

The final third then… Shall we?

The names of and how to use all the library functions that the programming language provides to make your app do the stuff you want it to

Whichever language you pick you will never ever ever learn all of the available library functions, like how to display data on the screen, or find out your current GPS location… But fear not… You don’t have to: Google is your friend.

I really mean that. No matter what you want to do, someone has likely done that before you. Just google the thing you want to do and see what results you get. More often than not you’ll actually get the Swift code you need to do it – just copy and paste in, then customise it for your needs. Here’s an example:

I googled “get the current time swift(notice add the word swift to limit the results to what I want) and I got this code in the first result:

var date = NSDate()
var hour = date.hour

Easy.

Final Thoughts on This, my First Post

Crikey, you’re still reading? This good. Maybe I’m being of some help already then. Ok, I think that should do it for this first post then. The next one will be looking at the issue of what kind of app to write and how to prepare for it, and following that, I’ll share my thought processes around the development of my first app, Peak Scanner.

ps2_screen1_iPhone47

Keep Reading

If you want to keep reading here is the next article in the series:

Part 2: Targeting The Right First App to Develop