Students learn the basics of libraries while building upon the envelope model of a function with a folder to represent a library. Show GoalsStudents will be able to:
PurposeThe mental model of a folder containing a group of functions is used to introduce the concept of a library. Throughout this lesson student explore the requirements for working with libraries and documentation. Resources
Getting Started (5 mins)Preview LibrariesPrompt: How could you share a function with another person so they could use it in their own program? Goal: Guide student answers towards possible answers like these -
Remarks
Activity (35 mins)Guided Activity: Today's activity introduces students to libraries. As a visual aid, you can use Code.org's presentation slides for Unit 7, Lesson 5: Libraries Explore. These slides include animations. The notes below describe when to move to the next slide or click through an animation -- if you aren't using the slides, you can ignore these prompts.
Remarks
For more information on loading and interacting with libraries in Quorum you can use the Use Statements tutorial to learn more about the use statement and interacting with the Quorum Standard Library. If you have been programming in Quorum you might have already seen these use statements. The standard library is essential in getting apps to work so you have been using libraries this whole time and you might not have even known it! As you will see in the Apps associated with this unit, in Quorum, when you want to make your own library the library functions will be placed in there own file within the project. Quorum also already has a large collection of functions and classes available to you and they are collectively known as the Quorum Standard Library. The standard library is included with Quorum Studio so those files won't be directly included in the project but they are available to you using a use statement. Here is an example of using the Math library from the standard library: use Libraries.Compute.Math class Main action Main Math math output math:SquareRoot(6) end endFrom the code sample you can see that the Math library was made available to us by the line use Libraries.Compute.Math. To use the functions in the Math library you need a Math variable which is why we have Math math. With the math variable you can now use it call the functions it has like the SquareRoot function. Wrap Up (5 mins)Journal: Have students add the following words to their journals: Library, API
Remarks
Assessment: Check For UnderstandingFor Students: Open a word doc or google doc and copy/paste the following question. The question is followed by a code snippet. Question: Evaluate if the following function is a good candidate to be placed in a library. Why or why not? function updateScore(player, points) if(player == "player1"){ player1Points = player1Points + points; } else { player2Points = player2Points + points; } }Standards Alignment
|