Onward with our multi-component Project!
Last week we decided on an overall purpose for our project. We will create a Web service and several different Clients to consume the service. Today, we will break into our teams to work on development of these components.
- Review discuss overall project plan: role of Web Service and what each client component will do
- Goals: set up your development environment; decide on pairs to work together on the coding; use a tutorial to develop a sample to familiarize yourselves with the use of the IDE (Integrated Development Environment) and learn a bit about the language
Web Service Team:
- Get started developing the Web Service in C# using Visual Studio 2017 Community Edition
- Visual Studio Community Edition 2017 free versions for Windows or MacOS
- This is a nice tutorial for getting started with a sample Web Service and has versions for Mac and for Windows: Create a Web API Windows version Create a Web API MacOS version
- We will only be using the GET Request for our project, so you can focus on that when going through the above tutorial
- Look at the sample POC (Proof of Concept) code from Robin’s GitHub for a Web Service calling the existing Weather Service and for the console app that calls the new Web Service. See the Web Services channel in Slack
- Decide on what the REQUEST from the Client needs to look like and what your Web Service RESPONSE will look like. What is the JSON object structure?
Swift IOS Team:
- Get started developing an app in XCODE using the Swift programming language that will consume the Web Service, i.e. send it a REQUEST and process the RESPONSE
- XCode: Install XCode version 9 from the App Store; it may also require you to update your operating system. This can be a very slow process as we saw last week, so if your machine isn’t set up yet, we will just share the Macs that are ready and get the others started with the installation.
- Get Sample Chapters of Book: Coding iPhone Apps for Kids: This is a very nice book for learning Swift. Try the free sample chapters! You can get the free sample from Amazon (Chapter 1 and part of Chapter 2) and you can get Chapter 3 for free from the Book’s Web Site at NoStarch Press:
- Create a simple Hello World project to get familiar with the IDE; we can use the example in Chapter 1 of the book for this
- Run your sample code on your phone!: Attach your iPhone or iPad to your development Mac using the USB cable while running your project in XCode. Chapter 1 of the book explains how to do this. One additional thing that may crop up that is not in the book is that you may get a message like this when you try to run the app “Codesign wants to access key ‘access’ in your keychain”. If this appears, you need to enter your Mac login id (not your Apple id).
- For more practice and help using the XCode IDE and Swift, Apple has a good Swift Tutorial from Apple Developer Site
- Design your UI (User Interface): decide what types of “widgets” should be on the screen. Should there be more than 1 screen?
- Start building the initial iteration of the UI by adding elements to the story board
Other Teams?:
- Last week we also discussed building additional Clients, including:
- Web Page with JavaScript to call the Web Service
- AppInventor: Web-based IDE with coding blocks for Android devices
- C# Console Application: simple application build in Visual Studio to call the Web Service and display a result
- If anyone wants to work on one of those teams we will help you get started. Or we can circle back to those in a couple of weeks….
Web Service Overview:
In Client/Server architecture, the Web Service is the Server and the Clients can be one or more applications(Web sites, mobile app, console app, etc.) that send an HTTP REQUEST to the Web Service and receive an HTTP RESPONSE back from the Web Server. The Web Service provides an API (Application Programming Interface to receive the REQUESTS from a Client. The Client software must know the specifications for formatting and submitting the REQUEST. The Client software must parse the RESPONSE from the API call to get the data into a format that the Client can use. Our Web Service will return the data in JSON (JavaScript Object Notation).
More Resources:
Check out this tutorial for more on JSON: W3C Schools JSON
Sample Code for various types of Clients calling the Weather Underground Service: Wunderground API Call Samples
Visual Studio C# Example of a Web API Client: Calling a Web API from a .NET Client