Week 08

03-18-2015

Documentation
APIs

Introduction

This week, I’ll be sending you individual feedback on your mockups. After this week, you’ll have all the PHP and MySQL knowledge you’ll need. We have gone through most of our video tutorials for the semester. For the remainder of the semester, we’ll have one-on-one meetings (as needed) for progress checks, with relatively light readings online. You will be spending most your time working on Project Two and Project Three.

Documenting Your Process

Documenting how you got from A to Z is an important part of interaction design projects. Documentation takes many forms. It might be formal technical documentation that allows someone to pick up the project after leave. It might mean a set of formal design guidelines. It might be simply the archived list of completed tasks. As we enter the final phase of Project Two, I’d like you to begin documenting your process. One way I have documented the process is using comments in the code (PHP) using /* comments go here */ at the top of the program. I have also written out the functionality of the program in english before coding it using //comments. Try either of these methods as you work on this project.

Development

What's an API? http://www.quora.com/APIs/In-baby-language-or-laymans-terms-what-is-an-API

Now, for the most part, there are two common types of APIs, device-specific and service-oriented. Device-specific APIs come in two flavors:

  1. ways for you to get information from a device without needing to know HOW it gets that information
  2. ways for you to store or display information on a device without needing to know how it does it

An example of the first device-specific API type is location services. Different devices determine your geolocation in different ways. My phone uses a GPS. My laptop triangulates based on wireless networks it’s picking up. But, as a developer, I don’t care how it’s finding out where I am. I’m simply saying “find where I am” and it responds with longitude/latitude coordinates. An example of the second is HTML5’s support for drawing vector graphics in the browser. Different browsers on different platforms might technically be doing different things to draw a line from point A to B. However, as a developer, I don’t care how it’s doing that, I just know what I need to tell it to make it happen.

Service-oriented APIs are a little easier to understand. Some web-based services really rely on users to generate content. In order to encourage that, they often make it possible for folks outside of the company to use their resources in order to drive content creation. An example is a service like Yelp (if you don’t know what Yelp.com is, go check it out really quick), Twitter and Rotten Tomatoes. Having user-generated content is key to the survival of these services. So, rather than force everyone to use their website or their app, they open up their services to outside developers. These outside developers can then use these services however they want to. Twitter caused a pretty big outrage when they changed the rules of their API after a thriving development community had built up around them. Here’s a post from the weeks following the announcement that sums up what went down:

http://www.marco.org/2012/08/16/twitter-api-changes

While the drama over Twitter shows that it’s risky to base your business on APIs controlled by someone else, APIs are an incredibly powerful tool. If you can get the hang of working with them, they’re insanely useful in a variety of domains. In Artie's information and data visualization course, a handful of students who have taken 422 or who have self-taught APIs are building incredible things by simple use of APIs.

As the problem statement states, you’ll need to incorporate at least on API in Project Two. That might just be JavaScript’s location API. Or, it might be a service-based API. Watch the following video where I walk you through how to use JavaScript’s location API and combine it with Yelp to build a small tool that displays restaurants near your current location. All of my source files for the project are available below (after the video).

Location and Yelp API (watch this video)

No need to turn any exercises in this week. However, it would be foolish not to play around with this stuff and get familiar with it before you get too deep into Project Two.

yelp.zip

sampleYelpResults.js

Now for some bonus material from Kirk. The following videos were created to help you with Project Two and Project Three. I also wanted to give you a some more tips on how I program in PHP (PHP require and substring fun). I have also received some questions about relational databases. This class was designed to address I/O (inputting and outputting data into/from a database) but the class generally only deals with one table at a time. The "Relational Databases" will show you how to create multiple tables and query those tables. The video is somewhat long (sorry) and it takes a deeper look at databases. I will also give you my code (BonusMaterial.zip) so you can play around with it as well.

Using MAMP with Other Devices (watch this video)
PHP Require and Substring Fun (watch this video)
Relational Databases (watch this video)

Now for my code that was discussed in the videos:

BonusMaterial.zip

Assignment

:-)