Midterm Interview Exam - Case 3: SITODO
SITODO (Sistem Informasi TODO List/"TODO List Information System") is a Web application that lets user to store a list of tasks they need to accomplish. The user can manage their list of tasks either through the graphical user interface (GUI) on the Web browser or Web service calls to the available endpoints.
For the interview exam, the scope of the requirements is simplified. You only required to implement REST-like API endpoints specified in Requirements section.
Requirements
Estimated reading time: 5 minutes
The Web service shall provide 2 (two) API endpoints:
-
HTTP POST /api/list
Create a new todo list containing one todo itemThe input JSON data payload must contain a single attribute named
item
that holds the name of task to be inserted into the new todo list. The output response must contain a JSON object nameddata
that holds the newly created todo list with a single item, andstatus
attribute that describes whether the request was successfully handled or not. -
HTTP POST /api/list/{id}
Store a todo item into the todo list with primary key equal toid
.The input and output description are similar to the description in the requirement for
HTTP POST /api/list
endpoint. The output, however, needs to ensure that it contains the existing and new todo items.
The output response must contain a body of JSON data regardless the status of request handling. The JSON data, at minimum, must contain:
- A
status
attribute that describes whether the request was succcessfully handled or not. The possible value is eitherOK
orFAIL
string. - A
data
attribute that contains the JSON string representation of the returned data. It may be empty/null if the backend did not find any relevant data or failed to process the request. In the case of handlingHTTP DELETE
request, thedata
must be empty.
During the interview exam, you will be asked to implement one of the feature above. To give you an idea how the Web service works and behaves, you can access the reference implementation on Heroku.
Programming Tasks
Estimated working time: 10 - 15 minutes
Turn on your camera and share your desktop screen. Ensure that the proctor (in most cases, the lecturer and sometimes the TAs) can monitor your activities during the interview exam. Imagine you are conducting a remote pair programming where the partner needs to observe your work.
Do the tasks in the Mandatory Tasks subsection. If there is some time left after you completed the Mandatory Tasks subsection, you can do the tasks in the Optional Tasks subsection.
Mandatory Tasks
We recommend you to do the mandatory tasks according to the given order. The tasks are sorted based on the required effort and the logical order to complete them.
- Get a designated feature to implement from the proctor.
- Fork the codebase template
into your personal subgroup in
AdvProg/kki-2022/student
namespace. - Clone the fork into your local development machine.
- Implement the designated feature along with the tests code, preferably by following test-driven development methodology.
- Ensure your tests verify the correctness of the main/success flow and at least one possible alternative flow (e.g. input validation error, incomplete input) of the designated feature implementation.
- Update the GitLab CI/CD configuration in the code template to make your
repository on GitLab CSUI:
- Run the test suite for each new commits pushed to the repository on GitLab CSUI.
- Save your changes as Git commit(s) and push the commit(s) to the fork repository on GitLab CSUI.
Optional Tasks
Feel free to do the tasks in any order. It is alright if some of the tasks are not completed. The discussion session may ask you to complete the unfinished tasks.
- Implement a simple, HTTP header-based authentication mechanism. For example,
all HTTP requests sent to the endpoint must contain an HTTP header named
X-AdvProg-Auth
with a designated value, e.g.TopSecretKey
. If the HTTP request contain the said header and the value match, then the request can be handled by the handler method. Otherwise, immediately return an appropriate error response.- If time permitting and you would like an extra challenge, create or refactor the tests to verify the authentication mechanism.
- Identify and clean up code smells as many as possible in the codebase.
- Update the GitLab CI/CD configuration in the code template and the project page on GitLab CSUI to make the codebase automatically deployed to Heroku.
- Update Gradle configuration, and GitLab CI/CD configuration in the code template and the project page on GitLab CSUI to make the codebase automatically scanned by SonarScanner and sent the analysis result to SonarQube CSUI.
Discussion
Estimated discussion time: 5 - 10 minutes
The list of possible topics during the discussion is as follows:
-
Development workflow (Git, IDE)
Examples: How do you use Git when working on your course work?; How to merge a branch into another branch?; How do you resolve a merge conflict?
-
Writing and running test
Examples: How do you design the test cases to test a piece of code?; How to measure line coverage?
-
Concurrency
Examples: How to prevent a race condition in implementation level or architectural level?; Describe one example of serialisation technique employed in a programming language/framework of your choice
-
Deployment workflow (GitLab CI/CD, Heroku)
Examples: Describe one or more elements commonly found in a
.gitlab-ci.yml
file; Show how to deploy a codebase to Heroku using Heroku CLI -
Code quality (SonarQube, SonarScanner)
Examples: Mention some code smells that you have encountered throughout this course; What is the responsibility of SonarQube and SonarScanner?
It is also possible that the proctor will ask questions that are not listed above.
Hints
- As mentioned in the requirements, you do not have to set up a database. The most straightforward approach is to use a class from the collection package in Java standard library.
- If you are using Spring Boot, you only need Spring Web in the project dependencies. Do not make the project more complex by adding other dependencies such as Spring Data REST or database connection drivers.
- You already have a collection of code examples that you can adapt to solve this problem. Hence, we do not recommend you to search for tutorials or code snippets through a search engine. You may do so, but we think it is better to spend your time in coding and reuse the available resources. In addition, it is easier to describe and to reason with the code that you wrote by yourself.
Created: 2022-07-08 18:14:47