Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor to use functional programming for _calculate_avg_summer_usage #269

Open
8 tasks
ethanstrominger opened this issue Nov 12, 2024 · 0 comments
Open
8 tasks

Comments

@ethanstrominger
Copy link
Collaborator

ethanstrominger commented Nov 12, 2024

To do this, all references to self.attribute or cls.attribute need to be removed. Any attributes that are set must be passed back in the return value to the calling function.

  • Change
    _calculate_avg_summer_usage() => avg_summer_usage = cls_get_avg_summer_usage(bills_summer)
    Do in two steps.
    Part 1 - avg_summer_usage
    • rename _calculate_avg_summer_usage to _get_avg_summer_usage
    • change self.avg_summer_usage to avg_summer_usage
    • return avg_summer_usage
    • change _calculate_avg_summer_usage()=>avg_summer_usage = cls_get_avg_summer_usage()`
    • at the end of the initializing function, add self.avg_summer_usage = avg_summer_usage
      When all functional programming is done, you can figure out how to do this differently
      Part 2 - bills_summer
    • Change self.bills_summer to bills_summer
    • Add bills_summer as a paramter to _get_avg_summer_usage and pass it when the function is called
@ethanstrominger ethanstrominger changed the title Refactor to use functional programming paradigm Refactor to use functional programming for _calculate_avg_summer_usage Nov 12, 2024
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

No branches or pull requests

1 participant