Archive for March, 2009

Counting Lines Of Code

Friday, March 27th, 2009

QtEver had anyone ask you if you “like” your job? I never understood the point of this question aside from being a staple of meaningless small talk. An honest answer will never be a simple “yes” or “no”. Normally my job can swing from nauseating and boring to incredibly stimulating and stressful (FYI: I write software…poorly).

Right now though (and for the last few weeks), I could honestly say my job has been cool. It’s one of those rare times when a developer gets paid to do something they have a personal passion for. Long story short, I get to play with Qt all day.

I’ve followed Qt (that’s pronounced “cute” if you’re obnoxious and “que-tee” if not) since the late 90′s. This was right around the time I first tried Redhat and KDE. I’ve never had the chance to utilize it on a real project until now, though. Given the nature of the project, I had an odd request come my way a few days ago. My boss basically asked me to get a line count of the Qt source code.

Now, any UNIX guru worth his/her salt would chuckle, crack their knuckles, and spin some regular expression and command line magic to produce the answer in seconds. I’m not one of these people, and I already had the source extracted on my XP workstation. So, I went searching for a line counter on the intertubes that would work on the Windows shell and came across this.

For anyone who’s curious, Qt 4.5 is massive. I’m guessing a lot of that bulk is due to the fact that it runs on everything under the sun. Here’s the report from numlines (along with the command options I used):

numlines /i /s C:\Qt\4.5.0\src\*.h;*.cpp > qt_count.txt
Total files: 7532
Total lines: 2,402,695
Total uncommented, non-blank lines: 1,561,824
Total semi-colons: 653,431
Total bytes: 93,440,893
Average lines: 318
Average bytes: 12,405
Report date: 27-Mar-2009 1:35:11a

My hat’s off to the devs at Trolltech (err…Nokia now I guess) for making an incredibly powerful and flexible UI framework…all 1.5 million lines of it.

The Cost Of Writing Code For The iPhone

Thursday, March 12th, 2009

iPhone

In a continuing quest for world domination, Apple made this nifty phone. You may have heard something about it (coma patients excluded). While I do believe the iPhone is overhyped to no end, I have to admit, it’s an impressive piece of hardware. Like most other embedded system developers, I started to day dream about how I would make my millions by writing the killer app for the iPhone when Apple first announced the SDK. Really, how hard could it be?

My best friend (I would link his blog here, but he’s too f’in lazy to start one) and I have now decided to drop any previous aspirations of making a desktop game and focus most of our free time on hacking some code for the iPhone SDK. Most of the encouragement came from articles about farting software and Scorched Earth clones generating six to seven figure incomes for one man dev teams. Surely, we can do better. I still have high hopes for Android as a platform, but right now, the iPhone gold rush is very much on.

I’ve just now gotten to the point where I can compile code in XCode and test it on real hardware. I thought I’d share (read: bitch about) what it took to get up and running with the iPhone SDK. Here’s a little shopping list:

  1. You need a Mac. Sorry, you need an Intel based Mac. I already had a Core Duo Macbook, so I saved myself the credit card trauma caused by new Apple hardware purchases. If you’re not yet in the Apple ecosphere (and don’t feel like messing with a Hacintosh), then the entry level price is $600 for a Mac Mini. This is assuming you have a spare LCD, keyboard, and mouse lying around.
  2. You need Leopard (OSX 10.5). I don’t quite understand this requirement. I know most devs like running bleeding edge versions of software regardless, but it seems strange to require a new OS version just to install the bloody tools. My laptop came with Tiger (OSX 10.4). I checked Apple’s website, and was surprised to find that OSX is sold only as a boxed full version…and it costs $130. While I can appreciate this compared to Microsoft’s buffet style offering of Vista, it would be nice to have an upgrade option. Turns out, there is an “upgrade” available if you don’t mind snooping around certain online auction sites and receiving discs in the mail labeled “Not For Resale”. I’ll leave that as an exercise for the reader.
  3. You need a membership. Apple requires devs to be members of the iPhone Developer Program, which will set you back $100. Well, technically this isn’t required to develop an app and test it with the simulator. But if you want to release anything to the App Store, it needs to be approved and digitally signed by Apple…which means you need to be a member. I don’t know if you can get away with self-signing a project just to test it on your own hardware, but I doubt it. Either way, eventually you’ll need to bend over and cough up the dough.
  4. You need hardware. I already signed over my soul and first born child to Verizon years ago, so I wasn’t about to eat another $75 a month for an iPhone plan. Luckily, the iPod Touch is built on the same hardware platform…and it’s much cheaper (long term, anyway). Actually, the up front hardware cost for an iPod Touch is $230 (for an 8GB), while the 8GB iPhone is $200. This makes zero sense from a hardware standpoint, because the iPhone contains additional parts for supporting GSM/EDGE, GPS, and UMTS/HSDPA (acronyms give me a headache). I realize that Apple gets a nice chunk of AT&T’s monthly fee, but it seems like they’re actually discouraging people from buying the iPod Touch by not selling it for $200 or less. If the economy has you stretched really thin, a refurbed 2nd gen iPod Touch can be had for around $180 on eBay.

All things considered, I was actually surprised how much it cost me to get set up for hacking on the iPhone. I already had a fairly new Mac, and I still had to shell out $378 just to get going. If you’ve never touched an Apple product in your life, it’ll be closer to $1000 by the time all the tax is thrown in. Hackers beware. We can all laugh about it later while shopping for new yachts (or whatever the hell it is rich people do).