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

View is Creating Multiple Instances of Data Source #6

Open
jbrucker opened this issue May 3, 2024 · 0 comments
Open

View is Creating Multiple Instances of Data Source #6

jbrucker opened this issue May 3, 2024 · 0 comments

Comments

@jbrucker
Copy link
Collaborator

jbrucker commented May 3, 2024

Your view class creates multiple instances of the data source
(originally in file model.py and now apparently in data_analyze.py).

  1. View (UI) should not create any instances of the model. Use dependency injection, or let the view "get" a reference from the controller:
    data = self.controller.get_dataset()
  2. Regardless of how you do it, you should not create multiple instances of the data source (model). That wastes memory, time, and I/O.

In your view code:

    def init_data_information_tab(self):

        # name should be "columns" or "attributes", 
        # not "column" since there are many
        column = DataAnalyze().get_column_names()
    def handle_attribute_selection(self, selected_attribute):

        # Get data analyzer instance
        data_analyzer = DataAnalyze()

Its a matter of choice, but I think "DataAnalyze" is not a
descriptive name for the model class. It's not doing actual analysis.

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