Assignment 7 - Meteoric Design, Implementation, and Test
Apply low-level design rules to implement and test your application.
Code resources
Submitting code or other solutions from anywhere other than your own brains is cheating.
- Can you research how to use a particular function or library such as pytest? Yes.
- Can you get code that solves all or part of your homework? No.
- When in doubt, ask. I will not be upset if you ask.
Refer to the full details in the Syllabus on Canvas.
Setup
- Click this link: https://classroom.github.com/a/VLhFcyMu
- The first teammate: Create a name like “alice-bob” using your first names.
- The second (and third) teammate: Join the team your partner made.
- Accept the assignment.
- Click the link to your team repo on the confirmation page.
git clonethe repository to your computer, and open the directory in PyCharm.- Configure
pytest:- Click the bottom right of PyCharm where your Python version is listed. Select
Add New Interpreter -> Add Local Interpreter, then hit Okay on the pop-up. - Open a new Integrated Terminal window in PyCharm.
- Run
pip install pytest pytest-cov
- Click the bottom right of PyCharm where your Python version is listed. Select
Introduction and Problem Statement
You will complete a program to analyze the NASA Meteorite Landings dataset: https://data.nasa.gov/dataset/meteorite-landings-api. You will work with your partner(s) to design, implement, and test your solution.
You may only collaborate with your partner(s). All partners must contribute equally to the assignment. Each person is responsible for implementing and testing part of the solution.
Read the Problem Statement: PDF or web. Paper hand-outs will be provided in class.
Part A) Design
In class, discuss the organization of your code with your partner(s). Discuss the Problem Statement, and then think of a sensible design in terms of the functions and optionally the modules (files) you will create.
Follow the 5 low level design rules:
- Avoid magic literals.
- Functions should have a single responsibility.
- DRY (Don’t Repeat Yourself) and the Rule of Three.
- Handle errors at the lowest sensible level, and re-raise/re-throw them otherwise.
- Raise specific errors and define your own if needed.
There are many ways to solve this problem while adhering to the design rules. You may evolve your design during Implementation and Test.
Your focus at this stage (prior to writing code) should be on the Single Responsibility Principle. By the end of class, show the instructor:
- Function signatures you have stubbed (only written the
defline) inmeteoric.py. - Docstrings that (i) explain each function, and (ii) specify which partner is responsible for implementing and testing the function.
Part B) Implementation & Test
This part is completed as homework. Coordinate your work via Slack, email, or text, and contribute your work to your team’s GitHub repo.
Implementation requirements
- Implement a solution to the Problem Statement in
meteoric.py. - Each person must work in a branch in git, then merge into
mainwhen appropriate. I will only look at themainbranch when grading. Review the content from Assignment 6 on proper Git workflow. - Put your names at the top of
meteoric.pyin the module docstring. - You may create classes and files and use imported libraries, but these things are not necessary.
- Your solution must adhere to the 5 rules of low-level program design.
- You are free to modify the provided code, including
load_data()code. - You will need to implement the haversine formula. You may use code from the web, but include the link to the source website in a code comment.
- Add docstrings following our conventions to any functions, classes, and files you create.
- The code must adhere to the PEP8 coding conventions discussed in class.
Testing requirements
- Add test cases to
test_meteoric.pyto verify your new code. - You must achieve 90% branch coverage in all source files except for the
main()function. - If you create additional source files, you must also create a corresponding
test_*.pyunit test. - All test cases must run from the CLI with
pytest. - Use
pytest --cov --cov-branch --cov-report=htmlto generate a branch coverage HTML report in your project directory.- note: the
htmlcov/and.coveragefiles generated by pytest are ignored by Git and will not appear in your repos. This is intentional.
- note: the
Rubric
- (5pts) PEP8 coding conventions followed
- (5pts) Docstring conventions followed for modules (files), classes (if any), and functions.
- (25pts) User commands are correctly implemented, including exception handling of user input errors.
- (10pts) Adherence to our 6 low level design rules.
- (15pts) Multiple test cases with proper test structure for your source code.
pytestbranch coverage HTML report demonstrating ≥90% branch coverage of all source code except formain().
Submission due Nov 17
Commit and push your code to GitHub following the prescribed workflow when working with git from Assignment 6.
- Each person must work in a branch in git, then merge into
mainwhen appropriate. - Make sure to push your branches to GitHub.
- I will only look at the
mainbranch when grading, so your branches must be properly merged into main.
You do not submit anything to Canvas.