A blog about hacking, but really more in a golfish sense.

Chapter3 - devPlatform

When I spoke of Ruby on Rails the other day as the 'hotsh!t dev platform of the day', I realized that it would need some clarification. So let me clarify.

Coding pretty much anything is a massive, time consuming job. That's part of the reason that computer languages have evolved from 1s and 0s to Fortran to C to C++ to Java to Ruby: if you were to try and write the Twitter website in assembly language (binary), you'd be there coding for a very long time. If you were to try and write Windows 7, you couldn't do it. Hell, they can barely do it now.

Man has devised a better way. I wrote about some of it in the Database post. He has set to automating as much of the menial, repetitive work as possible so that the developer may set his mind toward accomplishing other tasks, like the fun bits of the application. In the case of iPhone development, Apple has created an environment in which to write the apps, X Code. X Code is itself an application that runs on your Mac just like any other application. The nice thing about X Code is that Apple designed it specifically for the purposes of making applications for Macs and iPhones.

Apple computers was started years ago in a garage by two guys named Steve. They're both very famous now, Steve W perhaps slightly less so. The two guys named Steve decided that since they were both programmers and engineers, that perhaps they should hire a CEO type to help them with their rapidly growing company. CEO guy came in and moved Steve J to some kind of powerless position in the company, so he split. He started another company called NeXT. They never did anything commercially successful, but they did develop an operating system and a platform for writing applications - one that started with a fairly significant library of code already put together to make the developers job that much quicker. At some point, Apple was not doing well financially or otherwise and Microsoft came in and basically gave them a lifeline. This was in the 90s. Steve J at that point was an intensely innovative failure. Funny, huh?

Around this time Apple decided to buy NeXT computers along with the Operating System that they had developed. Steve J was brought back as an advisor for a little bit before becoming CEO within a year. The NeXT OS eventually became Mac OS X, which eventually became the iPhone OS. The point is that even though the iPhone has only been around for less than 2 years now, the developmental lead-up took decades. During that time, various developers decided that they would put together 'libraries' of code for making Macintosh applications and save themselves the time of having to rewrite all this code that's essentially "boilerplate", meaning the same in every app, there to provide low level functionality that the end user never encounters and is very rarely altered even by the developer though widely varying apps are coming out the other end. Every language that's in any kind of wide use has it's own set of libraries, there to provide standard functionality for the programmer and standard sets of instructions for the computer to execute when certain functions are called within the app.

Okay, sorry. There's a lot in there that I wouldn't have understood 9 months ago, so let me break it down for you.

When you tell X Code to start a new project, it asks you what kind of project you'd like to start. It gives you the options of a couple of different layouts of iPhone apps. Perhaps you'd care to build a navigation-based application. That's when you use buttons to navigate through different tables of data and settings. The Setting app on your (or your friends') iPhone is an example of a navigation-based app. Maybe today you'd like a tab-bar based app. This is like the iPod app on the iPhone. You have a menu of a few pages at the bottom of the screen that take you to different pages in the app. Maybe you just want a blank window because you're building a game that your crew can play in the bus between gigs. Anyway, after you decide that, it puts together the skeleton of your application with a bunch of different chunks of code that every single app is going to need to run. The developer then fills out the skeleton and a newborn baby application is brought into the world. Apple calls their development framework Cocoa, and for iPhone it's Cocoa Touch. Cocoa is just a collection of pre-compiled libraries of code lashed together to help make the dev process that much easier. Cocoa has a name, so it seems like it should be a physical thing. It's not. This has been one of the hardest parts about this process to get my head around. It's a bunch of code that someone else already wrote so that you don't have to.

Ruby on Rails is also a framework. A big part of writing Rails apps is using a command called 'script'. You call a script command to help you build these chunks of code, and the script automatically does a LOT of the tedious work for you. I love this, because I don't have nearly the experience to write something from the ground up, and that sounds like a lot of wasted time besides. Tweaking the generated code is then how the developer builds his app. Brilliant. This is what a development platform is. This is why most Mac applications have that "Mac-y" look and feel. This is why all these New-Web social networking sites have a that sorta clean, modern look and feel, and why so many of them employ Google maps as well as each other in their functionality.

Once you get your head around which platform you want to develop on (I'm thinking Rails to learn), then you can start learning your way around the API, which is where the real fun begins. I'm not there yet, but will try to remember to link there when I am.