8000 Make the `metric` module purely object oriented · Issue #518 · einsteinpy/einsteinpy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Make the metric module purely object oriented #518

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

Open
JeS24 opened this issue Jun 23, 2020 · 0 comments
Open

Make the metric module purely object oriented #518

JeS24 opened this issue Jun 23, 2020 · 0 comments
Labels
enhancement New feature or request metric

Comments

@JeS24
Copy link
Member
JeS24 commented Jun 23, 2020

🐞 Problem

After #512, the metric module has seen some major changes, one of them being the introduction of a BaseMetric class. As the name suggests, this class serves as a base class for all other metric classes in the module. It also groups together all relevant utility functions from utils. This has been done to provide users the freedom to use the individual functions as either utility functions or as part of their own metric classes, that inherit BaseMetric, without any additional import. Since the definition of these functions are fixed, as in changing even a portion of those functions would completely change their behaviour and this is not something, that we expect a user to do; in #512, they were defined as staticmethods. However, this has resulted into an intermixing between pure object oriented code and code, that is closer to functional programming. We want to avoid this, by making the module purely object oriented.

🎯 Goal

To clarify the code choices that went into the BaseMetric class and to move towards purely object-oriented code, as is the case with the rest of the library.

💡 Possible solutions

One possible solution, as suggested by @shreyasbapat, is to remove all @staticmethod decorators and turn all such functions into proper methods. Changes would be required across the metric module, in all metric classes, and in the related tests.

📋 Steps to solve the problem

  • Discuss the possible solutions here or in our chat room.
  • Comment below about what you've started working on.
  • Add, commit, push your changes
  • Submit a pull request.
  • Add this in the comments:
    • Addresses #<put issue number here> if you are partially fixing the issue.
    • Fixes #<put issue number here> if you are completely fixing the issue.
  • Ask for a review in comments section of pull request
  • Celebrate your contribution to this project 🎉
@JeS24 JeS24 mentioned this issue Jun 23, 2020
10 tasks
@JeS24 JeS24 added enhancement New feature or request metric labels Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request metric
Projects
None yet
Development

No branches or pull requests

1 participant
0