Wednesday, April 27, 2011

Always Clean Up After Yourself....


So the networking side of the application is just about finished. I can now cycle through all of the multiple choice questions and display the question contents on the device. I can also view a list of random solutions. The past couple days I have been becoming very familiar with the profiling and analyzing tools offered in XCode. I have been using these tools to find and fix leaks and allocation problems. I have just about everything cleaned up except for one last allocation problem. Somewhere I am not releasing some of the data that I pull off of the server, so as more and more requests are sent to the server I have a slow increase in memory usage. After approximately 75-100 requests this problem becomes very relevant. So I after I find this bug I will have a pretty stable foundation to build the rest of the UI on.

This is about the half way point in the quarter, and I think I am right on schedule. Getting the networking code finished is a pretty big milestone, and with it complete I can focus more on the UI design. I am hoping to have a "testable" user interfacer created in the next two weeks. I can then take my iPad to a coffee shop and ask people to give me feedback on the design.

Here is a screen shot of what I have been working with recently:

Friday, April 15, 2011

The Goods Have Arrived


The project become much more "realistic" this week with the addition of an iPad2 to do testing on. In reality I will still be using the XCode Simulator quite frequently because a lot of the tasks don't require me to actually interact with the device. However, it will be super sweet to do UI design tests with a real iPad. Using the mouse to scroll the iPad Simulator just is not nearly as fun as it is to do with your finger.

Up to now I have just been looking at videos or blogs of iPad apps in order to get a feel for which user interfaces work and which ones don't. I have also been to the computer store on campus a couple times to try out the iPads that they have on display. Having an iPad to work with will make the process of UI testing much easier, and will hopefully enable me to figure out the type of design that I want in a much shorter time. I will also be able to let other people test drive the application, a task that could have been done with the Simulator but would have been really unintuitive for a lot of people. Collaboration on the UI design will help me examine the way people interact with the question-response interface, which could lead to very interesting results. I am predicting that it will be difficult to get people to stop answering questions and look at the solutions, or on the flip side, it will be difficult to get people to stop "flicking" through the solutions and answer a question. Either way, it will be interesting to see what happens.

My first impressions of the device are all positive. This evening I coded up some abstract image classes that I will use for all my image objects (images that go along with questions, images for the solutions, etc.). The images are all responsible for fetching themselves from the Visipedia server, so I am really starting to exercise the networking code that I have written over the past couple weeks. I wrote up a quick program that filled a UITableView with a bunch of images, and I was happy to see that the device downloaded the content quickly and appropriately, and the UI stayed responsive. An example of this table can be seen below.

Monday, April 11, 2011

More Networking

The past week has been dedicated to building the networking infrastructure on both the client and the server. For the client, I used Apple's MVCNetworking sample code as my foundation. This code provided some pretty sweet classes for handling the numerous networking tasks that must be executed in order to retrieve data from the server. I dove into the code and modified it to suit my needs.
I will have a "Network Manager" that will be used to handle all networking operations and all non-trivial cpu operations. The "Network Manager" will have several operation queues that will be used for executing the different tasks. A network queue will fire off the http requests and listen for responses, and then direct the data to where it needs to go. A cpu queue will fire off image processing tasks and any other intensive task that requires execution.

The classes that will handle the actually http request also have the ability to handle errors that may arise. I don't do anything too special other than wait a specified amount of time before sending the request again, unless the error was fatal. Since this application is really geared towards a demo, instead of customers, I am not too worried about handling all the corner cases of networking problems.

I have also created some classes to drive the "Network Manager." These classes will put operations on the "Network Manager's" operation queues, and will wait for these operations to finish. For example, when a user answers a question, a request will be sent to the Visipedia server, and a response will be sent back that dictates the next question to ask, along with any other information associated with that question (like images, text, ...). More requests will be sent out to obtain the associated information. By this time, the view on the device will have changed, and hopefully all the requests will have completed so that the images and text for the new question can be displayed. Default placeholders will be used for images that are either still downloading when the view changed, or if an error occurred.

I am actually pretty happy with my current client networking classes. The server will just use some hacked together php scripts until I have finalized the client-server protocols. This week, I will figure out what to do with all the information that I am requesting from the server. My plan is to use CoreData to store image information (such as: relevant question, image url, image thumbnail, etc...) and to use the file system to store the actual image.

Sunday, April 3, 2011

Week 1 Updates

This past week I continued the process of learning Objective-C and experimenting with iOS development. Specifically, I looked into network solutions that would enable me to easily set up code to communicate with the Visipedia server, and I looked into implementing different kinds of view controllers. I found ASIHTTPRequest, found here, to be super useful for the networking problem. After playing around with the code for a bit I was able to post requests to the server. My "QueryServer" button is the culmination of this effort:


I also dived into the Apple documentation regarding UITableView and UIPopoverController. The UITableView will enable me to present the user with a scrollable list of images that they can swipe through. These images could be answers to questions posed to the user, or they could be the images of the most probable solution to the recognition question. The UIPopoverController is a useful tool that will enable me to provide the user with more information regarding the image that they tapped on in the list of images. The image below displays an example of these uses:
During the next week I will focus mainly on server side code development. Hopefully by the end of the week I will be able to post user images and question responses to the server and retrieve questions, images, and updated probability solutions.