Course: SENG-560 Software Reuse
Instructor: Mr. Gregory Mundy
Student: Samir Deeb
Date: Nov 08, 2019
This project package has been developed as part of the assignment #2 of the course "SENG-560"
The objective of this assignment is to show how can we reuse components. In this assignment I reused the python project seng560Calc
The developed project is a simple calculator application that provides the following functionalities:
- calculate binary operations such as 2 * 5.1
- calculate unary operations such as V2 (square root of 2)
- convert integers from/to the following formats: Binary, Octal, Decimal and Hexadecimal
To run this application:
- clone this repository.
- clone the reused repository: seng560Calc
- make sure the reused repository is in your PYTHONPATH
- run python calcapp.py
when running the application the following menu is displayed:
1: Calculate
2: Convert
q: Quit
Choice:
The user will be prompted to enter a binary or unary operation question
Please enter a question in one of the following formats:
1- op1 operator op2
2- operator op
Where operator can be: +,-,*,/,^,V
^ denotes power and V denotes square root
Question:
the application will parse the question and print the result or an error
The user will be prompted to enter input format:
Please enter input format:
b: Binary
o: Octal
d: Decimal
h: Hexadecimal
Choice:
Then the output format.
Please enter output format:
b: Binary
o: Octal
d: Decimal
h: Hexadecimal
Choice:
And the number to be converted:
Please enter number to convert:
The application will convert the given number from the input format to the output format.
In this project, we used black-box reuse, as the reused library has been used as is with out any modification.
Although the reuse was very simple and straight-forward, the resued library does not handle the following cases:
- division by zero
- squareroot or fractional powers of negative numbers
The error displayed in these two cases does not reflect the real error.
To overcome these issues we can do the following:
- modify the reused library (whitebox reuse)
- let our application catch these errors before calling the reused library, which will add ore complexity to the application. we can also use some decorator of these functions.
Neither one of these two options was used, and it was left as is.
Please note that the menu module is totally independent of this application and hence can be reused for other applications.