This project is a fully modular and extensible calculator application built with Object-Oriented Programming (OOP) and design patterns to ensure maintainability, scalability, and testability.
The application follows core software engineering principles, including:
- SOLID Principles (Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion)
- DRY (Don't Repeat Yourself)
- GRASP (General Responsibility Assignment Software Patterns)
- Separation of Concerns (Modular architecture)
It provides an interactive REPL (Read-Eval-Print Loop) where users can execute mathematical operations, manage calculation history, and extend functionality through a plugin system.
✔️ Supports fundamental arithmetic operations (Add, Subtract, Multiply, Divide)
✔️ Implements a REPL-based command execution system
✔️ Saves and loads calculation history using Pandas & CSV
✔️ Implements plugin support for extending functionality dynamically
✔️ Includes comprehensive unit tests with pytest and code coverage analysis
✔️ Uses design patterns to enforce maintainability and extensibility
🎬 Click here to watch the demo
This project follows industry-standard design patterns to ensure modularity and reusability:
- Where?
calculations.py(Manages Pandas operations) - Why? Encapsulates the complexity of loading, saving, and managing history using Pandas, providing a simple interface for other components.
- Where?
commands/(Handles REPL commands dynamically) - Why? Enables commands like
add,subtract,historyto be executed independently while maintaining loose coupling.
- Where?
calculations.py - Why? Instantiates the history manager dynamically while allowing subclassing if needed.
- Where?
calculations_global.py - Why? Ensures only one instance of the history manager exists throughout the application.
- Where?
operations.py - Why? Dynamically selects the appropriate calculation strategy (e.g., addition, subtraction, multiplication, division).
Ensure you have Python 3.12 or higher installed.
git clone https://github.com/jesusgaud/Python-based_calculator_app.git
cd Python-based_calculator_apppython -m venv venv
source venv/bin/activate # Mac/Linux
venv\Scripts\activate # Windowspip install -r requirements.txtpython main.py| Command | Description |
|---|---|
add x y |
Adds two numbers |
subtract x y |
Subtracts y from x |
multiply x y |
Multiplies two numbers |
divide x y |
Divides x by y |
history |
Displays past calculations |
exit |
Exits the program |
pytestpytest --covpytest --pylintThe calculator application supports plugin-based extensibility, allowing new operations to be added dynamically.
- Navigate to
app/plugins/ - Create a new Python file (e.g.,
modulus.py) - Implement a new operation as a function
- The system will automatically detect and register the plugin
Create a new plugin file inside app/plugins/ and define an operation:
def operation(a, b):
return a % bTo enable plugin discovery, ensure the following is included:
from app.operations import load_plugins
load_plugins()- main → Stable production branch
- feature-branches → Feature development
- bugfix-branches → Fixes for existing issues
- Fork the repository on GitHub.
- Create a new branch for your feature or fix:
git checkout -b feature-new-command
- Make your changes and commit:
git commit -m "Added new command feature" - Push to GitHub:
git push origin feature-new-command
- Open a Pull Request (PR) to GitHub for review.
This project is licensed under the MIT License.
For questions, please reach out via GitHub Issues.