Skip to the content.

Binary Teaching Development Blogs

A small blog that goes over questions and the process for creaitng the Binary website

Intro Requests for Review

Purpose of the Team’s Program

The purpose of the website we are developing is to teach people how to understand binary in fun ways, such as with review games. We also have quizzes that teachers will be able to change and edit along with comments and the ability to create posts in order to discuss and work with others. The website will be a hub of activity for those who want to improve their skills with binary.

Purpose of My Feature

I created comments for students to be able o collude and discuss concepts wwuth each other. Furthermore, it allows teachers to leave comments on a students work and how they did, along with how to improve and fix their work.


Input and Output Requests

Postman Error Responeses

Postman can recieve and process API requests and shows responses that follow RESTful practices. You can set what kind of method to send along with the body and URL within Postman, allowing for easy understanding of the content of the API

db Features

I have all the db features working so that we can restore, initialize and backup data. It shows data recovery, and tester data creation.


List Requests

How I Processed Response Data

I took the data responses from the API which returns the data in JSON form and processed it as. This is due to the fact that JSON data is easy to use and reference for something like a comments section. Since the data is saved as {“title”: title, “content”: content, “post_id”: post_id}. I would simply use the .forEach function to go through each JSON item and then would create a comment by checking the title and decsription and creating two <\p> elements, and set their innerHTML to the response[“title”] and response[“content”]

Queries From Database

We use SQLachemy in order to manage our database. By using it we can use queries and filter’s to search the database for the data we are looking for specifically.

Methods Used In A Class

For saving and processing the rows in the database, and therefore the data, we decided to follow the CRUD methodology. We had a class that had all the information defined in it from initalization and then had methods within the class that would be able to interact with the information. This made it so that all we had to do was call the class using a query or filter for it, then we could call the method after it. (ie. exampleClass.read(), or exampleClass.delete()) This allowed for easy control of the data in the database.


Algorithmic Code Request

The API Class

In order to easily interact with the model, we created an class called an API. This class is the one that interacts with all the server’s HTTPS requests, such as GET, POST, PUT, and DELETE. This allows us to easily process data and respond with it. This is sometimes necessary as a model may want a user’s id, but it can be difficult or annoying to include this information. Since we already know the current user’s id from when they logged in we can just send the data we already have on the backend rather than sending it with the body for the HTTPS request.

Methods with Sequencing, Selection, and Iteration.

One of the methods that often need Iteration is the GET statement. For my comments API I needed to first create a sequence that would filter or select the data that matched a certain postID. Then I would iterate over every single one of those pieces of data combining it into one large JSON file. We would then return this JSON file and the frontend would re-iterate over each part of this JSON body and create the page using the data stored within, typically with the .forEach() method.

What is the Parameter and Return?

The parameter is the body of the HTTPS request. It’s basically the data being sent with the HTTPS request, typically to be processed in the backend to find a set of parameters. It can also be used to create a new piece of data as the inputs for the initalization of a model class. The return part of the method sends a packet back to the frontend that it can read to give a response, typically this is a confirmation. However for GET’s this is actually the data that we are trying to call stored in JSON format.


Call to Algorithm Request

Fetch Methods

In order to fetch the data stored in the database we use a fetch statement. For fetches we state the URL from which we which to fetch and the parameters we’re fetching with. Generally this is the method we plan to use such as GET or POST and a body, which is used to check the data. By sending this fetch we send a message to the API interacting with one of the methods in the API class that corresponds to the method we called in the fetch.

Return/Reponse and How We Handle the Data

What is returned from the server is the data that methods in the API are returning, then we take this data and process it on the frontend. I personally manipulate the data within the API before returning it and therefore on the frontend I only have to take what is returned and use DOM to manipulate the page and display the data. For GET I return all the comment that currently exist, for POST we create a new class, for PUT we change currently existing data, and DELETE delete’s currently existing data.

How Does Changing Data or Method Trigger Different Responses?

In normal conditions the data sent to the server in the body is all correct and allows the API to do everything it wants to. However there are times when this fails and it can cause an error in the backend, typically this is a bad thing and the data may not be correct and break other sequences inside the backend. Changing the method changes what is responded but does not break stuff generally. Rather it responds with something different such as update, delete, or create new pieces of data. However it will break if a certain body format is required for a method to work.