Skip to content

h) Code

Fab1oNumber1 edited this page Mar 30, 2023 · 4 revisions

This section aimst to shortly discuss some important technical details of the code to be written. The code structure is of course heavily dependent on the technologies used for the project. In the following, the architectures of these technologies are briefly described.

VueJS

VueJS is a frontend web framework that follows a component-based architecture. The basic code structure of VueJS consists of a Vue instance, which serves as the root of the application and contains data, methods, and computed properties. Each component is then defined as a separate Vue instance, which can be nested and reused within other components. Components can communicate with each other through props and events, and the application can use Vue directives to bind data and behavior to HTML elements. Finally, the Vue router and Pinia can be used to handle client-side routing and state management respectively.

Python Flask

In contrast to the structure described above, Python Flask represents a micro web framework for Python that follows a modular architecture. The basic code structure of Flask consists of a Python file that defines the application instance and its routes. Routes are defined using the @app.route() decorator and specify which function should be called when a specific URL is requested. The application can also be extended by adding Flask extensions, which provide additional functionality such as database integration or authentication. Extensions are initialized and registered with the Flask application instance.

SQLite

A lightweight and self-contained relational database management system that stores data in a single file on disk. The basic code structure for SQLite involves creating a database connection, executing SQL statements to create tables and insert, update or retrieve data, and then closing the connection. To create a database connection, one can use the sqlite3 module that comes with Python's standard library. Once a connection exists, one can use the execute() method to execute SQL statements. SQLite supports SQL commands to create tables and specify their columns and data types, as well as insert, update, delete and select statements to manipulate and retrieve data. Data can be retrieved from the database using SQL SELECT statements, and the results can be processed using Python. Onecan use the fetchone() method to retrieve a single row or fetchall() method to retrieve all rows from the result set.

Clone this wiki locally