RESTful client design and implementation - ppouke/PWP GitHub Wiki

Important information for Deadline 5

‼️  This chapter should be completed by Deadline 5 (see course information at Lovelace)


📑  Chapter summary In this section your group must design, implement and test a client application that uses the RESTful API implemented by you. The application MUST provide a GUI for a user to control it. If you want to implement a machine-to-machine application please contact the assistants first. If you utilize HTML and JavaScript, it is mandatory that the HTML is contained in static files. It means that your server cannot generate HTML dynamically (using PHP or JSP). All modifications made to the webpage must be done in the client side using javascript. Of course, you can use anchors () to load a new URL. Please, consider the Same Origin Policy" because it might cause problems to your client implementation. It is recommend to host the files in a local HTTP server and not directly in your file system. We will give you more instructions in Exercise 4.

It is not mandatory to write code for test the application. Client testing would be considered extra work.

CHAPTER GOALS

  • Learn how to use APIs
  • Implement a client that uses the project API


✔️     Chapter evaluation (max 15 points) You can get a maximum of 15 points after completing this section. More detailed evaluation is provided after each heading.

RESTful Client

Client application description

Overview


📑  Content that must be included in the section

You must provide a description of the application. You must clarify which are the goals of the application and why a user would like to use this application. You must also state what is the functionality provided by the RESTful API used by this application.



✔️     Evaluation criteria(max 1.0 points) You can get a maximum of 1.0 points in this section:
  • The clients purpose is clearly described: 0.5
  • Description of the API client not just a GUI: 0.5

Our client provides the means for joining and playing a game. Upon execution, the client shows the players a command line interface for joining or creating a game.Once a game is initialized, a graphical interface will popup. This interface shows a 2D representation of the board. The player can choose a block from the panel on the side of the board or flip through blocks using the scroll wheel. The player can then place that block on a valid spot on the board. The client automatically registers the placing of a block and then sends the necessary HTML requests to the server, and notifies the player if any errors are encountered. During a game, the client keeps track of whose turn it is (using periodic GET requests) and informs the player when his/her turn starts. At the end of the game the player can close the GUI and client.

The goal of this application is to allow users to play a game of Blokus with a clear visual interface, and without the need for understanding the underlying framework for enabling the game. This means that players are able to play the game without needing to manually send any HTML requests. Once in game, players also shouldn't have to use the command line for any game related actions.


Functional requirements


📑  Content that must be included in the section Provide a use case diagram of your application. For each case, specify which is the API resource/s that cover the given functionality


✔️     Evaluation criteria(max 2.0 points) You can get a maximum of 2.0 points in this section:
  • Diagram below presents the different use cases and they are correctly explained: 1.25
  • Description + diagram shows clearly what functionality of the API the client uses: 0.75

Blokus use case diagram

Case Functionality

Command Line

Show games: GameCollection (/api/games/), GET method

Create game: GameCollection (/api/games/), POST method

Join game: GameItem (/api/games/game1/), POST method

Delete game: GameItem (/api/games/game1/), DELETE method


GUI

Show available blocks: BlockCollection (/api/blocks/), GET method

Place block: TransactionItem (/api/transactions/1/), POST & PUT method

Query turn information: GameItem (/api/game/game1), GET method

Client design

GUI layout


📑  Content that must be included in the section Draw a diagram of the client layout. Students can use any software they want to do the sketching. For more professional-like design, students can use any wireframing tool available in Internet. Some of them can be found from http://webdesignledger.com/tools/13-super-useful-ui-wireframe-tools. Pencil is free, open source and easy to use. Other options are Visio and Balsamiq (you need a license). You can also create the UI using a paper and a pencil and scan the resulting drawing.

Entering the game via CLI

Client CLI

Game GUI Client GUI

✔️     Evaluation criteria(max 1.5 points) You can get a maximum of 1.5 points in this section:
  • Client layout present: 0.5
  • UI is stetically pleasant: 1.0

Screen workflow


📑  Content that must be included in the section Draw the screen workflow of your client (which are the possible screens that you can access from one specific screen?)


✔️     Evaluation criteria(max 1.0 points) You can get a maximum of 1.0 points in this section:
  • Workflow diagram available. Navigation is coherent 1.0

Due to the nature of our application, we only require 2 screens Screen workflow

Client implementation


💻     TODO: SOFTWARE TO DELIVER IN THIS SECTION The code repository must contain:
  1. The source code for the client application. 
  2. External libraries. You can also report them in the README.md if the libraries are very big or need to be installed.
  3. The code for testing the application (if it exists).
  4. We recommend to include a set of scripts to run your application and tests.
  5. A README.md file containing:
    • Dependencies (external libraries)
    • How to setup/install the client
    • How to configure and run the client
    • How to run the different tests of your client (if you have implemented unit testing)
NOTE: Your code MUST be clearly documented. For each public method/function you must provide: a short description of the method, input parameters, output parameters, exceptions (when the application can fail and how to handle such fail). Check Exercise 4 for examples on how to document the code. addition, should be clear which is the code you have implemented yourself and which is the code that you have borrowed from other sources.


✔️     Evaluation criteria(max 9.5 points) In this section you can get a maximum of 9.5 points.
  • Instructions to set up the client and run the tests are provided in the README.md file: 0.5
    • this means there should be no undocumented extra steps in running the code/tests!
  • The code has clear structure and naming for variables and methods: 1.0
  • You have clearly marked which parts of the code are your own work and which is borrowed code: 0.5
  • Client is usable and navigation is coherent (no broken links): 1.0
  • Demonstrate through a presentation or screenshots that your client fulfills the minimum requirements: 1.0
  • Client works as expected: 2.0
    • We do not find errors while using the application
  • The client uses a different API in addition to using your own API (i.e. finds additional information from somewhere else): 1.5
    • For full points the client should utilize at least two different methods from the uniform interfaces OR utilize at least 4 differents API calls.
    • For full points the functionality provided by the external API should be integrated in the client functionality and not as an incosistent addition.
  • The client is a true hypermedia client (if you are not using an hypermedia API you won't get these points): 2.0
    • this means that the client uses the hypermedia links to find URLs, uses forms from the hypermedia to form its requests, follows correctly link relations, workflow is mainly in the server, not the client... etc. If any of these aspects are not considered cannot get full points in this section.
    • The ideal client is resistant to changes in the API because it only relies on information it gets from the API in runtime

✏️ Implement your client and include a few screenshots of the final version of the client to show that meets the requirements

Resources allocation

Task Student Estimated time
Juho Kalliokoski 8h
Elmeri Uotila 8h
Sakaria Pouke 8h
⚠️ **GitHub.com Fallback** ⚠️