The project preview
This repository functions as the basis of the quiz project in the Browsers module. Before the first group meeting, have a look through this code and try to understand how it works and how it is organised. We will explain the idea behind the structure below as well as the Backlog (which will identify what is needed to be implemented).
We have already implemented a very basic UI that can go through the questions to show you how this kind of code is split and how you can use the structure to your advantage. Have a look through it before your first group meeting as it can take a little while to get your head around it!
To run this project locally you will need to open index.html
in your browser using a local server. LiveServer, http-server
, study-lenses
, or any other local static server will work.
There are no dependencies needed to run the website, everything is prepared to work with vanilla JavaScript. However, if you want to install prettier for this project then run (generally you always want to do this if you see a package.json
file):
npm install
Let's run through the folders:
public
src
└── handlers
└── init
└── listeners
└── utils
└── views
└── data.js
index.html
public
this contains the static files that can be used by ourindex.html
filesrc
this contains all of our JavaScript codehandlers
this contains our functions that handle user interactions. You can also see it as the code that processes and updates the data or DOMinit
this contains our initialisation code. Generally this code should only run once and starts the applicationlisteners
this contains our code that links up our handler code to the DOM. This is separate because it is possible to have the same handler code be given to different listenersutils
this contains code that are pure functions and can be used throughout the application. These functions take data and give back a result. They should not interact with anything outside of their scope!views
this contains code to define what the DOM will look like. They will create the DOM element and give it back. They should never read from/write to the dom, that is what the handlers do.data.js
this is our data model. Anything we need to store in the browser we place inside the data file
So what should be built? Below is a collection of user stories you can choose from. Stories inside of each priority level are not necessarily in order, it's up to your group to decide how they fit into your strategy. These are also just suggestion, feel free to change them or create your own! Feel free to get creative.
these are necessary for basic usability
- A user can see one question at a time, stepping through the quiz
- A user can select an answer for each question
- A user can know which questions they got correct and incorrect (either immediately or at the end of the quiz)
- A user can see the correct answer for questions (either immediately or at the end of the quiz)
- A user can see their score at the end of the quiz
if time, add more features!
- A user can see their score update in real-time as they select answers
- A user can modify a question in the quiz
- A user has access to resources for further study on each question
- A user can "cheat" to see the correct answer, this forfeits the question
- A user can remove questions from the quiz
- A user can add questions to the quiz
- Anything else you can think of... go nuts!