My first computer
I promised myself to post more regularly on this blog in 2014 and after a good start, I’ve let things slide a bit recently. Laziness apart, one of the main reasons is that I’ve been busy on other projects, most notably learning to write Mac and iOS applications. “Why on earth have you been doing that?”, I hear you ask. Well if you want to know the answer, read on. However, I should warn that things are going to get a little geeky, so look away now if you are not into that kind of thing. You have been warned!
I’ve always loved programming. My first experiences, as for many others of my generation was with BASIC. In my case, it involved typing programmes into a teletype machine at school, dialling into the local council mainframe. Back in those days, “saving” your programme meant punching holes in a roll of paper tape.
Ease of use regressed further when I got my first personal computer, a Sinclair MK14. Not only did I have to assemble the machine myself, it had to be programmed in machine code, and I don’t mean assembler. I mean inputting the hexadecimal numbers that represent each instruction. Initially, there was no way to save your programmes at all – you had to type them in again after each reboot, no small task using a 20 key membrane keyboard. The only plus point was that with only 256 bytes of RAM to play with, that’s a maximum of 516 hexadecimal digits to type in.
About 6 months ago, I decided to learn Objective C – an object oriented version of C that is used by Apple to develop Mac and iOS applications. I was driven by a mixture of intellectual curiosity and a desire to be able to write real Mac and iOS applications for my own use. Specifically, to replace the 45 sheet Excel spreadsheet that I use to manage my personal finances with something easier to use and maintain (I’ve tried but never liked any of the personal finance apps available in the market).
Objective C and Apple’s Cocoa frameworks have a steep learning curve, even for someone with experience of other languages. The learning resources that I found invaluable were the books from Big Nerd Ranch, video tutorials by Simon Allardice on Lynda.com and the Q&As on Stack Overflow. However, despite this learning curve, after six months my personal finances spreadsheet has been retired. The new Mac app has advanced to the point where it does the job much better. I’m not saying that you’ll be able to buy it on the app store any time soon, since it’s definitely an app targetted at a one person niche market segment. But overall I find it quite amazing that the development tools have now advanced to a point where a hobbyist like me, coding in my spare time, can learn how to build a functional Mac application in such a relatively short space of time.
The world of technology being what it is, just as soon as I’d “finished” learning Objective C (in as much as you can ever finish learning anything), Apple duly announced at this month’s WWDC developer conference that they were replacing Objective C with a new language, Swift. Having spent a couple of weeks playing with it, including experimenting with rewriting some parts of my finances application in Swift, I can say that there is much to like about the new language. To me, it brings many of the ease of use attractions of the Python language, whilst retaining the speed advantages of a low level language built on C. It solves many of the “WTF” moments I had when learning Objective C. To give one example, to add two decimal numbers A & B together in Objective C you have to use the syntax [A decimalNumberByAdding: B]. Swift has operator overloading so even for non primitive data types like NSDecimalNumber, you can use the syntax A+B. They’ve also brought across one of the great things about Python – an interactive mode where you can type commands and get an immediate response without needing to compile and run your code first, a real benefit when learning a language.
So all in all I think Swift will make it even easier to get into Mac and iOS application development. However, just at the moment it presents some additional challenges. Swift is still in beta and you still need to learn Objective C if you want to write apps today. It will take some time for the books, training videos and online Q&As that I found so useful to catch up. It has also given me a new language to learn. It’s a good job I like learning new things!