Debtor version 1.2 now available!

Debtor 1.2
Debtor version 1.2 has been approved for sale in the iTunes App Store. This version adds a compare feature. Compare the current monthly payment to any number of other payment scenarios, or compare the current number of months to any number of months. Debtor will show how much money can be saved by paying more per month, or paying off a debt in fewer months. Conversely, it will also show how much extra money will be owed by paying less per month, or paying off a debt in more months.

Numerous bug fixes are also included in this update.

Advertisements

The Art of Programming Without Programming

As I have been working on Debtor, my iOS app, I’ve come to realize that half of the work of programming is done away from the computer.

It’s a cycle, and it goes like this:

I spend many minutes, perhaps hours, coding and reviewing API documentation to build my application. I get stuck on a certain problem, and all the documentation, googling, and fiddling around in the code is not going to solve the issue. I need to stop and THINK.

So I step away from the computer, and go do something else.

While I am away, my programming problem is still there in the back of my mind, and if I’m not actively engaged in some other activity, I will go back and think of different ways I could possibly solve it. Meanwhile I’m in the shower, walking up the stairs, driving in my car, whatever. And then all of a sudden, a solution will come to me.

I can’t wait to get back to my computer to try out my proposed solution. Often times it is the correct solution, and I just needed time to process the problem in my mind before I could find a solution.

So if you find yourself stuck on an issue with your code, and you don’t know how to solve it, just walk away, find something else to do, and your brain will continue to process your problem, and solve it for you while you go about your daily business.

Concrete example:

Problem: I have a tableView with a textField inside each cell. I need to find a way to update the data source for my table with the data entered in the textField. How does the textField know which cell it is in? Do I have to keep a separate array around to keep track of the textFields? Should I just loop through the tableView cells when I really need the data later, or should I capture the data as the user enters it?

Solution: Go take a shower. In the shower, I remembered that each view can get an array of subviews, so there must be a way to get a superview of each view as well!

UIView * parentView = textField.superview;

This gets the parent view of the textField. Then cast the UIView to a UITableViewCell, which I know it is, because that is the only thing that has a textField in my class. The text field delegate method

-(void)textFieldDidEndEditing:(UITextField *)textField

is the perfect place to get the textField’s superview, because at that point the user is done editing the textField. I can grab the text in the textField at that time, and update the proper array element in the table’s data source. But then how do I get the array index that I need to update? From the UITableViewCell, which is the superview of the textField, I can get the index path from the table view by sending it the indexPathForCell:(UITableViewCell *)cell message. From the index path, I can get the row, and send the data source array the objectAtIndex:[indexPath row] message to get the correct entry in my data source array. Then I just update the data source with the textField.text, and my data and view are in sync!

Introducing Debtor for iOS!

Debtor on an iPhoneMy first iOS app, Debtor, is now available for free on the App Store! At this time it’s for iPhone only. View it in iTunes here.

I came up with the idea for Debtor when I was working on my household budget, and I wanted to calculate how much money I should set aside for credit card bills. The goal is always to pay them off as soon as possible- but how much can I save by paying them off sooner, and how much money does it really cost to pay off a balance of, for example, $5000? With an APR of 11%, and a monthly payment of $300, Debtor will calculate that you will pay $460.65 in interest, for a total of $5460.65.

This is just the beginning, version 1.0. I am currently working on an update, which will add features and fix bugs, so keep an eye out for that in the coming weeks.