Extension 04 - Vue.js 3
In these extensions you will improve the Flashword (v2 with Vite) app by:
- implementing a hint feature.
- refactoring the way the number of correct words is computed to take better advantage of Vue's reactivity.
- optionally adding some other features.
In addition, you will gain additional practice using VS Code's IntelliSense, Copilot inline completions and Copilot's Ask agent.
Getting Started
You will start and work on this extension in the same way as you have for the previous extensions. You should be starting to internalize this process making you less reliant on reading the detailed instructions each time.
Tasks
- If you don't remember all of the steps for getting started and working on the extension tasks, you should review the relevant parts of the workflow using the links in the "QuickReference" document as necessary.
Self Check
- Which steps do you still need to look up?
- What can you do to commit more of those steps to memory?
Extension without AI
Use the familiarity with Vue.js and the flashword app that you gained from the tutorials to complete the tasks below. For these tasks you may code manually, use on-line documentation and use VS Code IntelliSense and Copilot inline completions, but do not use any other Copilot modes or AI tools.
Tasks
- The
words property in the Vue data contains an array of objects representing the word for the game. Each word has a number of properties including a hint. However, the hint property is not currently used in the game. Add code such that a hint checkbox appears below each answer input and that the hint associated with the word is shown if the box is checked.
- If the hint checkbox and hint are not hidden when the correct answer is entered, fix the implementation so that they are.
Self Check
- What causes your hint checkbox be replicated for each word in the user interface?
- How is the visibility of the hint changed when the checkbox is checked and unchecked?
Extension using Copilot's Ask Agent
While the Flashword app works correctly, the way that a few of its features are implemented do not take full advantage of Vue's reactivity. In this extensions, you'll gain further practice using Copilot's Ask agent as you work to understand and refactor one of those implementations.
When all of the words have been correctly translated Flashword displays the message "Great work, you have completed all the words!" In the template you can see that this happens when the completed property becomes true. That is the correct behavior, however the way that the script manages the completed property manually instead of utilizing Vue's reactivity. Complete the tasks below to better understand this issue and refactor the implementation to better leverage Vue's reactivity.
Tasks
- Use Copilot's Ask mode to understand why the way the
script manages the correctCount property does not currently leverage Vue's reactivity and why that is a potential problem. Continue to ask Copilot questions until you understand the problem. As you ask questions, be sure to keep Copilot narrowly focused just on the correctCount property. If Copilot proposes a solution, don't implement it yet, you'll do that in the next tasks.
- Now that you understand the problem, write a new prompt that uses what know to directly ask Copilot how to do the refactoring.
- Check that the solution that Copilot gives you focuses narrowly on management of the
correctCount property and does not change the management of any other properties.
- Continue to interact with Copilot in ask mode until you have a solution that:
a. only affects the management of the correctCount property.
b. that you fully understand.
- Implement Copilot's proposal to refactor the way that the
correctCount property is managed.
Self Check
- Why is the manual management of the
completed property a potential source of bugs?
- How does the refactored management of the
completed property better utilize Vue's reactivity?
- Do you see another instance of the same type of issue in the implementation?
Optional Extensions
There are so many different things that you could do to enhance the Flashword game, but there is only so much time. Here are a few optional extensions that you can try before moving onto the AI Reflection below. If you have the time an interest you can do any or all of them in any order for more practice with Vue and Copilot.
Tasks
- Add a reset button to the game that resets everything to the initial start state for the game.
- There is another instance in which a
data property is being managed manually instead of leveraging Vue's reactivity. Refactor the implementation in the script to better utilize Vue's reactivity to manage this data property.
- Currently if you type a correct answer and press
Enter the word turns green to indicate that the answer is correct. However, if you type an incorrect answer and type Enter nothing happens. This is a little confusing and makes it seem like maybe the app is not working. Modify the app so that if the answer is incorrect the word turns a different color when you press Enter.
- Add anything else you can think of! For each change you make, add a comment to your PR describing the change and then make it.
Self Check
- Does making use of Vue's reactivity make it easier or harder for you to understand the implementation? Why?
- Do you think it would make it easier or harder for a Vue expert to understand the implmentation? Why?
- What was an unexpected complication that you ran into when working on one of these extensions? Why were you not able to anticipate that complication?
AI Reflection
Add a comment to your pull request for this Extension that addresses the following points:
- Describe an instance when the AI tools gave you a response that was not directly useful (e.g., it was off topic, too broad, used language features that you did not know, or that worked in a way that you didn't immediately understand.).
- Reflect on how you responded to the situation you described in 1 and discuss how the experience you gained might improve your future interactions with AI tools such as Copilot.
Turning in Your Work
Once you have finished all of the work in this extension you will need to officially submit it.
Tasks
- Use the steps for "Completing an Extension" in the Extensions Workflow to submit your work.
This Extension is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
Extension 04 - Vue.js 3
In these extensions you will improve the Flashword (v2 with Vite) app by:
In addition, you will gain additional practice using VS Code's IntelliSense, Copilot inline completions and Copilot's Ask agent.
Getting Started
You will start and work on this extension in the same way as you have for the previous extensions. You should be starting to internalize this process making you less reliant on reading the detailed instructions each time.
Tasks
Self Check
Extension without AI
Use the familiarity with Vue.js and the flashword app that you gained from the tutorials to complete the tasks below. For these tasks you may code manually, use on-line documentation and use VS Code IntelliSense and Copilot inline completions, but do not use any other Copilot modes or AI tools.
Tasks
wordsproperty in the Vuedatacontains an array of objects representing the word for the game. Each word has a number of properties including ahint. However, thehintproperty is not currently used in the game. Add code such that a hint checkbox appears below each answer input and that the hint associated with the word is shown if the box is checked.Self Check
Extension using Copilot's Ask Agent
While the Flashword app works correctly, the way that a few of its features are implemented do not take full advantage of Vue's reactivity. In this extensions, you'll gain further practice using Copilot's Ask agent as you work to understand and refactor one of those implementations.
When all of the words have been correctly translated Flashword displays the message "Great work, you have completed all the words!" In the
templateyou can see that this happens when thecompletedproperty becomestrue. That is the correct behavior, however the way that thescriptmanages thecompletedproperty manually instead of utilizing Vue's reactivity. Complete the tasks below to better understand this issue and refactor the implementation to better leverage Vue's reactivity.Tasks
scriptmanages thecorrectCountproperty does not currently leverage Vue's reactivity and why that is a potential problem. Continue to ask Copilot questions until you understand the problem. As you ask questions, be sure to keep Copilot narrowly focused just on thecorrectCountproperty. If Copilot proposes a solution, don't implement it yet, you'll do that in the next tasks.correctCountproperty and does not change the management of any other properties.a. only affects the management of the
correctCountproperty.b. that you fully understand.
correctCountproperty is managed.Self Check
completedproperty a potential source of bugs?completedproperty better utilize Vue's reactivity?Optional Extensions
There are so many different things that you could do to enhance the Flashword game, but there is only so much time. Here are a few optional extensions that you can try before moving onto the AI Reflection below. If you have the time an interest you can do any or all of them in any order for more practice with Vue and Copilot.
Tasks
dataproperty is being managed manually instead of leveraging Vue's reactivity. Refactor the implementation in thescriptto better utilize Vue's reactivity to manage thisdataproperty.Enterthe word turns green to indicate that the answer is correct. However, if you type an incorrect answer and typeEnternothing happens. This is a little confusing and makes it seem like maybe the app is not working. Modify the app so that if the answer is incorrect the word turns a different color when you pressEnter.Self Check
AI Reflection
Add a comment to your pull request for this Extension that addresses the following points:
Turning in Your Work
Once you have finished all of the work in this extension you will need to officially submit it.
Tasks