Write up NON test
Write up
- Describe Procedural Abstraction, discussion on code and abstraction techniques used: Frontend/Backend, Functions, Classes, etc
- Describe Data Abstraction, discussion on data used and data structures to support project: JSON, Dictionaries, Lists, and/or Database Tables.
- Describe Usage of Control Structures, ie Iteration and Conditional Statements. Areas where you use lists and interation in Frontend Display. Areas were you decide and execulte different paths of code, for instance Create vs Read vs Update vs Delete. Also, show a function where a different parameter or condition causes a differen result.
Describe Procedural Abstraction, discussion on code and abstraction techniques used: Frontend/Backend, Functions, Classes, etc
Procedural abstraction is a key concept in programming that allows developers to create complex programs by breaking them down into smaller, more manageable procedures. This technique allows developers to work with complex systems without worrying about the implementation details of each method. In my project, I used procedural abstraction techniques to separate front-end and back-end code, creating classes and functions that perform specific tasks.
On the front end, I used HTML, CSS, and JavaScript to create the user interface. These technologies allowed her to abstract the implementation details of UI components such as buttons, forms, and text fields. Instead, I could focus on building functions that handle user interactions and send data to the backend for processing. For example, when a user submits a comment, a function is called that makes her AJAX request to the backend, passing the comment data as a parameter.
On the backend, I used Flask and SQLAlchemy to create a RESTful API to handle data and business logic. Flask is a micro web framework that allows you to create routes associated with specific functions. SQLAlchemy is an object-relational mapping (ORM) tool that allows you to interact with your database using Python objects instead of SQL queries. I’ve created a Comment class that maps to a database table to make it easy to create, read, update, and delete comments.
Describe Data Abstraction, discussion on data used and data structures to support project: JSON, Dictionaries, Lists, and/or Database Tables.
Data abstraction is another important concept in programming that allows developers to manipulate data without worrying about implementation details. In my project, I used a data abstraction technique to store the comment data in a database table. I used SQLite as the database engine. It’s a lightweight serverless standalone database that’s easy to set up and use. I’ve also used SQLAlchemy to abstract away database implementation details such as: B. Connection Management, Query Generation, and Result Processing. To display the comments on the frontend, I used a list data structure to store the comment objects retrieved from the backend. I used an iterative control structure to iterate through the comment list and dynamically generate the HTML elements. For example, when a user visits the comments page, an AJAX request is sent to the backend to fetch all comments. When comments are retrieved, a function is called that iterates through the comments list and generates an HTML element for each comment.
Describe Usage of Control Structures, ie Iteration and Conditional Statements. Areas where you use lists and interation in Frontend Display. Areas were you decide and execulte different paths of code, for instance Create vs Read vs Update vs Delete. Also, show a function where a different parameter or condition causes a differen result.
In the backend,I used conditional statements to determine which code path to execute based on the HTTP method and URL endpoint. For example, sending a POST request to the /comments endpoint executes a different code path than a GET request to the same endpoint. I also used conditional statements to handle errors and exceptions. B. If the database connection fails or the query returns no results.
Finally, I created a function that returns different results based on different parameters or conditions. For example, the backend comment function returns all comments when a GET request is made, but returns a success message when a POST request is made. This function takes a parameter that specifies the HTTP method that determines the result. This technique allows you to reuse the same function for different purposes and reduces code duplication.