Skip to content

Feedback#1

Open
github-classroom[bot] wants to merge 10 commits intofeedbackfrom
main
Open

Feedback#1
github-classroom[bot] wants to merge 10 commits intofeedbackfrom
main

Conversation

@github-classroom
Copy link
Contributor

@github-classroom github-classroom bot commented Feb 27, 2022

👋! GitHub Classroom created this pull request as a place for your teacher to leave feedback on your work. It will update automatically. Don’t close or merge this pull request, unless you’re instructed to do so by your teacher.
In this pull request, your teacher can leave comments and feedback on your code. Click the Subscribe button to be notified if that happens.
Click the Files changed or Commits tab to see all of the changes pushed to main since the assignment started. Your teacher can see this too.

Notes for teachers Use this PR to leave feedback. Here are some tips: - Click the **Files changed** tab to see all of the changes pushed to `main` since the assignment started. To leave comments on specific lines of code, put your cursor over a line of code and click the blue **+** (plus sign). To learn more about comments, read “[Commenting on a pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request)”. - Click the **Commits** tab to see the commits pushed to `main`. Click a commit to see specific changes. - If you turned on autograding, then click the **Checks** tab to see the results. - This page is an overview. It shows commits, line comments, and general comments. You can leave a general comment below. For more information about this pull request, read “[Leaving assignment feedback in GitHub](https://docs.github.com/education/manage-coursework-with-github-classroom/leave-feedback-with-pull-requests)”.

Subscribed: @LaserTrajectory

Copy link

@sudeeprp sudeeprp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good effort @LaserTrajectory 👍
Most of my comments are around readability. Have a look below.

statistics.py Outdated
if len(numbers) == 0:

vals = [math.nan for i in keys] # is_nan test
# print(vals)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't leave commented code in commits

statistics.py Outdated

else:

vals = [ round((sum(numbers) / len(numbers)), 3), max(numbers), min(numbers) ] # min_max_report test
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to read this code and correlate the order of the statistics. Will get harder to read when we add more statistics.
If the intended return is a dictionary, why not initialize it as a dictionary itself, instead of two arrays?

statistics.py Outdated

if stats["max"] > self.maxThresh:

self.alertArrs[0].emailSent = True
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The meaning of the indexes [0] and [1] are hidden in the implementation, which a caller of this code will need to understand. This means the caller will need to see the implementation of the function.
Find a way to make this explicit by naming the function parameters (instead of an implicit order inside alertArrs)

self.assertTrue(isnan(computedStats["max"]))
self.assertTrue(isnan(computedStats["min"]))

def test_invalid_arg_returns_None(self):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice test added 👍

statistics.py Outdated

# below: alerts tests

class EmailAlert:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does 'alerting' responsibility belong in statistics.py?
It would be hard for someone to guess that statistics.py contains the alerting stubs as well

statistics.py Outdated

else:

return # invalid_arg test
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me a while to trace back the else here. This function will tend to grow more complex as more conditions are imposed on the inputs and outputs. You can watch out for this by limiting the cyclomatic complexity. Take a look at that link and we'll talk about tooling related to that quantification later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants