(in progress) This project is created to serve as educational content on what it means to design according to the model view controller (MVC) design or paradigm. The model can in theory come from anywhere, such as from a database or from any other data source. In this case the polynomial comes from an interactable dialog. The controller is responsible for loading data into the polynomial model.
The following models are present:
- An equation interface that requires one implementation that returns the equation as a string in Latex notation.
- A polynomial object which represents polynomial equations. A
Polynomial
is aEquation
.
There are a couple of views:
- The mathematical equation label to display the represented polynomial equation.
- A 2D graph plot visually displaying the equation.
- A polynomial editor, in which you can interact with the polynomial.
The controllers are present in the following form:
- (still to come)
The following applications and software tooling are required:
- Python >= 3.6
- Poetry 1.12+
Installation instructions:\
Linux:
# install python version >= 3.6. Here we install python 3.8.
sudo apt install python3.8
# install latest poetry (1.12+)
curl -sSL https://install.python-poetry.org | python3 -
# install the python dependencies (will install in a virtual environment)
poetry install
# Run the application
poetry run app
# Run unit tests
poetry run test
scripts.py
contains starter functions that can be called usingpoetry run
. Useful to start the application or run unit tests.pyproject.toml
contains poetry project dependencies and script definitions.
Application follows Model View Controller (MVC) design architecture. In short
- A model and view will never communicate directly with each other. It goes via the controller.
- The visualization (view) is decoupled from the internal data representation (model).
- Controller makes sure a model is read and updated.
- Controller passes the data from the model to the view.
We are using unittest framework as provided by python3.
Using the following commands you can run unit tests:
# using poetry
poetry run test # runs unit tests
poetry run coverage # runs unit tests with coverage
# Run a specific unit test file.
poetry run python tests/test_py_polynomial_solver.py
# Run a specific test in the unit test file
poetry run python tests/test_py_polynomial_solver.py TestPolynomialParser.test_quadratic