Skip to content

Corrections to Refactor course #68

@Scottan

Description

@Scottan
Instructions

Thanks for piloting the lesson! ❤️

Please let us know about your plan and dates for the pilot workshop.

If you want to provide us feedback after your pilot, you can use this issue to provide more details, e.g. on the following topics:

  • Sources of Confusion

In the first exercise "Writing Tests Before Refactoring", there is essentially a refactoring that occurs before the actual exercise by changing the function to output data instead of making the figure. It is also not clear which "data" is being referred to here.

I would recommend adding some code-along which makes the following changes:

Change the lines in compute_data.py

    graph_data = {
        'daily standard deviation': daily_standard_deviation
    }

    views.visualize(graph_data)

to

    return daily_standard_deviation

The change the lines in catchment-analysis.py from

        compute_data.analyse_data(os.path.dirname(InFiles[0]))

to

        daily_standard_deviation = compute_data.analyse_data(os.path.dirname(InFiles[0]))
        graph_data = {
            'daily standard deviation': daily_standard_deviation
        }

        views.visualize(graph_data)

The get the students to check the figure is the same when you run the function. From there, we can do the exercise to write the test, knowing that the code still works as before and everyone will be on the same page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions