Sunday, October 26, 2008

Creative Beats

Each time I run, I listen to tunes. This combination seems to send my mind into a creative groove (no tunes I am usually thinking about what body part aches today) where it keeps coming up with ideas.

Today's run gave rise to 2 more iPhone app ideas and some TDD (test driven development) ideas for work. Needless to say, I am not short of ideas for the iPhone or any other mobile platforms but I will stick with working on the iPhone since the distribution model offers a low cost of entry to the market place.

I had one idea which requires the application to be always running in the background. This one would not work on the iPhone unless the user checked the program repeatedly. This would ruin the whole idea behind this idea. So, this is an idea that would work better on the Andriod platform.

I'll just have to write that one down for a later time. Now back to work, gotta log a couple hours this weekend.

Friday, October 17, 2008

Test Driven iPhone Development

Ok, Test Driven iPhone Development. First off, I am not doing it, yet. Do I want to? Yes. But how?

What is Test Driven Development (TDD)? Well you can go wiki it, but in general it comes down to "write tests first, write code second, when tests pass, code is done, rinse and repeat" until project is complete.

Do I have experience with TDD? Yes, I have used utlPLSQL to perform TDD during the development of a Data Warehouse PL/SQL back-end API for a php written front-end to said Data Warehouse. I've also used CppUnit after the fact on an existing code-base.

As well, I am currently working on putting CppUnit into place for a new project at work. The good, this will be for a system we will be refactoring from Ada into C++. The bad, I'll admit it, I was a bad programmer and I extended CppUnit so that I could pass a void * into the TestFixture::setUp routine (that run's before each test case) so that I could run the tests inside a client that has a lot of setup which includes the ability to override the execution loop. That execution loop is where I put the test cases, but I had to get the pointers created during setup of the app into the test code so I could use their callbacks.

Needless to say, I feel embrassed I had to extend the code with what amounts to a blank check for programmers using the "extended" CppUnit to pass whatever they want into the test code. Why is this bad? Well, Unit Testing in the vein of CppUnit is about testing individual classes. What I am doing is bastardizing CppUnit so I can perform unit testing of two seperate processes implementing a Proxy/Service pattern.

The great thing is that I can run both of these in the same executible and inject messages into the Service which then passes them to the Proxy which passes them up to a Client which uses the Proxy. By making the changes I have to CppUnit, I can now run a Client, Proxy, and Service in one process and run tests against the three of them at the same time. This makes coding the test cases easier than having to implement TCL (or my favorite, Perl Expect) scripts to try and run the Client (with Proxy) and Service in different processes and then build something on top of that which is easy for other devs to use.

So, all that to say, I love TDD, I want to use it all the time, but getting into it I find takes understanding the arena you are working in. Being a newbie to Objective-C, Cocoa, XCode, and the iPhone OS I am finding it hard to figure out how to get TDD working for my projects yet. That said, I can see how it would work for some simple classes, but for the Model View Controller (MVC) pattern, I am still thinking about that.

Prehaps I will login to Stack Overflow and ask that question. It would be a good one.

--Update (10 minutes later):
Ask and you shall receive. Stack Overflow led me to:

Hooking GUI Elements

With iPhone development you can create your GUI via hard work (ie. coding by hand) or you can do it with little effort (caveat being you need to know how to do that little effort) and some hand coding. I finally figured out the little effort part.

After lots of reading and playing with layouts and test code, I have figured out the secrets to hooking buttons with the appropriate actions. It's not straight forward, there is a little duplication of effort in the Interface Builder (the GUI layout tool) and your hand written code. But once you know how, it is quick and easy to get your GUI hooked up for user interaction.

So far my first app is coming along and I have shown it to some people. I've gotten some good user feedback which I will be trying to incorporate into the design. Nothing too hard I am sure; once I figure out how to implement those ideas.

Sunday, October 12, 2008

(YAIDB) Yet Another iPhone Development Blog

Yes, I am yet another developer who has decided to develop new apps for the iPhone. Here's where I stand currently with my work:
  • Downloaded the iPhone SDK - months ago
  • Watched the iPhone Development videos on iTunes
  • Played with some tutorials and sample code
  • Registered as an official developer with iPhone Developer Program
  • Started development of 3 programs; 1 nearing completion, 2 only in the prototype stages
  • Bought an iPod Touch for hardware testing - Yes I have my first app running on the Touch
  • Read a lot of iPhone programming and Objective-C programming documents
As I complete apps and they move out of the NDA envelope, I will post screen shots here, along with video demos of the apps.