Lecture 19 - Authentication


Lecture 18 - REST Frameworks and Services

Lecture Date: Wednesday, October 10

A web application that is RESTful:

  • Is bookmarkable (in general)
  • Has "good looking" URLs
  • Has a good data model behind it
  • Often has a good external API
  • Fully takes advantage of the Internet's asynchronous nature

Check out the Postman tool for connecting to RESTful APIs.

Postman - https://www.getpostman.com/postman

Imagine a software system made up only of various web applications, linked together through various RESTful calls. Crazy, you say?! Of course not! That's a service-oriented architecture!

UVA does this! Check out http://devhub.virginia.edu/.

Slides - REST

Slides - SOA

Flight REST PHP Framework - http://flightphp.com/

CakePHP PHP Framework - http://cakephp.org

Node.js JavaScript Framework - https://nodejs.org/en/

Firebase Cloud DB Service - https://firebase.google.com/

Amazon AWS Mobile Hub - https://aws.amazon.com/mobile/

more ...

Lecture 17 - REST Activity

Lecture Date: Friday, October 5

Prof. Sherriff is out of town today, so here is what you'll work on today (and next week, if needed):

  1. Pick your platform: iOS or Android. (Ideally, you'll choose the platform you're planning on using for the final project.)
  2. Sign up for an API key to use UVA's building info REST web service here: https://devhub.virginia.edu/API
  3. On your platform of choice, build a VERY simple app that will allow a user to make a basic request to the buildings API to look up info about a building at UVA. You do NOT have to provide an interface for EVERY option in the API, but you are welcome to expand upon the basic request outlined here.
  4. The app should have an EditText / UITextField that allows a user to type in the building name and a button that initiates the search. The info should be displayed in the app somehow (i.e. not to the console through Log.d or print()), but it's up to you how you want to do this.
  5. Your app does not have to be fancy in any way, but please make it "neat and clean..." I would prefer not to grade sloppy looking apps.
  6. Accept this GitHub Classroom assignment and make sure your final version is pushed by class time on Friday, October 12: https://classroom.github.com/a/ZqUvPkKL
  7. Note that this is an individual assignment.

Android

I highly suggest using Retrofit (https://square.github.io/retrofit/) to make your calls. Using native Java is pretty painful in my experience. There are other libraries that do this, but Retrofit is the one I see used the most.

Check out their GitHub repo for some samples (https://github.com/square/retrofit) along with whatever else you can Google. Note that to add Retrofit to your build path, you'll need to add implementation 'com.squareup.retrofit2:retrofit:2.4.0' to your Gradle build file along with the other implementation lines.

iOS

I would suggest just using the built-in Swift libraries, as they are relatively straightforward, but you can use other libraries if you like. Chapter 5.5 in the Swift book outlines exactly how to do this. This Xcode Playground shows you how you could make a JSON REST call against iTunes - the concept is the same: http://cs4720.cs.virginia.edu/resources/iTunesSearch.playground

more ...

Lecture 16 - REST

Lecture Date: Wednesday, October 3

Today we're going to start discussing REST - Representation State Transfer - a software architectural style for distributed hypermedia systems, such as the web.

The main principles of REST are the following:

  • Stateless Client/Server Protocol: Each message contains all the information needed by a receiver to understand and/or process it. This constraint attempts to "keep things simple" and avoid needless complexity.
  • Idempotency: you get the same result from the same action
  • A set of uniquely addressable resources enabled by a universal syntax for resource identification; "Everything is a Resource" in a RESTful system
  • A set of well-defined operations that can be applied to all resources; In the context of HTTP, the primary methods are POST, GET, PUT, and DELETE, similar (but not exactly) to the database world's notion of CRUD (Create, Read, Update, Delete).
  • The use of hypermedia both for application information and state transitions. Resources are typically stored in a structured data format that supports hypermedia links, such as HTML or XML

Let's look at how SIS works - it's command based. You do a command and the system responds. The system is built around verbs. In a RESTful system, the design emphasis is around nouns and resources - what their representation is and how they are affected by the standard methods. In REST, we assume four basic operations - Retrieve, Remove, Create, Update. Very much like Get, Delete, Post, and Put from HTTP and Select, Insert, Update, Delete from SQL.

For example, you could create an XML or JSON representation of an object that is then retrieved and modified by clients via the standard methods. Using HTTP commands, the XML or JSON could be retrieved with GET, modified, PUT back on the server.

A web application that is RESTful:

  • Is bookmarkable (in general)
  • Has "good looking" URLs
  • Has a good data model behind it
  • Often has a good external API
  • Fully takes advantage of the Internet's asynchronous nature

We will first look at more examples on RESTful websites that you have found. Check out the Postman tool for connecting to RESTful APIs.

Postman - https://www.getpostman.com/postman

Imagine a software system made up only of various web applications, linked together through various RESTful calls. Crazy, you say?! Of course not! That's a service-oriented architecture!

UVA does this! Check out http://devhub.virginia.edu/.

Slides - REST

Slides - SOA

more ...



Lecture 13 - iOS Practice

Lecture Date: Wednesday, September 26

Continuing to work on our iOS examples today!

Here are some major points we will look at:

  • Dismissing the keyboard
  • Segues
  • Unwinding a Segue
  • Adding assets/images
  • Setting up your app icon (http://www.appicon.build/)
  • Device status

Apple Example: FavoriteBook: http://cs4720.cs.virginia.edu/resources/FavoriteBook.zip

Device Status on GitHub: https://github.com/marksherriff/iOS-device-status.git

more ...


Lecture 11 - iOS Lab

Lecture Date: Friday, September 21

Lab assignment today!

The lab can be found here: https://github.com/marksherriff/iOS-lab-stopwatch

You are allowed to work with someone this week on the lab if you need to work together on someone's Mac. However, this lab is intended to make you start considering how you are going to do your iOS Mini-App. You can:

  • Own a Mac
  • Work with someone that owns a Mac (and only use their machine)
  • Spend a few bucks to use https://www.macincloud.com/
  • Use the machines in the library
  • Check out one of a limited number of Mac Minis from Prof. Sherriff (you have to provide your own monitor, keyboard, and mouse)

The lab is due before class on Monday, September 24.

No Audio Today

more ...

Lecture 10 - Intro to Xcode

Lecture Date: Wednesday, September 19

Today we are going to build a simple app together, looking at how to navigate the ins and outs of Xcode.

Here are some major points we will look at:

  • Adding a developer account
  • Using the Interface Builder
  • Adding more screens
  • Using a Navigation Controller
  • Segues

Some good tutorials to look at:

Also, definitely read the info in the provided Swift textbook! https://itunes.apple.com/us/book/app-development-with-swift/id1219117996?mt=11

Slides - iOS App Architecture

LectureTest on Github: https://github.com/marksherriff/LectureTest-iOS.git

Note Taker on Github: https://github.com/marksherriff/NoteTaker-iOS.git

more ...