2024-heraklion-ODD/exercises/Exercise 3 editable installation workflow.md

63 lines
2.6 KiB
Markdown

## Exercise 3: Workflow
#### Goal
Experience that working with an editable installation does not change how you interact with your code.
This is supposed to be easy and fun, so run the inspection often and make mistakes with the potion.
Use your git skills to commit the changes you made to a new branch, and create a pull request.
#### Tasks
- Create a new branch.
- In the `brew_potions.py` file complete the `make_python_expert_potion` function that makes the *Python expert* potion (instructions below).
- In the `if _ name _ == "_ main _"` part, call the function you are editing and
get Professor Snoope to inspect your potion as shown for the example potion.
Calling `inspection_by_snoope` should never give you an error, so you will have to read what Snoope does and says to find out what went wrong.
- Create a pull request.
##### Brewing instructions
Make a new potion called `python_expert` according to these instructions:
```
1. Set up a pewter cauldron and light a fire underneath it
2. Add fish eyes, unicorn hair and tea leaves
3. Let simmer for 2 hours
4. Have snoope inspect the potion (use target_potion='python_expert').
```
Use the `if __name__ =="__main__"` block in `brew_potions.py` to create the `python_expert` potion and call Snoope to inspect the potion by calling `inspection_by_snoope` .
Make sure you actually call the function you are editing and change the **target** potion for Snoope to `"python_expert"`.
-------------
#### Hints
1. If you don't understand the instructions, please lift your hand and we will come to explain.
2. The python expert potion is very similar to the example potion. You may copy that code and
adapt it accordingly.
3. Note that if you copy from the `example_potion()` function, it is missing a crucial step.
You can look at the `Potion()` class in `brewing/potion_class.by` for inspiration
(it has to do with the ingredients).
4. Don't forget to change the name of the potion you want Snoope to check to "python_expert"
when you call the inspection (in if _ name _ == "_ main _" part).
-------------
#### Extra credit
If you look into the code you will see that there is a cooking method that is defined in the code which we have not used.
What happens if you do use it (try both options!) and let Snoope inspect your potion?
Once you are done, reflect on what you did to find out what the cooking method was
- Where did you look, why did you look there first?
- How did you figure out what it does? What part of the function did you read first?
- Did it work on your first try? If not, how did you try to fix it - trial and error or read documentation?