BJC was developed by the University of California, Berkeley, and Education Development Center, Inc. Teacher professional development has been a partnership with North Carolina State University, the New York City Department of Education, and the New York City Foundation for Computer Science Education.
We take the stand that any technology has risks and benefits, and that people decide how to minimize risks and maximize benefits. Therefore, in each topic, we have students evaluate alternate points of view. For example, rather than shut down debate on the downloading of copyrighted works (e.g., music), which many students do, we try to open the issue by eliciting honest perspectives on both the value and harm in it, and whether there are ways to protect the value and remedy the harm (e.g., by considering alternate ways to support artists and writers). Both student pages and the Teachers' Guide point to provocative readings on each topic.
In general, we hope to leave students feeling optimistic about the benefits of technology, but also ready to think critically about any specific technology. We also remind them that the decisions about how a new technology is used are made by human beings, including themselves if they pursue a career in computer science, so they shouldn't feel helpless in the face of a supposed technological imperative.
-
We use the excellent Blown to Bits as the textbook for this part of the course. (There is no textbook for the technical parts of the course, beyond the online materials we provide.) The book is aimed at adult readers, and will be difficult especially for ESL students, so we use short excerpts and discuss alternative presentations in the Teachers' Guide. Like the rest of the course materials, this book is avaliable free online, with a Creative Commons BY-NC-SA license.
+
We use the excellent Blown to Bits as the textbook for this part of the course. (There is no textbook for the technical parts of the course, beyond the online materials we provide.) The book is aimed at adult readers, and will be difficult especially for ESL students, so we use short excerpts and discuss alternative presentations in the Teachers' Guide. Like the rest of the course materials, this book is available free online, with a Creative Commons BY-NC-SA license.
The book is a few years old now, so we supplement it with current readings, looking for topics that will be relevant to students. Students choose their own topics to study in more depth; this is one way we appeal to a diverse audience. We start class meetings with "Computing in the News," presenting items from that morning's newspaper, one generally positive and one problematic. After some teacher-chosen examples to illustrate the idea, we encourage teachers to assign the selection of articles to students in rotation.
- You can download a PNG image file of any block or script by right-clicking it (or control-clicking it on a mac) and selecting "script pic..." If a new window opens with the picture, use your browser's Save command (in the File menu) to save it. If not, look in your browser's Downloads folder for the image file.
+ You can download a PNG image file of any block or script by right-clicking it (or control-clicking it on a Mac) and selecting "script pic..." If a new window opens with the picture, use your browser's Save command (in the File menu) to save it. If not, look in your browser's Downloads folder for the image file.
@@ -54,7 +54,7 @@
Creating Script Pics
Exporting All the Images at Once
- You can download an HTML file of all of the blocks in your whole project as well as a picture of the stage by selecting "Export summary..." from the Snap! File menu (). The HTML file also land in your browser's Downloads folder. Open it (in a browser), right-click (or control-click on a mac) to copy the images you need, and paste them into the document where you are describing your code.
+ You can download an HTML file of all of the blocks in your whole project as well as a picture of the stage by selecting "Export summary..." from the Snap! File menu (). The HTML file also land in your browser's Downloads folder. Open it (in a browser), right-click (or control-click on a Mac) to copy the images you need, and paste them into the document where you are describing your code.
CRD-2.H.1, CRD-2.H.2 ("The College Board is very particular")
-
Brian, you made this an "exam" box, and I have no problem with that characterization, in theory, but this isn't about the "exam;" it's about the "create task," and I don't want to confuse people. --MF, 9/2/19
- Orange boxes are for important computer science ideas. This isn't important, isn't computer science, and isn't an idea. The create task is part of the exam! -bh
- The College Board is very particular about acknowledging content that you did not develop yourself. You are probably familiar with using quotation marks around text that you didn't write and with creating a bibliography, but for the Create Task, you also need to acknowledge code that other people wrote or even helped you write. This acknowledgment must include either where you got the code or who wrote it, and it should be included in your program documentation.
+
The College Board is very particular about acknowledging content that you did not develop yourself. You are probably familiar with using quotation marks around text that you didn't write and with creating a bibliography, but for the Create Task, you also need to acknowledge code that other people wrote or even helped you write. This acknowledgment must include either where you got the code or who wrote it, and it should be included in your program documentation.
+
CRD-2.H ("Develop a prototype")
Develop a prototype to meet your specifications. As you do, keep track of any pieces of code that were written by someone else (either using Snap! comments or in another document).
+
+
The Create Task requires you to include a list and identify it by name, but in Snap!, lists aren't necessarily named. To receive full credit, be sure to make a variable to store your list and refer to your list by its variable name in your written response. The exam graders need to understand what you are referring to.
- In the Snap! window, click the Cloud menu, , select "Signup...", and follow the instructions.
+ In the Snap! window, click the Cloud menu, , select "Signup...", and follow the instructions.
You'll be asked to click a link in your email to verify your account, but you don't have to do that right now.
-
You may change your password at any time using the Cloud menu, .
+
You may change your password at any time using the Cloud menu, .
-
-
+
As a first step, make Alonzo jump someplace else on the stage when he's clicked. Drag these two blocks into the scripting area (the center area of the window):
@@ -68,8 +68,8 @@
Saving a Snap! Project
-
-
+
Orange boxes contain the ideas you should still remember three years from now.
@@ -89,13 +89,13 @@
Saving a Snap! Project
- Choose "Save" from the Snap! File menu, .
+ Choose "Save" from the Snap! File menu, .
Making the Game Challenging
-
+
The game isn't much fun if Alonzo just sits there waiting to be clicked. Once you've clicked him, he should keep jumping around on his own. To make Alonzo keep moving around, you need a block that says "do this forever." And there is a block that does it:
@@ -119,7 +119,7 @@
Making the Game Challenging
-
+
Alonzo moves too fast. Use the block to slow him down. Try your program, and increase or reduce the wait time if you like.
Where the wait block goes in your script matters. Do you want the script to wait one time or each time Alonzo moves?
diff --git a/cur/programming/1-introduction/1-building-an-app/3-loading-mobile-device.html b/cur/programming/1-introduction/1-building-an-app/3-loading-mobile-device.html
index 70d1a35b75..0f0a462546 100644
--- a/cur/programming/1-introduction/1-building-an-app/3-loading-mobile-device.html
+++ b/cur/programming/1-introduction/1-building-an-app/3-loading-mobile-device.html
@@ -18,7 +18,7 @@
Creating a Link
Make sure your project is saved.
-
Choose "Open..." from the Snap! File menu, .
+
Choose "Open..." from the Snap! File menu, .
Select the project you want to share from the project list (your current project is likely named "U1L1-ClickAlonzo").
To locate a file, you can type in the search bar at the top to see only a list of matching files (see the example on the right, where only "U1" files are shown).
Click "Share," and then click "Yes" to share. Then click "Cancel" to close the menu.
Program Alonzo to face the other way when clicked.
-
+
The project you loaded has two Alonzo costumes—one facing right and the other facing left—so you can use the block to make the sprite face the other way. Add the next costume block to the place in your program where the user has just clicked on Alonzo.
Test your program. Make sure Alonzo faces the other way when he is clicked but not when he jumps without being clicked.
@@ -35,7 +35,7 @@
Confirming Whether Alonzo Was Clicked
Keeping Score
-
+
The player will also want to know how much progress they have made in the game. The command can control Alonzo's transparency.
@@ -45,7 +45,7 @@
Keeping Score
Use transparency to tell the user how close they are to winning: every time they click, Alonzo gets more invisible, and when he disappears completely, they win the game.
-
+
Drag the change (ghost) effect block into the center scripting area, and experiment with different input numbers (clicking it repeatedly after each change) to see exactly what it does. At what ghost effect value does Alonzo become completely invisible? You can use the command to make Alonzo fully opaque again.
Then, modify your script so that every time Alonzo is clicked, he gets a little more ghostly. Think about how the input you use affects the length of the game. Try out your game.
Create a second script that makes Alonzo a welcome message when the green flag is clicked. (Alonzo might say, "Welcome to 'Click Alonzo!' Keep clicking me if you can!")
If you have not already created an account, do that now.
-->
AAP-3.A.6
There is nothing exactly like or on the AP Exam because they don't have sprites and speech balloons, but their way of showing this text to the user is
@@ -88,12 +87,14 @@
Exploring a Second Sprite
Make Sprite(2) tell Sprite to respond. What happens?
+
+
+
- The broadcast block sends a message to all the sprites. To set the message, click the down arrow and select "new..."
+ The broadcast block sends a message to all the sprites. To set the message, click the down arrow and select "new..."
-
For more information about the when I receive block, right-click (or control-click on a Mac) the block and select "help..."
diff --git a/cur/programming/1-introduction/2-gossip-and-greet/3-customizing.html b/cur/programming/1-introduction/2-gossip-and-greet/3-customizing.html
index 8d312424e2..da919516e1 100644
--- a/cur/programming/1-introduction/2-gossip-and-greet/3-customizing.html
+++ b/cur/programming/1-introduction/2-gossip-and-greet/3-customizing.html
@@ -52,7 +52,7 @@
How to Edit a Block
: Lists, Strings, and Concatenation
-
+
AAP-1.C.1 first sentence
A list is an ordered set of items. You've seen this example:
@@ -65,8 +65,8 @@
How to Edit a Block
-
-
+
The process of testing, finding problems, and fixing them is called debugging.
@@ -135,9 +135,9 @@
Adding a Costume
Fix any issues with your costumes.
Adjusting a Costume
-
+
You can change the size of your sprite using .
You can change the position of your sprite using .
Create a new block by either clicking near the end of the palette, clicking the + sign in the top right corner of the palette (shown below), or right-clicking (or control-clicking on a Mac) in an empty spot in the scripting area and choosing "make a block..." (shown below).
diff --git a/cur/programming/1-introduction/2-gossip-and-greet/5-if-else.html b/cur/programming/1-introduction/2-gossip-and-greet/5-if-else.html
index 598d9a3e88..3b7f150610 100644
--- a/cur/programming/1-introduction/2-gossip-and-greet/5-if-else.html
+++ b/cur/programming/1-introduction/2-gossip-and-greet/5-if-else.html
@@ -18,7 +18,7 @@
Adding Variety to Gossip
If it isn't open already, open your U1L2-Gossip project.
Find in the red Lists palette, drag it into the scripting area, and click on it enough times to see how it's different from who.
-
+
Here is the code for more complicated who. There are two new things in it: pick random and if else.
: Expressions and Values
AAP-2.B.3, AAP-2.B.4
-
An expression is a either a constant value (such as "4" or "winter") or a call to a reporter block with any input slots filled in (such as , , or ).
+
An expression is a either a constant value (such as "4" or "winter") or a call to a reporter block including its inputs (such as , , or ).
Expressions are evaluated to produce a singlevalue (a value can be a number, a string, a sprite, a costume, a script, a list—anything). For example, will be evaluated to 17.
-
+
AAP-3.E.1, AAP-3.E.2
The expression would be written as
RANDOM(1, 10)
or . Every time you run this code, you will get a different random number between 1 and 10.
These are works by artists Josef Albers, Maya Hayuk, Vassily Kandinsky, Atta Kwami, Kazimir Malevich, and Theo van Doesburg. The styles are different, but all of them are based on polygons or circles.
+
These are works by artists Josef Albers, Maya Hayuk, Vassily Kandinsky, Atta Kwami, Kazimir Malevich, Alma Thomas, and Theo van Doesburg. The styles are different, but all of them are based on polygons or circles.
At the right is a painting by Alma Thomas. See what it inspires you to do. It's your art. Take liberties.
diff --git a/cur/programming/1-introduction/3-drawing/4-modify-your-pinwheel.html b/cur/programming/1-introduction/3-drawing/4-modify-your-pinwheel.html
index 90df9d9107..7b818cbd97 100644
--- a/cur/programming/1-introduction/3-drawing/4-modify-your-pinwheel.html
+++ b/cur/programming/1-introduction/3-drawing/4-modify-your-pinwheel.html
@@ -46,7 +46,7 @@
Open your U1L3-Pinwheel project, and build a nest squares block that uses for and your polygon block to draw nested squares. Give it an input so that it will draw whatever number of squares you specify, with each square larger than the previous:
-
diff --git a/cur/programming/1-introduction/3-drawing/7-programming-journal.html b/cur/programming/1-introduction/3-drawing/7-programming-journal.html
new file mode 100644
index 0000000000..1dc6bd2950
--- /dev/null
+++ b/cur/programming/1-introduction/3-drawing/7-programming-journal.html
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+ Unit 1 Lab 3: Modern Art with Polygons, Page 7
+
+
+
+
Keeping a Programming Journal
+
On this page, you will learn how keeping a programming journal can help your programming.
+
+
+
+ Every day in your journal, keep notes like the following:
+
+
Any concept about programming that you had trouble understanding.
+
Questions that you want to remember to ask.
+
Ideas for projects that you want to work on or improvements to an existing project that you want to make.
+
+ Problems with your code:
+
+
What was the symptom?
+
What did the cause turn out to be?
+
What change did you make to fix the problem?
+
What techniques did you use to investigate the problem?
+
+
+
+ How did you organize your code?
+
+
Did you define new procedures?
+
+
Do they take inputs? If so, what type of inputs do they require? (That is, what is their domain?)
+
Do they take report a value? If so, what type of value do they report? (That is, what is their range?)
+
+
+
Could you have defined a procedure somewhere instead of copying and pasting code?
+
+
+
When appropriate, you might want to include pictures of the stage or of important scripts in your code.
+
+
+
+
You don't need to copy things out of the curriculum into your journal; you can always look those up in the index.
The journal is for you, not for your teacher. You won't be graded on what you do or don't put in it. The journal isn't graded because it's a record of the things only you experience in the class, not a record of the ideas in the curriculum. Everyone's journal will be different.
+
+
+
diff --git a/cur/programming/1-introduction/4-privacy/1-your-image-in-the-cloud.html b/cur/programming/1-introduction/4-privacy/1-your-image-in-the-cloud.html
index 3d57a95f41..5be54d81e8 100644
--- a/cur/programming/1-introduction/4-privacy/1-your-image-in-the-cloud.html
+++ b/cur/programming/1-introduction/4-privacy/1-your-image-in-the-cloud.html
@@ -40,19 +40,30 @@
Your Image in the Cloud
One reason you are asked to choose a username when you get a Snap! account is to give you the freedom to express political or personal issues without tying those conversations to your actual identity.
-
Brian, look up CA law. -bh
-
- When you see this symbol in a yellow box:
-
- it means that what's in the box isn't something you have to read right now
- to be able to complete the lab, or to pass the AP exam, but it's something
- we think might be interesting to you. Click the link to see the text. Don't confuse that symbol with
- this other one:
-
- which means we want you to write something in your journal.
-
+
Brian, look up CA law. -bh
+
+
Brian, I cut the following because that symbol appears very rarely in the curriculum, and it was a lot of reading for something we hardly use. Instead, I just used the word next to the icon in the displayed yellow box below. All students need to know is that yellow is optional. --MF, 8/19/21
+
+ When you see this symbol in a yellow box:
+
+ it means that what's in the box isn't something you have to read right now
+ to be able to complete the lab, or to pass the AP exam, but it's something
+ we think might be interesting to you. Click the link to see the text. Don't confuse that symbol with
+ this other one:
+
+ which means we want you to write something in your journal.
+
+ The point of this yellow box is to distinguish a yellow box for
+ good students (these ones) from a yellow box for
+ struggling students (hints). The reason it's not widely
+ used in the curriculum is that I've barely begun the process of
+ adding this symbol everywhere it belongs. -bh
+
I think that's a problematic distinction. Who decides who a "good" student is? Kids get labeled as "good student" or "bad student" and then are treated differently for it and take it on as an identity rather than everyone treating it for all it really can be: someone's observation of how well they have been studying lately. And any student can benefit from a hint from time to time. We should discuss this in a meeting sometime. I might not mind what you are trying to do here, but I do mind that characterization. --MF, 8/20/21
United States law says that websites must have a privacy policy that spells out what the site will do with the information you give them. This is a pretty weak protection; the privacy policies are typically really long, and written in ways that make it hard to find out what information is collected and what is done with it. In Europe, there is now a General Data Protection Regulation (GDPR) that defines what counts as PII, and limits what websites can do without your affirmative permission—a definite "yes" from you, not just not saying "no"—regardless of what they put in their privacy policies. These regulations also state that the website cannot deny you otherwise free services because you refused to permit the use they want you to agree to.
Write code that will clear the drawings when space key pressed by the user.
-
The user will use the arrow keys to draw. You'll need a script for each key, starting with a when key pressed block:
-
-
+
+ The user will use the arrow keys to draw. You'll need a script for each key, starting with a when key pressed block:
+
For each of the four arrow keys, make the sprite point in the direction of the arrow and then move forward 10 steps.
Examples like this one are useful to test your understanding of assignment to variables, but you wouldn't use a sequence of assignments like this in an actual program.
+ What value will this code display?
a ← 3
b ← a
a ← 4
@@ -143,6 +144,8 @@
On this page, you'll continue to develop your number guessing game to accept player guesses until the player guesses correctly.
-
+
You'll want the computer to ask players to guess again and again until they guess correctly. To do that, you will use the block. Repeat until is a loop (just like repeat, forever, and for) but also a conditional (like if and if else). It repeats until a certain condition is met. For this program, the code should repeat until the player's answer equals the secret number.
@@ -112,9 +112,9 @@
Checking the Player's Guess
-
-
+
+
+
We really shouldn't be encouraging students to mutate a block's inputs. There are really two issues here; one is with the x=x+1 style of programming altogether, and the second is that formal parameters specifically shouldn't generally be mutated; it's better to make a script variable that's initialized to the input value. (If we change this, we need to update the Guided Notes.) --MF, 6/26/21 with BH
+
+
-
+
+
+
-
+
-
+
When the computer congratulates the player for guessing correctly, have the computer say the number. For example, it might say, "You guessed it! My secret number was 7."
-
+
Use join to merge the text "You guessed it! My secret number was" with the value of the secret number variable.
In the file is a definition of a number guessing game block. It has a bug—an error in the code that makes the program behave differently than expected. This code, if you keep playing over and over, will mostly work, but sometimes (not often) it will congratulate you before you even guess.
-
Analyze the code, explain how this can happen, and fix the bug.
+
Analyze the code, explain how this can happen, fix the bug, and save the project.
Have it pick its random number just from 1 to 3 to make the bug occur more often.
On this page, you will begin using a journal to keep track of your programming insights.
+
+ You can use a journal to learn from your own programming.
+ The journal is just a notebook in which you write notes to yourself,
+ like a diary. It's for you, not for your teacher.
+
+
+
+ Here are some ways to use your journal:
+
+
+ When you learn a new idea (not just the
+ name of a Snap! block), make a note of it.
+
+
When you make or discover a beautiful program—a beautiful piece of code, or one that draws a beautiful picture—print it out, or take a photo, and add it to your journal.
+
+ When you find a bug in your program, write down:
+
+
The symptom—How did you know there was a bug?
+
How you found the underlying problem—What steps did you take to find figure out what was going on?
+
The underlying problem—What was going on?
+
How you fixed it—Record anything that might be helpful next time you encounter a bug like this, or to help you avoid having a bug like this in the future.
+
+
+
When something inspires you to create a related program on your own, write down your idea for later.
+
+
This is just like recording bugs except that it’s a bug in your understanding rather than a bug in your code.
+ When you're asked to predict what some script will do, and your expectations turn out to be wrong, write down:
+
+
What you thought would happen
+
What actually happened
+
Why you thought what you thought
+
How you think about it now
+
+
+
+ When the curriculum asks you to write
+ your ideas about something, write in your journal.
+
+
+
+
+
+
+
Are there any bugs you've run into so far? Any cool project ideas? Any projects you've been proud of?
Need to decide whether/where to integrate pause all stuff lost with optionalization of mandala design and also to update debugging page. --MF, 7/5/19
On this page, you will begin to develop a quiz app by creating an abstract data type to pair the questions with their answers.
@@ -25,7 +24,8 @@
Planning a Quiz App
: Sublist
-
A sublist is a list as an item of another list.
+
A sublist is a list used as an item of another list.
+
(The word sublist is also used to refer to some subset of a list.)
You'll use a list to store your quiz items in a global variable and use a sublist for each question/answer pair. Then you can choose just one pair at a time to work with.
@@ -115,7 +115,7 @@
Specifying an Input Type
Test both the selectors for different items in your list of quiz items, and debug any problems.
-
+
Imagine you make a variable capitals and use set to give this list of lists a name:
@@ -151,7 +151,7 @@
Specifying an Input Type
- reports the number 8.
+ reports the number 8.
No. Each of the small lists is a single item in the list "capitals" .
@@ -165,10 +165,35 @@
Specifying an Input Type
Correct.
+
+
+ reports the string "Boise".
+
+
+ The items of capitals are lists.
+
+
+
+
+ reports the string "Iowa".
+
+
+ The items of all but first of (capitals) are lists.
+
Before telling the user the right answer, give them three tries to get it right.
- Users might give answers that are close enough but not exactly the answer you expected. For example, someone might answer "What kind of variable is available only in the part of the program where it is defined?" with "a local variable," "local variable," or just "local," or the same possibilities for "script variable." So your question answer ADT could take a list of keywords in the second slot and accept any answer that includes any of the keywords (so in this case, the list would be {local, script} and would accept "a local one"). Use to adapt your code.
+ Users might give answers that are close enough but not exactly the answer you expected. For example, someone might answer "What kind of variable is available only in the part of the program where it is defined?" with "a local variable," "local variable," or just "local," or the same possibilities for "script variable." So your question answer ADT could take a list of keywords in the second slot and accept any answer that includes any of the keywords (so in this case, the list would be {local, script} and would accept "a local one"). Use to adapt your code.
AAP-2.E part b, AAP-2.L, AAP-2.L.1, AAP-2.L.3, AAP-2.L.4, AAP-2.L.5
Here are four possible ways to define ≥. Discuss what advantages each style has:
@@ -35,11 +35,11 @@
Combining Conditionals
-
Look back at the first two examples in the previous problem. Since the predicate expression a=b will report true when they are equal and false otherwise, it's unnecessary to use the nested conditional statement in the first example, and the second example using the predicate inside the else part is sufficient. Sometimes, however (especially when you aren't building a predicate), it can be helpful to use nested conditional statements.
-
-
AAP-2.I.1, AAP-2.I.2
-
A nested conditional statement is an if or if else statement inside the else part of another if else statement. If the predicate of the outer if else statement is false, then inner (nested) conditional statement will test its predicate and decide what to do.
+
+
AAP-2.I.1
+
A nested conditional statement is an if or if else statement inside another if else statement.
+
Look back at the first two examples in the previous problem. Since the predicate expression a=b will report true when they are equal and false otherwise, it's unnecessary to use the nested conditional statement in the first example, and the second example using the predicate inside the else part is sufficient. Sometimes, however (especially when you aren't building a predicate), it can be helpful to use nested conditional statements.
On this page, you will use predicates with the keep block to keep items in a list that have specific characteristics.
-
As you know, predicates can be used with conditionals to decide when to do something; they can also be used with keep to decide which things to keep. The block takes a list and a predicate as input, and it reports a new list keeping only the items from the input list that make the condition described by the predicate true.
+
As you know, predicates can be used with conditionals to decide when to do something; they can also be used with keep to decide which things to keep. The block takes a list and a predicate as input, and it reports a new list keeping only the items from the input list that make the condition described by the predicate true.
For example, the following expression will find words from the words list whose first letter is v. The blank input slot is where each item of the list goes to decide if it will be kept.
diff --git a/cur/programming/2-complexity/4-making-computers-do-math/2-math-predicates.html b/cur/programming/2-complexity/4-making-computers-do-math/2-math-predicates.html
index 86bd1b755a..2371e3453e 100644
--- a/cur/programming/2-complexity/4-making-computers-do-math/2-math-predicates.html
+++ b/cur/programming/2-complexity/4-making-computers-do-math/2-math-predicates.html
@@ -110,7 +110,7 @@
The block takes two inputs: a list and an operation with two inputs, and it reports the result of combining all the elements in the input list using the input operation. For example, the expression below reports: 0 + 1 + 2.
+
The block takes two inputs: a list and an operation with two inputs, and it reports the result of combining all the elements in the input list using the input operation. For example, the expression below reports: 0 + 1 + 2.
You may find it useful to use maximum of list as well as divisors and also to build an intersection block that takes two lists as input and reports all of the items that are on both lists.
-
+ More detailed hints about greatest common divisor
In order to find the greatest common divisor of two numbers you will need to find:
diff --git a/cur/programming/2-complexity/5-copyrights/1-copyright.html b/cur/programming/2-complexity/5-copyrights/1-copyright.html
index 67adb44e83..9caac087f6 100644
--- a/cur/programming/2-complexity/5-copyrights/1-copyright.html
+++ b/cur/programming/2-complexity/5-copyrights/1-copyright.html
@@ -34,7 +34,7 @@
Copyright
If your class is like most classes, the first set of questions got very different responses from the second set. Discuss in small groups: Is it "stealing" to download artistic works without permission? Why or why not?
-
Discuss in small groups: Suppose anyone were allowed to download any music, movies, etc., they want. How would the artists (musicians, writers, producers, actors, and so on) support themselves?
+
Discuss in small groups: Suppose anyone were allowed to download any music, movies, etc., they want. How could the artists (musicians, writers, producers, actors, and so on) support themselves?
IOC-1.F.1
The copyright law makes it illegal for anyone to make copies of someone else's work (a book, a painting, a song, etc.) without the permission of the author. There are exceptions, as you'll learn later in this lab.
diff --git a/cur/programming/2-complexity/5-copyrights/2-fairuse.html b/cur/programming/2-complexity/5-copyrights/2-fairuse.html
index 05271aee90..71506b0e30 100644
--- a/cur/programming/2-complexity/5-copyrights/2-fairuse.html
+++ b/cur/programming/2-complexity/5-copyrights/2-fairuse.html
@@ -45,17 +45,39 @@
Fair Use
IOC-1.F.5
-
Creative Commons is a specific copyright license that allows others to use, share, and revise your work.
+
Creative Commons is a specific family of copyright licenses that allow others to use, share, maybe sell, and maybe revise your work.
-
Look at the very bottom of this page. This curriculum is under a CC-BY-NC-SA license, which is a Creative Commons (CC) license meaning that anyone can use and publish the curriculum or a modification of it, provided that they credit the authors (BY The University of California, Berkeley, and Education Development Center, Inc.), they use it not for profit (NC, non-commercially), and they license any modified version under the same terms (SA, share-alike). Because of the NC part, this is not technically a "free license," which would allow use for any purpose (including for-profit). People argue over whether it's ethically necessary to allow that much freedom of use.
+
Look at the very bottom of this page. This curriculum is under a CC-BY-NC-SA license, which is a Creative Commons (CC) license meaning that anyone can use and publish the curriculum or a modification of it, provided that they credit the authors (BY The University of California, Berkeley, and Education Development Center, Inc.), they use it not for profit (NC, non-commercially), and they license any modified version under the same terms (SA, share-alike). Because of the NC part, this is not technically a "free license," which would allow use for any purpose (including for profit). People argue over whether it's ethically necessary to allow that much freedom of use.
IOC-1.F.5
Ideas similar to Creative Commons are used for particular kinds of material:
-
Free software means software that anyone can copy, use, modify, and redistribute.
-
Open source software is a more general term that means that you put the program's code online. You may still restrict how people can use the program.
+
Free software means software that anyone can copy, use, modify, and redistribute, including commercially, provided that any modifications must be under the same license.
+ The reason for that restriction is to prevent other people from
+ turning a modified version of the software into non-free software
+ with restrictive licensing. That's the only thing you're not
+ allowed to do: make it unfree.
+
+
+
Open source software is a more general term that means that you make the program's source (human-readable) code available to anyone. You may still restrict how people can use the program.
+ One reason is for security software, so that people can check that
+ the software isn't leaking your password or other data, and will
+ therefore trust you. (One reason many people don't trust
+ computerized voting machines is that their manufacturers
+ keep their code secret.) Another reason for open source is that you're hoping other
+ people will contribute improvements to your proprietary software.
+
+
Open access scholarly research reports are available for free download, rather than requiring the permission of a journal publisher.
Notice that the parent sprite (not the clone) moves to the new random position after cloning itself. Look back at the code; why does this make sense?
-
Note that both the clones and the parent are sprites. Both are clickable (try it) and draggable (try that too). This is different from the effects of the stamp Pen block, which just leaves a picture of the sprite on the stage.
+
Note that both the clones and the parent are sprites. Both are clickable (try it) and draggable (try that too). This is different from the effect of the stamp Pen block, which just leaves a picture of the sprite on the stage.
The create a clone block takes an input because it can copy any sprite. In this project, there's only one sprite at the beginning, so your choices are either myself or Square (the sprite's name), which in this case, means the same thing.
diff --git a/cur/programming/3-lists/1-abstraction/6-debugging-recap.html b/cur/programming/3-lists/1-abstraction/6-debugging-recap.html
index 28a8f94506..8851cae0fe 100644
--- a/cur/programming/3-lists/1-abstraction/6-debugging-recap.html
+++ b/cur/programming/3-lists/1-abstraction/6-debugging-recap.html
@@ -1,23 +1,16 @@
-
+
-
-
+
+
-
- Unit 3 Lab 1: Dealing with Complexity, Page 6
-
+
+ Unit 3 Lab 1: Dealing with Complexity, Page 6
+
-
Debugging Recap
-
Brian and Mary need to wordsmith the first set of bullets (second set done). --MF, 12/16/18
-
-
PG: This is a discussion page, a recap. Summary's useful but "pick one and discuss" feels lame and empty to students, just make-work. Can we fix that?
-
BH: This is okay. I'm not sure it's necessary.
-
MF: It's a lot to look at. I had tried to break it up into chunks, but BH nixed that. Painful to look at as is…
-
-
+
Debugging Recap
On this page, you will review what you've learned about debugging in Snap!.
@@ -32,43 +25,36 @@
Debugging Recap
Tips
-
-
-
Don't delete your project and start over. This sounds obvious when you see it written down, but programming students sometimes get angry at their bugs. Remember that if you have a program with 20 blocks in it, and one of the 20 has an error, then your program is 95% correct.
-
Don't be hard on yourself.Everyone gets bugs in their programs; it's part of programming.
-
Don't add code to work around the bug. Don't edit the code at all (except to add temporary debugging code) until you understand why it's not doing what you intended, then remove the error. Think: "Debug by subtraction, not by addition."
-
Try to write beautiful code. If you're writing a quiz program to help someone learn the state capitals, then yes, in some way or another you're going to have 50 separate state-to-city connections in your project. But if you're writing a quiz program to help someone learn the multiplication tables, and you have 100 if blocks in your program, then you aren't taking advantage of the natural structure of the problem. The computer can figure out arithmetic answers for you. In general, a good rule of thumb is that if you can't see an entire script on your screen at once, it's time to stop and organize your code better.
-
How to find a bug:
-
-
Reproduce the problem so you are sure you know how to recreate it. This will help you know when you've fixed it.
-
Isolate the piece of code producing the error. Test pieces of your code separately so you know what's working and what isn't.
-
Identify the specific cause of the error within that code. Why is that code doing the wrong thing?
-
Always test your code with different inputs. Look for extreme cases: What if the input is really big, zero, negative, or a decimal? What if the user types something you aren't expecting? What if the user clicks somewhere else?
-
-
- Love your bugs! They pose an interesting puzzle. Sometimes their incorrect behavior suggests another project:
+
+
+
Try to write elegant code. If you're writing a state capitals quiz, then you'll need to store every state and capital in your program, but if you're writing a multiplication quiz you can have the computer calculate the answers. Take advantage of the natural structure of the problem you are solving.
+
AAP-2.B.7
Use abstraction to hide complexity. Isolate some details into an custom block, and get that working right. Then use that abstraction just as if it were built into Snap!. Abstraction allows you to build and test pieces of your code one at a time; it makes your code more readable. If you can't see an entire script on your screen at once, it's time to stop and organize your code.
+
Don't delete your project and start over. This sounds obvious when you see it written down, but programming students sometimes get angry at their bugs. Remember that if you have a program with 20 blocks in it, and one of the 20 has an error, then your program is 95% correct.
+
+ How to find a bug:
+
+
Reproduce the problem so you are sure you know how to recreate it. This will help you know when you've fixed it.
+
Isolate the piece of code producing the error. Test pieces of your code separately so you know what's working and what isn't.
+
Identify the specific cause of the error within that code. Why is that code doing the wrong thing?
+
Always test your code with different inputs. Look for extreme cases: What if the input is really big, zero, negative, or a decimal? What if the user types something you aren't expecting? What if the user clicks somewhere else?
+
+
+
Don't add code to work around a bug. In fact, don't edit buggy code at all (except to add temporary debugging code) until you understand the problem; then remove the error. Think: "Debug by subtraction, not by addition."
+
Don't be hard on yourself.Everyone gets bugs in their programs; it's part of programming.
+
If it works, it's correct. You don't need to ask your teacher "Is this right?" The computer will tell you whether your solution is correct, and more than one solution may work.
+
Be open to new ideas. Especially if you learned to program before this course, a few of the ideas in this course might seem strange to you, such as the use of higher order functions instead of looping. One of the goals of BJC is to introduce you to different ways of organizing a program that make the code shorter and don't have as many openings for bugs to creep in.
+
+ Love your bugs! They pose an interesting puzzle. Sometimes their incorrect behavior suggests another project:
-
-
Keep the following two opposite ideas in mind at once:
-
-
If it works, it's correct. One of the school rituals hated by both students and teachers is everyone tugging on the teacher's sleeve saying "Is this right?" One of the joys of programming is that the computer itself will tell you whether your solution is correct. But also...
-
Be open to new ideas. This is especially important if you've programmed before. If you automatically write
-
- before you've even read the problem statement, then one of our goals in this course is to introduce you to different ways of organizing a program, such as higher order functions, that make the code shorter and don't have as many openings for bugs to creep in.
-
-
-
-
AAP-2.B.7
-
- Use abstraction to hide the complexity of code. Abstraction is a way of thinking; you tuck some details into one part of your code and get them working right, and then use that chunk confidently, just as if it were built into Snap!. Some examples of using abstraction include creating custom blocks and using abstract data types. These kinds of abstraction allow you to build and test pieces of your code one at a time, so bugs are automatically isolated. Abstraction makes your code readable.
-
-
-
+
+
+
-
Which of these tips would have helped you address an issue in debugging? Pick one and discuss your experience with your partner.
+
Which of these tips would have helped you debug one of your projects? Pick one and discuss your experience with your partner.
+
Choose one of these tips that doesn't make sense to you, and try to figure out why we included it.
@@ -78,16 +64,12 @@
Snap! Debugging and Organizing Tools
You learned about
-
This doesn't happen here any more.... --MF, 7/5/19
- If your "brick" has rounded ends, remember that you can change how lines are drawn by clicking the settings button () in the toolbar, and turning on "Flat line ends." Rounded ends stick out beyond the length you specified. Here's a picture of the rounded brick with a regular line (pen size 1) of the same length inside it:
+ If your "brick" has rounded ends, remember that you can change how lines are drawn by clicking the settings button () in the toolbar, and turning on "Flat line ends." Rounded ends stick out beyond the length you specified. Here's a picture of the rounded brick with a regular line (pen size 1) of the same length inside it:
Rounded ends are better for most line drawings, but not for drawing bricks.
So you need to be able to show a name first name first for ordinary display, but last name first for sorting.
+
+ Before you begin, save your project again, under the name U3L2-TIF. This will keep your work on these problems separate from the regular problems.
+
+
The first step is to create an abstract data
type for names. You'll need a constructor that takes first name and last name as inputs, and reports a list of them to represent the name part of a contact.
@@ -130,7 +134,7 @@
Collecting Data from the User
Writing a name: Your name from contact block will now report a list, as it should. But some other parts of the program, such as the part that displays a contact to the user, want to display the name as a text string: "Betsy Anderson." The part that sorts the contact list also wants a string: "Anderson, Betsy." Write two blocks and that join the two parts of the name with a space and/or a comma as needed.
This three-step process (create an ADT, use it to read values of that type, use it to write values of that type) is very common in programming. You'll follow the same three steps again in the Take It Further on page 4.
-
On page 4 you're going to find a contact by letting the user enter any part of the name, and display the entire contact. Use the name abstraction you've just created when you do that.
+
Save your work. On page 4 you're going to find a contact by letting the user enter any part of the name, and display the entire contact. Use the name abstraction you've just created when you do that.
This set of exercises requires that you've already done the Take It Further exercises on page 2.
+
This set of exercises requires that you've already done the Take It Further exercises on page 2. Open your project U3L2-TIF.
Write a predicate function that takes two contacts as inputs. It should return True if the first contact belongs before the second one in a sorted contact list. That is, you'll have to extract the names (in sorted form) from the two contacts, and then use < to compare them. Respect the data abstractions.
- The block takes two inputs: a function (a reporter with a blank input slot) and a list, and it reports a new list in which each item is the result of calling the function with an item from the original list as input. For example:
+ The block takes two inputs: a function (a reporter with a blank input slot) and a list, and it reports a new list in which each item is the result of calling the function with an item from the original list as input. For example:
Dan had some thoughts on this next section that we implemented but then reverted. Here are the edits that were made and removed:
Write a reporter that takes any part of a person's name as input, and reports a list of all the phone numbers of the people whose names match. You will need:
-
(instead of empty) c. , which performs a function over each item of the list.
+
(instead of empty) c. , which performs a function over each item of the list.
The problem with these unimplemented edits was that they required more complicated programming than is appropriate for this point in the curriculum. It would, of course, be nice if the program handled the case of multiple search results better than just returning the first one, and that should be addressed at a later point. --Aug 2016
@@ -35,7 +35,7 @@
ContactList App
Write a reporter that takes any part of a person's name as input, and reports that person's phone number, or "not found" if the name is not in the contact list. You will need:
, which lets you find out whether one string (a contact's name in the list) contains another string (a name or part of a name).
-
, which filters the list for only the items that make the function true.
+
, which filters the list for only the items that make the function true.
, which returns true if the list is empty and false otherwise.
For each of the following reporters, discuss what you think it does. Then, experiment using the Brazil data list (shown right) and see what happens.
-
-
+
+
@@ -68,7 +68,7 @@
Exploring List Processing
-
Figure out two different tests to use with on the list so that keep reports {Haiti, Japan}
+
Figure out two different tests to use with on the list so that keep reports {Haiti, Japan}
Find a way to use keep with the same list, so that your code reports only the countries from the list with names longer than 7 characters.
Teaching robots right from wrong isn't just about AI as weapons.-->
What about a self-driving car that has to make a choice between the life of its passenger and the life of a pedestrian? How does that choice get made?
There's also the issue of who gets the benefits of AI. The people whose jobs are being replaced by robots are disproportionately lower-income. How can we make sure that everyone benefits from developments in AI?
- What laws apply to AI? What happens with a robot commits a crime? Who gets punished?
+ What laws apply to AI? What happens when a robot commits a crime? Who gets punished?
- What should your procedure report in the recursive case? You have to find a smaller, similar subproblem just as you did for the triangle fractal. Generally, when writing recursive blocks with lists as input, the most common idea is to split the list into its first item () and all the other items ().
-
and are the main selectors for lists.
+ What should your procedure report in the recursive case? You have to find a smaller, similar subproblem just as you did for the triangle fractal. Generally, when writing recursive blocks with lists as input, the most common idea is to split the list into its first item () and all the other items ().
+
Selectors are all you needed for problem 6 because the reported result wasn't a list. If you want to write a recursive block that reports a list, you also need the constructor , which makes a new list with one new item in front of an existing list.
+
Selectors are all you needed for problem 6 because the reported result wasn't a list. If you want to write a recursive block that reports a list, you also need the constructor , which makes a new list with one new item in front of an existing list.
Remember the steps: What's the base case? What should you report in that case? What should you do with the first list item? What will you do with the rest of the input list? And what combiner do you need to put those together?
In this lab you will sort your contact list alphabetically by name. On this page you will use recursion to examine the items of a list one by one.
-
You've already used the block to look at a single item from a list. Here you'll use to deal with the rest of the list.
+
You've already used the block to look at a single item from a list. Here you'll use to deal with the rest of the list.
Adding the numbers in a list.
@@ -43,7 +42,7 @@
Walking Down a List
- and are the selectors for the List data type. The corresponding constructor is .
+ and are the selectors for the List data type. The corresponding constructor is .
Copying a list.
diff --git a/cur/programming/3-lists/old/3-three-key-list-ops/2-map.html b/cur/programming/3-lists/old/3-three-key-list-ops/2-map.html
index ecb9a05c68..c5bfb0de20 100644
--- a/cur/programming/3-lists/old/3-three-key-list-ops/2-map.html
+++ b/cur/programming/3-lists/old/3-three-key-list-ops/2-map.html
@@ -18,7 +18,7 @@
The Map Block (Teacher's Choice)
- The block takes two inputs: a function (with a blank input slot) and a list, and it reports a new list. In this new list, each item is the result of running an item of the original input list through the function. For example:
+ The block takes two inputs: a function (with a blank input slot) and a list, and it reports a new list. In this new list, each item is the result of running an item of the original input list through the function. For example:
@@ -27,7 +27,7 @@
The Map Block (Teacher's Choice)
You write the function that describes the change, and map applies that function to each item in the input list and then reports the list of values changed by the function.
-
The gray ring in means that the input should be a function. The function can be numeric as in algebra, for example: (as we'll explore later) or (as shown above), but you can also use other operators like : the map function above joins each word with the letter 's'. The blank input slot in the function is filled with each list item to make the new list. In algebraic functions, that's the variable, for instance: that's the x in the function f defined by f(x) =3x + 7.
+
The gray ring in means that the input should be a function. The function can be numeric as in algebra, for example: (as we'll explore later) or (as shown above), but you can also use other operators like : the map function above joins each word with the letter 's'. The blank input slot in the function is filled with each list item to make the new list. In algebraic functions, that's the variable, for instance: that's the x in the function f defined by f(x) =3x + 7.
- The block takes a predicate (with a blank input slot) and a list as input and creates a new list keeping only those items from the input list that match some criterion, such as "begins with a vowel," "is less than five characters long," "is even," or "is a vegetable." For example:
+ The block takes a predicate (with a blank input slot) and a list as input and creates a new list keeping only those items from the input list that match some criterion, such as "begins with a vowel," "is less than five characters long," "is even," or "is a vegetable." For example:
These COMBINE example images are out of date. --MF, 6/11/21
- The block takes an operation (with two blank input slots) and a list as input and reports a single result: the combination for all of the elements of the list when using the given operation. For example:
+ The block takes an operation (with two blank input slots) and a list as input and reports a single result: the combination for all of the elements of the list when using the given operation. For example:
Betty: OK, let's try it. I'm just going to make up a variable called "list of numbers". Then we'll keep the numbers over 50.
Betty builds this expression:
Alphie: Then we add 10 to every item using map. And the list we're mapping over is everything over 50 that we kept, so let's just drag everything in our keep expression in there.
+
This image of map is outdated. --MF, 6/11/21
Alphie builds this expression using Betty's:
Betty: Your last idea was to add all these new numbers up, right? So we'll use combine with and addition, and our list is everything in the map expression.
- Implement in snap, and use it to classify the messages in our data. You can use a regular loop to call your classify on the second item in each row of the data, or you might use this faster method using :
+ Implement in snap, and use it to classify the messages in our data. You can use a regular loop to call your classify on the second item in each row of the data, or you might use this faster method using :
- In this project you will create a mathematical art design and explore its variations.
-
+ In this project, you will create a mathematical art design and explore its variations. (Click the picture to see an animation.)
+
- Watch the following video. Discuss with your partner how would you design such a project. Be sure to explore what data needs to be tracked and how lists can be employed to keep track of this data.
+ Discuss with your partner how would you design such a project. Be sure to explore what data needs to be tracked and how lists can be employed to keep track of this data.
Tips to guide your thinking:
diff --git a/cur/programming/4-internet/1-reliable-communication/1-what-is-internet.html b/cur/programming/4-internet/1-reliable-communication/1-what-is-internet.html
index 4c43608b5a..0fec5e04bc 100644
--- a/cur/programming/4-internet/1-reliable-communication/1-what-is-internet.html
+++ b/cur/programming/4-internet/1-reliable-communication/1-what-is-internet.html
@@ -8,7 +8,20 @@
What Is the Internet?
-
+
+ Consider adding BTB content back:
+
+ Several pages in this lab suggest a brief reading from the Blown to Bits appendix in the "If There Is Time" sections:
+
Page 4: Who's in Charge of the Internet? Blown to Bits pages 312-316. Ideally, this assignment will be read before the class period that covers that lab page.
+
+
+
+
+
In this lab, you will learn how the Internet works.
On this page, you will learn the basics of what the Internet is, what's most important about how it works, and what it means to store information in "the cloud."
@@ -51,7 +64,7 @@
How Does the Internet Work?
The Internet isn't just a network of computers, though. It's a network of networks. The connection points between networks are called routers, networking devices that route traffic between subnetworks on the Internet. Making sense of the information happens at the destination computer.
Unless your data is encrypted, it can be read or modified as it's being sent over public networks. One way that this can happen is through a rogue access point.
-
: A rogue access point is a wireless access point that gives access to a secure network without the authorization of the network administrator.
+
:
A rogue access point is a wireless access point that gives access to a secure network without the authorization of the network administrator.
A rogue access point may be installed by someone trying to improve access to the network or by an attacker. But either way, the lack of proper security can allow data being sent over that WiFi network to be intercepted. For example, if your computer has password access to a WiFi network, and you enable Bluetooth network sharing, you are allowing anyone in Bluetooth range of your computer access to the secure network.
You can use bignums in any Snap! project by importing the "Infinite precision integers, exact rationals, complex" library.
You learned to import libraries on the Libraries page.
They did not. --MF, 6/13/19
+
You can use bignums in any Snap! project by importing the "Bignums, exact rationals, complex #s" library.
You learned to import libraries on the Libraries page.
They did not. --MF, 6/13/19
Click on this block in the scripting area:
diff --git a/cur/programming/4-internet/4-representation-compression/6-compression.html b/cur/programming/4-internet/4-representation-compression/6-compression.html
index ac04a6d7d9..6d48d2ac78 100644
--- a/cur/programming/4-internet/4-representation-compression/6-compression.html
+++ b/cur/programming/4-internet/4-representation-compression/6-compression.html
@@ -24,7 +24,7 @@
Data Compression
There are two broad categories of data compression algorithms: lossless and lossy, depending on whether information is lost.
: Lossless Compression
-
Lossless data compression algorithms (such as PNG) are reversible (there is no loss in quality); you can reconstruct the original data.
+
Lossless data compression algorithms (such as PNG) are reversible (there is no loss in quality); you can reconstruct the original data.
DAT-1.D.4
@@ -57,7 +57,7 @@
Data Compression
DAT-1.D.2
Those six values (60, FFFFFF, 5, E5A84A, 93, FFFFFF) can be reconstructed into that whole first row of the image (158 pixels). So, fewer bits does not necessarily mean less information.
: Lossy Compression
-
Lossy data compression algorithms are not fully reversible; you can reconstruct only an approximation of the original data.
+
Lossy data compression algorithms are not fully reversible; you can reconstruct only an approximation of the original data.
DAT-1.D.5
Lossy Compression works by removing details that people aren't likely to notice. The most commonly used lossy compression algorithm for pictures is called JPEG (or JPG, both pronounced "jay peg" for "Joint Photographic Experts Group," the committee that invented it). JPEG works by preserving most of the brightness information for each pixel (since human eyes are sensitive to that) and performing a kind of averaging process to the color information (because human eyes aren't as good at distinguishing color, especially colors close to white).
Experiment with the block using a few different input lists.
- What does this block report?
-
+
Experiment with the block using a few different input lists. What does this block report?
Finish building the are the items distinct? predicate, which is started below. Since you're writing a predicate, your procedure should always report true or false.
Brian wants to do something with a real example (like weather modeling). --MF, 2/20/18
-
PG: SCRAP. What I really mean is change, but major change. Again, what we're seeing is how clever someone else can be. Learning to model is different. The first few pages of DHH's Calculus text does a great job if building an intellectual model that could be programmed in Snap. Weather could be ok, but I think the disease spread might be easier to understand and model. I'd keep the /idea/ here, but stop trying to show off /our/ projects and instead teach a kid how to model.
+
+
Paul suggested we review DHH's Calculus text, which does a great job of building an intellectual model that could be programmed in Snap. --MF, 6/27/21 with BH
On this page, you will model the spread of a disease in a population.
-
-
Someone could easily cut frames to make this 2MB or even less. --MF, 5/31/20
+
+
Note: There was a disease spread simulation in BJC long before covid-19, but we want to acknowledge that right now the spread of a disease isn't an abstract question. Everyone has been affected by isolation at home, and some students may have lost loved ones to this disease. Medical researchers do use simulations (much more complex than this one) to try to predict the future course of the disease.
-
Suppose you are a medical researcher at the Centers for Disease Control (CDC) and would like to understand the factors that contribute to the spread of a new disease. In particular, you want to know the effect of population size on the time it takes for everyone to be infected.
+
Suppose you are a medical researcher and would like to understand the factors that contribute to the spread of disease. In particular, you want to know the effect of population size on the time it takes for everyone to be infected, under the simplifying assumption that once infected, a person stays infected.
-
What would be a sensible hypothesis on how population size affects the elapsed time?
-
What if the space the people lived in (in the simulation, the size of the Snap! stage) was twice as big?
+
What would be a sensible hypothesis on how population size affects the elapsed time?
+
What if the people interacted with one and other more frequently?
-
You may not have enough data from actual outbreaks to test your hypothesis and make any meaningful conclusions, and it would be unethical to induce the disease in a population just to gather new data. In this situation, a simulation would be the best option to generate data to test your hypotheses without the constraints of time, cost, and ethics.
-
In this project, you will simulate the spread of a disease within a small population and explore the effects of variables such as population size and speed of human interaction on the spread of disease.
+
You may not have enough data to test your hypothesis, and it would be unethical to induce the disease in a population just to gather new data. A simulation would allow you to test your hypotheses without the constraints of time, cost, and ethics.
-
- Write a simulation that will:
+
+
+ It includes:
-
How do you make a collection of identical sprites? Create a single person sprite, and use the create a clone of myself block. You learned how to clone a sprite in Unit 3 Lab 1 Page 5: Building a Tic-Tac-Toe Board.
-
Take 3 inputs: the population size, the percentage of the population initially infected, and the speed at which the simulated people should be moving around.
-
Infect a healthy person when they touch a sick person.
-
When the entire population becomes sick, stop the animation and report the duration of the outbreak.
+
a population variable that stores the total number of people (represented by clones of a sprite)
+
a percent initially infected variable that stores the fraction of the population who are sick at the beginning of the simulation
+
a speed variable that stores the pace at which the clones move
+
a sprites ready? variable that stores a Boolean that keeps track of whether or not all the clones have been created and the simulation can begin
+
a number infected variable that keep track of how many clones are currently infected
+
an infected?sprite-local variable that stores a Boolean that keeps track of whether or not a clone is sick (each clone will have its own separate variable with that name)
+
two costumes, sick () and well (), that display the status of each clone
The primitive block reports a list of sprites that are near the sprite that uses it.
+
+ a simulate disease function for you to complete that takes three inputs: total population, percent initially infected, and sprite speed; creates the clones that enact the simulation; and outputs the time until the entire population is infected
+
+
an initialize simulation block that initializes the global variables and sets the parent sprite costume
+
a touching infected person? predicate for you to complete that checks whether the current clone is being exposed to the disease
+
an initialize clone block that decides whether a clone will start out sick and positions it randomly on the stage
+
a when I start as a clone script for you to complete that moves the clones until they are all infected
-
-
-
-
Using clones is a form of parallelism. But as you learned on the Unit 5 Lab 1 Page 8: Parallelism, because the clones are all running on one processor, cloning doesn't give you any speedup.
-
-
-
-
Discuss how your simulation may be similar to and different from a real-life disease outbreak. Identify the simplifying assumptions you made in this simulation.
+
Complete the simulate disease function, the touching infected person? predicate, and the when I start as clone script.
+
Discuss how your simulation is similar to and different from a real-life disease outbreak. Identify the simplifying assumptions you made in this simulation.
+
+
+
You want to know the effect of population size on the time elapsed. Because there is some randomness in the simulation, you are going to get some variation in the reported time. (This isn't a bug; in real life, random events affect the elapsed time.)
+
+
AAP-3.F.8
- You want to know the effect of population size on the time elapsed. Because there is some randomness in the simulation, you are going to get some variation in the reported time. (This isn't a bug; in real life, random events affect the elapsed time.) Write a function in Snap! that runs the simulation 10 times while keeping the percent initially infected at 10 and the speed of infection at 2, and reports the average time elapsed.
+ Write a function that takes population size as input, runs the simulation ten times, keeps the percent initially infected at 10 and the speed of infection at 2, and reports the average time elapsed.
AAP-3.F.7
-
Call this function four times with different populations (50, 100, 150, and 200), and write down the results. Create a refined hypothesis about the relationship between population size and time for the entire population to be infected.
+
Using clones is a form of parallelism. But as you learned on the Unit 5 Lab 1 Page 8: Parallelism, because the clones are all running on one processor, cloning doesn't give you any speedup.
+
Call this function four times with different populations (50, 100, 150, and 200), and write down the results. Create a refined hypothesis about the relationship between population size and time for the entire population to be infected.
In real disease scenarios, not everyone ends up getting sick. How would you decide if the simplifications you used in a simulation invalidate the conclusions you might draw?
-
This is a simplified model. There are many things you could do to make the model more realistic. For example, you could make the infected people heal over time, or you could add doctor sprites who can heal sick sprites, but you will always have to make some simplifications.
+
This is a simplified model. There are many things you could do to make the model more realistic. For example, you could make the infected people get better over time or some people could be immune to the disease, but you will always have to make some simplifications.
-
Do we need the commented out text in the TIF? --MF, 5/31/20
Now conduct a similar experiment holding population size constant and varying the percent initially infected. Come up with a hypothesis for this relationship.
@@ -80,10 +92,10 @@
Disease Spread Project
a single line where the customers stand in arrival order and wait for the next available teller, or
separate lines for each teller.
-
Do we need this commented out text? --MF, 5/31/20
- Design and implement two simulations in Snap! to help the bank determine the average wait time for customers in each scenario in order to choose the best option.
+ Design and implement two simulations in Snap! to help the bank determine the average wait time for customers in each scenario in order to choose the best option.
+
Do some research: Why do (most) banks use a single teller line, but (most) grocery stores use a line per checkout station?
EK 1.3.1E Computing enables creative exploration of both real and virtual phenomena.
+
EU 2.3 Models and simulations use abstraction to generate new understanding and knowledge.
+
LO 2.3.1: using a model of a population and simulating interactions among that population.
+
LO 2.3.1 Use models and simulations to represent phenomena. [P3]
+
EK 2.3.1A Models and simulations are simplified representations of more complex objects or phenomena.
+
EK 2.3.1B Models may use different abstractions or levels of abstraction depending on the objects or phenomena being posed.
+
EK 2.3.1C Models often omit unnecessary features of the objects or phenomena that are being modeled.
+
EK 2.3.1D Simulations mimic real world events without the cost or danger of building and testing the phenomena in the real world.
+
LO 2.3.2 is in #1, 4, and 5
+
LO 2.3.2 Use models and simulations to formulate, refine, and test hypotheses. [P3]
+
EK 2.3.2A Models and simulations facilitate the formulation and refinement of hypotheses related to the objects or phenomena under consideration.
+
EK 2.3.2B Hypotheses are formulated to explain the objects or phenomena being modeled.
+
EK 2.3.2C Hypotheses are refined by examining the insights that models and simulations provide into the objects or phenomena.
+
EK 2.3.2D The results of simulations may generate new knowledge and new hypotheses related to the phenomena being modeled.
+
EK 2.3.2E Simulations allow hypotheses to be tested without the constraints of the real world.
+
EK 2.3.2F Simulations can facilitate extensive and rapid testing of models.
+
EK 2.3.2G The time required for simulations is impacted by the level of detail and quality of the models, and the software and hardware used for the simulation.
+
EK 2.3.2H Rapid and extensive testing allows models to be changed to accurately reflect the objects or phenomena being modeled.
+
+
+
+
Brian wants to do something with a real example (like weather modeling). --MF, 2/20/18
+
+
+
On this page, you will model the spread of a disease in a population.
+
+
+
+
+
+
Suppose you are a medical researcher at the Centers for Disease Control (CDC) and would like to understand the factors that contribute to the spreading of a new disease across a population. In particular, you would like to know the effect of population size on the rate at which the disease spreads.
+
+
+
+
What would be a sensible hypothesis on how population size relates to the rate of the spread of the disease?
+
+
+
+
You may not have enough data from actual outbreaks to test your hypothesis and make any meaningful conclusions, and it would be unethical to induce the disease in some population in order to gather new data. In this situation, a simulation would be the best option to generate data in order to test your hypotheses without the constraints of time, cost, and ethics.
+
In this project, you will simulate the spread of a disease within a small population and explore the effects of variables such as population size and speed of human interaction on the spread of disease.
+
+
+
+
Play with the Snap! file
+
+
+ linked here to get a feel for the simulation program you will be writing.
+
+ Your code should:
+
+
Ask the user for 3 inputs: the population size, the percentage of the population initially infected, and the speed at which the people should be moving.
+
Create a single person sprite and use the create a clone of myself block to generate a population with the size inputted by the user.
+
Do this on your own but if you get stuck, you can use this page for hints.
+
Make the user-specified percentage of the population sick and the rest of the population healthy.
+
Have a timer measure the duration of the outbreak (until everyone is infected).
+
Have the people move around with the constant speed inputted by the user.
+
Make sure that when a healthy person collides with a sick person, they also becomes sick.
+
Stop the animations and the timer when the entire population becomes sick.
+
+
+
Discuss how your simulation may be similar to and different from a real life disease outbreak. Identify the simplifying assumptions you made in this simulation.
+
+ Study the relationships between the various variables in the simulation:
+
+
the population size
+
the percentage of the population initially sick (percent initially sick)
+
the speed at which the people move
+
time elapsed (at the point when the entire population becomes sick)
+
+
Brian, I made light edits to the following line and I split off the end of #5 into a new <li>; if you agree, this changes needs to be made to the solution file too. Also, the solution file still has single-letter variables in it toward the end. --MF, 2/22/18
+ Create a hypothesis predicting the pattern(s) that will emerge in the simulations.
+
+
For example, to understand the effect of the population size on the time it takes the disease to fully spread (time elapsed), you might fix population size at 10 and speed at 2, and use your simulation to make a chart of time elapsed (on the vertical axes) as a function of population size (on the horizontal axis) in increments of 10 for population size.
+
Perform similar experiments to understand the effect of initial percentage of the sick and to understand the effect of agent speed.
+
Since the results of each run are partly random, you may need to run each particular simulation several times and take an average.
+
+
+
+
Create a visual graph of your findings. Do you see any patterns? Do they agree with your hypothesis? If not, make a new hypothesis. How can you study the effects of other variables with your simulations?
+
+
+
This is a simplified model. There are many things you could do to make the model more realistic. For example, you could make the infected people heal over time, or you could add doctor sprites who can heal sick sprites. But if you included all the things that happen in real human populations in your simulation, it would slow down the simulation too much to use. Updating your software or upgrading your hardware may help you include more details in your simulation, but you will always have to make some simplifications.
+
There was a time when weather scientists could do a good job of predicting the weather with a complicated model. The only problem was that the computers back then took several days to run the model, so the predictions weren't ready in time. Computers these days can run many complicated weather models fast enough to predict the weather reasonably well.
+
+
+
+ Here are some possible variations on this simulation that could make it more realistic. Save a copy of your work before exploring one or more of these variations:
+
+
Give a probability to being infected when a healthy person encounters a sick person.
+
Let the infected people slow down in speed.
+
Let the infected people heal either with time or by a probability.
+
Let those infected and then healed become immune to the sickness.
+
Introduce doctor sprites that heal the sick upon encounter.
+
At the start of simulation, introduce vaccination to a given percentage of the population.
+
+
+
Design and implement a predator-prey simulation in Snap!. For example, you could model an environment with wolf and deer populations where the wolf prey on the deer. What are some parameters you need to incorporate into your model so you can simulate realistic fluctuations in the populations of predator and prey?
+
+ Imagine you work at a bank that wants to minimize customer wait times in line. The bank is considering two alternatives:
+
+
a single line where the customers stand in arrival order and wait for the next available teller, or
+
separate lines for each teller.
+
+ Design and implement two simulations in Snap! to help the bank determine the average wait time for customers in each scenario in order to choose the best option.
+
+
Classifying data is extracting groups of data with a common characteristic.
Another thing that's often done in data science is grouping (or classifying) data. For example, here is the cars data grouped by vehicle make (column 14):
-
+
Column A shows all of the vehicle makes (field 14 of each record).
Column B shows the total number of vehicles of each make.
@@ -32,7 +31,7 @@
Grouping Data
-
The by intervals of input to group should be left empty when, as in this example, the field on which you're grouping is text rather than numbers. Later on this page you'll see how to use intervals in graphing.
+
The by intervals of input to the group table block should be left empty when, as in this example, the field on which you're grouping is text rather than numbers. Later on this page, you'll see how to use intervals in graphing.
@@ -46,8 +45,7 @@
Grouping Data
How many Toyotas are in the database?
-
Which brand in the table has the
- most models listed?
+
Which brand in the table has the most models listed?
How many 2010 Hyundais are in the database? (This requires looking inside one of the lists in column C, so you'd need two keep functions.)
Pipe may be useful for questions that require looking inside the inner lists of the grouped data (in column C).
@@ -60,12 +58,10 @@
Grouping Data
Plotting Data
-
image needs alt/title text. --MF, 6/27/19
- The bar chart function works like the group function, but with special features for numeric data: it allows you to select upper and lower limits of the data; you can have a range of values in one bucket, such as values 6–10, values 11–15, and so on; and it sorts the groups. For example, here is the cars data grouped by city MPG (column 9):
-
+ The bar chart function works like the group function, but with special features for numeric data: it allows you to select upper and lower limits of the data; you can have a range of values in one bucket, such as values 6–10, values 11–15, and so on; and it sorts the groups. For example, here is the cars data grouped by city MPG (column 9):
+
Now, Column A shows city MPG (field 9 of each record) grouped into intervals of 5 and sorted.
-
It's potentially confusing that there are two inputs of 5 in the image because when you read the bullet above it's temping to see that as being about the first and second inputs rather than the first and last. --MF, 7/13/20
As before, Column B shows the total number of vehicles within each MPG range (0–5, 6–10, 11–15, etc.)
As before, Column C contains a list of all the data from cars within that MPG range (such as all the data for the 879 cars that get between 21 and 25 MPG in the city).
@@ -75,46 +71,37 @@
Plotting Data
You can plot the data from bar chart to visualize them:
-
images need alt/title text. --MF, 6/27/19
-
-
+
+
-
Nothing to pipe, really, with the new blocks. -bh
-
- This plot instruction with pipe will generate the same image as the plot instruction without pipe above.
-
-
-
-
-
-
+
+
-
This is kind of an awkward and anti-climatic place to land. Why aren't they making a histogram about their chosen dataset and using it for further analysis? I suggest adding problem 9 (pasted just below) from the CSTA version here before the mode analysis. --MF, 7/13/20
-
Plot a few bar charts of some fields from your dataset and make at least one new observation about your data.
-
-
Brian, these images need alt/title text. Also, can you please remove the sprite showing at the bottom? --MF, 7/13/20
+
Plot a few bar charts of some fields from your dataset and make at least one new observation about your data.
-
The mode of a data set is the value that appears most often in it.
- Here is a bar chart of field 11 from the cars data set (highway MPG) with MPG values from 5 to 50, using an interval of 3. Identify the mode. It will be a range of values such as 13–15 or 16–18.
-
-
+
The mode of a data set is the value that appears most often in it.
+ Here is a bar chart of field 11 from the cars data set (highway MPG) with MPG values from 5 to 50, using an interval of 3. Identify the mode. (It will be a range of values such as 13–15 or 16–18.)
+
+
Here is another bar chart with all the inputs the same as before, but with an interval of 6. Identify the mode.
-
-
+
+
-
How can these results both be correct? (There's nothing wrong with the graphs.)
-
Why would you ever use an interval larger than 1? If you have time, research this question.
+
How can these results both be correct? (There's nothing wrong with the graphs.)
+
Why would you ever use an interval larger than 1?
-
I'm wondering about offering the kids the video or part of it on the page or in the TIF (the teachers should definitely see it). --MF, 6/26/19
-
+
+
+
Research the question of why would you ever use an interval larger than 1.
+ I changed the name, so as not to imply that they now know all about
+ Snap! and should move on.
+
+
+
On this page, you will learn about other programming languages and how to learn them, now that you know Snap!.
+
+
Sequential Languages
+
+
A programming language is characterized by two things: a philosophy of programming and details of notation.
+ Most modern programming languages, including Snap!, are
+ multiparadigm, which means that they take ideas from
+ several different approaches to programming style. Nevertheless,
+ most are basically sequential (do this instruction, then
+ do this, then do this). This includes Snap!, even though
+ you have learned some composition (nesting) of functions and
+ some ideas about sprites as objects.
+
Learning another language of the same type is much easier than learning your first one. For example, here’s the binary search function from
+ Lab 1 of this unit:
+
+
+
+
Python
+
+
Here's the same procedure written in Python:
+
+def binary_search(value, data):
+ low = 0
+ high = len(data)-1
+ while (low <= high):
+ current_index = average(low, high) # find the middle word
+ current_item = data[current_index]
+ if (current_item == value):
+ return True
+ elif (current_item > value): # eliminate half the list
+ high = current_index-1
+ else:
+ low = current_index+1
+ return False
+
+
+
For the most part, this is line for line the same as the Snap! version.
+ Apart from tiny details such as return instead of
+ report, there are a few more significant differences in notation:
+
+
+ In Python, there's nothing like the script
+ variables block in Snap!. Variables are
+ local to procedures automatically, unless you use a
+ global or nonlocal statement to
+ tell Python to look for a variable defined outside this
+ procedure. This is a good design choice, because it
+ encourages programmers to use global variables only when
+ really necessary.
+
+
+ Python uses indentation (how many spaces at the beginning of each line) to determine the extent of control structures
+ that would be C-shaped blocks in Snap!.
+
+
+ As in many (but not all!) text-based languages, the first item of
+ a list is item number zero, not item one. They have a reason
+ for this, but it's still confusing: Shouldn't the 27th item of
+ a list be item number 27?
+
+
+ In Snap!, the nesting of blocks is visually
+ apparent, so there's no ambiguity about whether you
+ meant
+
+ or
+ .
+ But text languages have to use the order-of-operations rules
+ that you learned in elementary school, and allow the use
+ of parentheses if you want some other order.
+
+
+ In Python, you can't have a
+ space inside a variable name, like current item in
+ Snap!. Instead, Python programmers often use
+ underscore characters (_) inside variable names.
+
+
+ The most annoying one: Like many (but not all!)
+ text-based languages, Python uses the character
+ = to set the value of a variable, like the
+ set block in Snap!. But that's not
+ what "=" means! In every context other than
+ programming, x=3 is telling the reader that
+ the value of xis 3, not a command
+ to change the value to 3. In other words, it
+ means .
+ The Python equivalent of the
+ Snap!= predicate is called
+ ==. Many, many bugs, even among experienced
+ programmers, come from this confusing notation. And it's
+ needlessly hard to make sense of programming when you're
+ confronted with a statement such as x=x+1.
+ This design choice is inherited indirectly from Fortran,
+ invented back in the 1950s, when computers could display
+ only 64 different characters, so there were fewer options
+ available, but they still could have used a multi-character
+ sequence such as <--.
+ (If you have to program in a language that uses
+ = for assignment, learn to pronounce it
+ "gets," as in "x gets 3," rather than "equals,"
+ so you don't add to the confusion. But you still pronounce
+ == as "equal equals.")
+
+
I want a gold star for not putting "have to" in italics.
+
+
+
+
+
+
JavaScript
+
+
Here's the same procedure written in JavaScript:
+
+function binarySearch(value, data) {
+ var low, high, currentIndex, currentItem;
+ low = 0;
+ high = len(data)-1;
+ while (low <= high) {
+ currentIndex = average(low, high); // find the middle word
+ currentItem = data[currentIndex];
+ if (currentItem == value) {
+ return true;
+ } else if (currentItem > value) { // eliminate half the list
+ high = currentIndex-1;
+ } else {
+ low = currentIndex+1;
+ }
+ }
+ return false;
+}
+
+
+
+
The syntax of a language is the notation it uses
+ (punctuation, words reserved for specific purposes, etc.). Human
+ languages have syntax, too: nouns vs. verbs and so on.
+
The semantics of a language refers to the
+ meaning or purpose of each piece of syntax.
+
+
This doesn't look so different from the Python version, but there
+ are a few significant differences:
+
+
+
+ The var statement, inside a procedure, is equivalent
+ to script variables in Snap!. (There are
+ better, more recently invented, ways to create local variables
+ in JavaScript, but they look very different and we're trying to
+ make the code as similar as possible.)
+
+
+ JavaScript uses braces { } to mark the extent
+ of what would be a C-shaped block in Snap!. Although
+ JavaScript programmers generally indent code more or less the
+ same way Python programmers do, that's just to make it
+ more readable to people; the indentation is ignored by JavaScript.
+ Within the braces, statements are separated by semicolons (;).
+ (In JavaScript, semicolons go between statements:
+ {st;st;st}, but in C, an otherwise similar language,
+ they go after statements: {st;st;st;}.
+ This is the sort of thing that drives students of text languages
+ crazy. It's one of the advantages of block-based languages such as
+ Snap!.)
+
+
+ JavaScript uses the name "function" to describe all procedures,
+ including what Snap! calls "commands," the ones that
+ don't report a value.
+
+
+ Just as in Python, you can't have a
+ space inside a variable name. Instead, JavaScript programmers often use
+ "camel case," so called because the capital letters in
+ the middle of a variable name are supposed to look like
+ the humps of a camel.
+
+
+ JavaScript has the same terrible = notation for
+ Snap!'s set as Python does.
+ But instead of using == to test whether two
+ values are equal, JavaScript has two ways to do that:
+ == and ===. (That looks like a joke,
+ but it isn't.) JavaScript programmers
+ often get confused about which is which. (The one with three
+ equal signs is similar to the is identical to
+ block in Snap!.)
+
+
+
+
You can see that there are things to learn about notation (syntax, which is the text-language equivalent of block colors and shapes). But you would be able to learn the details of one of these other languages in a few focused days and then program in that language, too.
+
+
Snap! Primitives in Other Languages
+
+ Central programming language features having to do with flow of control
+ (),
+ data management
+ (
+ and ),
+ and computation
+ ( and
+ a few blocks)
+ have direct equivalents in most languages. Here are a few examples:
This is just a small sample of the number of primitive commands
+ and functions in any programming language. Luckily, you don't have
+ to memorize them; you can do a web search for "javascript
+ list item," for example, to learn any particular one as you need
+ it.
+
+
By the way, look at the Python join in the table.
+ It has the very nice feature of allowing you to choose a separator
+ to go between the joined strings:
+
+
>>> " ".join(["John", "Paul", "George", "Ringo"])
+'John Paul George Ringo'
+>>> ",".join(["John", "Paul", "George", "Ringo"])
+'John,Paul,George,Ringo'
+
+
In the first interaction, the string " " provides
+ the separator; in the second, the string "," does.
+ That's an elegant way to extend the idea of joining strings,
+ avoiding the need to put spaces in the input strings.
+ (You could also use an empty string to get the exact effect of
+ the join block in Snap!.)
+
+
+ On the other hand, look at the Python version of map.
+ Why do you have to wrap a list(...)
+ around the call to map? It's because Guido van
+ Rossum, the designer of Python, hates higher order functions,
+ so when his users insisted on having them, he made it as
+ painful as possible to use them. Python's map
+ doesn't return a list; it returns this strange other thing that
+ you have to convert to a list. (He wants you to use
+ the for x in notation instead.) Similarly, he
+ hates anonymous procedures (Snap! gray rings), and
+ so when his users insisted, he grudgingly allowed
+ anonymous reporters that fit on one line,
+ but not longer reporters or any anonymous command scripts.
+ Python could be a really usable language if he didn't have
+ his head wedged on these issues.
+
+
+
But look at the Python equivalent of for. Why
+ does range(1,11) mean "the numbers from 1 to 10"?
+ The idea is that you're using those numbers to select items
+ from a list, but instead of numbering the items, Python numbers
+ the spaces between items, just as when you're using a
+ word processor it displays the cursor as a vertical line
+ between two letters. So range(1,11) means "the
+ items to the right of gap number 1 and to the left of gap
+ number 11." You can learn to think that way, but it's not
+ obvious to a beginner. (It's a little more intuitive if you
+ start at position 0, before the beginning of the list;
+ range(0,5) selects five items
+ from a list, and you can abbreviate it as range(5).)
+
+
What do you think about using + to join strings?
+ It's meant as an analogy with arithmetic; you are "adding" one
+ string to another. Using the same symbol to mean two different
+ things in different contexts is called "overloading." It's not
+ too bad in Python, which is very strict about the distinction
+ between a number and a string of digits. (2+"3"
+ gives an error message.) But JavaScript, like
+ Snap!, will automatically convert a number into a
+ string of digits if necessary, so 2+"3" is "23"
+ even though 2+3 is 5. (The automatic conversion
+ isn't a problem in Snap! because Snap!
+ doesn't overload the + operator.)
+
+
The other block categories, the ones having to do with graphics
+ or sound, don't really have analogs in other languages. Instead,
+ just as Snap! has libraries, other languages also have
+ libraries to provide such capabilities. For example, if you want
+ JavaScript equivalents to the turtle graphics blocks
+ (move (n) steps, etc.), you start in your search
+ engine; "JavaScript turtle graphics" will get you to
+ https://github.com/bjpop/js-turtle
+ from which you can download the file "turtle.js" to include with
+ your own JavaScript program. (On the other hand, because
+ the main purpose of JavaScript is writing programs that will be
+ run inside a browser window, it does have built-in support for
+ the sort of graphics you see in typical browser windows:
+ scrolling text boxes, form-filling, checkboxes, etc.)
+
+
Libraries are a little easier in Python because there's a
+ central repository of them. So you can draw a square this way:
+
+
from turtle import *
+
+pendown()
+for i in range (4):
+ forward(100)
+ right(90)
+
+
+
+
+
How Can You Learn These Similar Languages?
+
+
W3Schools C++ Tutorial ← Brian, is C++ the right thing (not C); are you OK with promoting the W3Schools tutorials? Is there anything else you suggest that we promote also/instead? --MF, 6/27/21
+
+ I didn't do any of this. W3schools is a little controversial.
+ Some people swear by them; others say they're full of inaccuracies.
+ I don't know enough to have an opinion. But, anyway, kids know
+ how to learn stuff; you search the Web, or you get a book from
+ the library. Or you take APCSA next year.
+
+
+
Non-Sequential Languages
+
+
In the early days, all programming languages were sequential,
+ because that's how computer hardware works, and higher level
+ languages were seen as a convenient abbreviation for machine
+ language, rather than as a source of abstraction. Since then,
+ several types of programming language based abstraction
+ ("programming paradigms") have been invented.
+ Most modern languages have some aspects of most of these,
+ but in this section you'll learn about languages that are
+ entirely based on one particular paradigm.
+ It's worthwhile to learn such a language because it will
+ immerse you in how things are done in that paradigm, even
+ if in real life you end up programming in a mixed-paradigm
+ language such as Snap!, Python, or JavaScript.
+
+
Functional Programming in Haskell
+
+
Imagine if Snap! had only reporters and predicates, with
+ no command blocks. To perform a computation, you'd build up an
+ expression in the scripting area, then click on it to see the result
+ in a speech balloon. You could make script variables, but you'd give
+ them a value at the time you create them, and you couldn't then
+ change the value. That would be a functional
+ programming language.
+
+
Here's the same binary search algorithm shown above, written in
+ Haskell, a purely functional language:
+
+
find :: Ord a => Array Int a -> a -> Maybe Int
+find arr x = uncurry (search arr x) (bounds arr)
+
+search :: Ord a => Array Int a -> a -> Int -> Int -> Maybe Int
+search arr x lo hi
+ | hi - lo + 1 == 0 = Nothing
+ | x == el = Just mid
+ | x > el = search arr x (mid+1) hi -- eliminate half the list
+ | otherwise = search arr x lo (mid-1)
+ where mid = (hi + lo) `div` 2 -- find the middle word
+ el = arr ! mid
This looks very different from the other programs you've seen,
+ but don't throw up your hands in despair. You're not
+ expected to be able to learn to program in Haskell in just a few
+ days, but you can read this example with some help.
+ Start with the fourth line, search arr x lo hi;
+ it's like the hat block that begins a Snap! procedure,
+ in this case a search procedure with four inputs.
+
+
In search you'll see functional programming
+ making a difference in the programming style. The Snap!
+ version of the program is organized as a repeat until
+ loop, in which the values of the variables low,
+ high, current index, and
+ current item are changed on every repetition. If you're
+ not allowed to change variables' values, what can you do instead?
+
+
The answer is that search calls itself recursively,
+ in the lines
+
| x > el = search arr x (mid+1) hi
+ | otherwise = search arr x lo (mid-1)
+ In the recursive calls, either
+ lo or hi has a different value. This may seem
+ like a quibble. Isn't that the same as changing the value? No, it
+ isn't. The recursive call has its own local variables with
+ the same names as the outer call. You can see that this matters in a
+ case in which two recursive calls are combined, as in this program
+ to calculate Fibonacci numbers:
+
+
If you try to trace through computing fib 4 on the
+ assumption that there's a single variable n shared by
+ all the recursive calls, you'll get the wrong answer.
+
+
The where in the last two lines of the program
+ is how Haskell creates script variables and gives them their
+ (unchanging) values.
+
+
The four lines that start with vertical
+ bars (|) are like a set of nested
+ if/else blocks: If hi is
+ one less than lo, return nothing. If the value you're
+ looking for is equal to item mid of
+ arr, return the index mid. (This
+ version of binary search returns the position of the value in
+ the list, if any, instead of just True.) If the
+ value you want is more than the value at the midpoint, search
+ from the midpoint to the end of the list. Otherwise, search
+ from the beginning of the list to the midpoint.
The two lines with Ord a and so on are type
+ declarations. Such declarations aren't a necessary part of a
+ functional language, but the main functional languages do use them.
+ The "a" on those lines is the name of a data type that's being created
+ in each declaration. Find and search are of
+ type "function," but not any old function. Find is of
+ type "function that takes as inputs an array (like a Snap!
+ list) of values of type
+ a, which has to be an Ordered type (because binary
+ search doesn't make sense otherwise), and a single value
+ of type a, and returns either an integer or nothing at
+ all." Looking at this another way, each of those lines creates an
+ abstract data type. (The name a is local to
+ each function.)
+
+
+
+
Find is the main procedure; search
+ is a helper function. Note that find takes two
+ inputs, arr for the array and x for
+ the value to be found. Search, though, takes
+ four inputs: arr, x,
+ lo for the lowest array index to examine, and
+ hi for the highest index. So how can
+ find say (search arr x), calling
+ search with only two inputs?
+
+
This is part of what it means to take function-as-data
+ seriously. When you call any Haskell function with fewer
+ inputs than it expects, it returns a function of
+ the remaining inputs, sort of as if when you defined
+
+ you automatically also got this one:
+
+ and similarly for one-input and three-input versions.
+ Turning a function into a function with fewer inputs is
+ called currying it, named after Haskell Curry, a
+ mathematician who contributed to the early development
+ of lambda calculus, the mathematical basis for functional
+ programming. So the call to uncurry turns
+ the two-input function back into a four-input function by
+ supplying the missing two inputs, namely
+ (bounds arr), a function call that
+ reports the lowest and
+ highest indices of the array, which will be 0 and
+ the array length minus 1.
+
+
+
+
Even if you're convinced that functional programming is a
+ good idea (which it is, because it avoids the kind of bug in
+ which two parts of the program are using the same variable for
+ different purposes, and because functional code turns out to
+ be the easiest to parallelize for multi-processor machines),
+ why would you choose a language that forces you to
+ program in that style? Well, many people don't. You can, if
+ you're disciplined about it, program functionally in any
+ language that's functional enough to include higher
+ order functions, which are an important benefit of functional
+ programming. (You did something like this in the Tic-Tac-Toe
+ project, not in the part that displays moves on the stage, but
+ in the part that computes the best move for the computer.
+ That computation is one function calling another: calls , which calls , which calls , which calls .) But a purely functional
+ language helps eliminate program bugs, which is especially
+ important when a team of programmers work together on the same
+ program. And compilers for functional languages can take
+ advantage of the constraints of functional programming to
+ generate very efficient programs. In any case,
+ learning a purely functional language ensures that
+ you discover every aspect of functional programming.
+
+
+
+
Object Oriented Programming (OOP) in Smalltalk
+
+
Imagine if in Snap! you could make only sprite-local
+ procedures and variables, not global ones. Imagine also that
+ everything in the language were like sprites in that
+ way. So, for example, imagine that the number 3 had its own
+ procedures—its own + and so on. Something
+ that has its own local procedures (called methods)
+ and its own local variables (often called fields,
+ depending on the language) is called an object.
+
+
It would be unusable if you actually had to write a +
+ method for 3 and a different one for 4.
+ But think about making clones of a sprite, as you did in the
+ Tic-Tac-Toe project. Each clone inherits the methods
+ and some other attributes from its parent sprite. Similarly,
+ 3 and 4 are instances of
+ the class (type of object) Integer, which in turn
+ inherits from the class Number. You can think of
+ an object class as a souped-up abstract data type with methods
+ other than just its selectors.
+
+
So, what happens when you say 3 + 4? You are
+ sending the message+ 4 to the object
+ 3. (In Snap!, the broadcast
+ block sends a message to all objects, and the tell
+ and ask blocks send a message to a specific object.)
+ The message + 4 consists of a keyword,
+ +, along with an input, 4.
+
+
These days, most programming languages are sort of
+ object oriented, just as most sort of support functional
+ programming. For example, in the translation table above,
+ the translation of the map block to JavaScript
+ is value.map(someFunction). Map
+ takes two inputs, a function and a list. Python expresses
+ that idea as a two-input function, map(some_function,value).
+ Why does JavaScript put one of the inputs in front of the
+ function name? The reason is that JavaScript's map isn't a
+ global procedure; it's the keyword of a message that
+ you can send to a list. Their message-passing syntax is
+ object.keyword(inputs).
+
+
But most languages don't go so far as to treat numbers
+ as objects. In most languages, including Snap!,
+ + is a global function that takes two numbers as
+ inputs. The only widely known language that's truly
+ object oriented, in which everything is an object,
+ is Smalltalk, the language that introduced object oriented
+ programming to the world.
The first line of this program says that it is adding a new
+ method to the class SequenceableCollection, which
+ is a parent class of arrays, lists, and other kinds of
+ sequences of items. The corresponding message has three
+ keywords, binaryFindIndexOf:, left:, and
+ right:. This is similar to the way Snap!
+ blocks can have title text mixed with input slots. The inputs
+ to this method are named aNumber (a Smalltalk convention
+ that helps make the code self-documenting because we know what
+ kind of object it expects), leftIndex, and
+ rightIndex. (Shouldn't there be an input for the
+ collection in
+ which the method will search? No, because that collection is an
+ object, and binaryFindIndexOf is a method of the
+ collection.)
+
+
The vertical bars in the second line are the Smalltalk syntax
+ for script variables. Another noteworthy piece of
+ syntax is that Smalltalk uses square brackets [ ]
+ the way Snap! uses gray rings, surrounding a piece of
+ code that can be input to a message. Smalltalk sensibly uses
+ = to mean the equality test; its equivalent to
+ set is the two-character sequence :=.
+ (Smalltalk was developed long before Unicode; if they were
+ designing it today they'd probably use ←.
+ The hat (^) is like report.
+ The double slash // is division with the result
+ rounded to an integer.
+
+
The Boolean values True and False are, of course, objects;
+ they accept messages with keywords ifTrue: and
+ ifFalse:, each of which takes a code block (in
+ square brackets, in this program) as input. So there's no
+ need for an explicit if procedure.
+
+
The name self refers to the object that is carrying
+ out the method, like
+ or in
+ Snap!. The message at: middle, sent to a
+ collection, means the same as item middle of
+ collection in Snap!. The rest of the program should
+ now make sense.
Object oriented programming with message passing
+ does a great job with functions of
+ one input, such as asking a list for its length. It's a little more
+ awkward for a function like +, whose two inputs really
+ play mathematically similar roles.
+ Saying that 3 is the actor and
+ 4 is just an input feels peculiar. Some languages try
+ to overcome this issue by using generic functions instead
+ of message passing. That means that you could define functions
+ sum(integer,integer), sum(integer,float),
+ and so on, so that all the inputs help determine which method is
+ used. When you call a function, the language looks for the best
+ fit between the methods you've defined and the classes (types) of
+ the inputs.
+
+
Think about Python's " ".join(["hello","world"])
+ notation. This is the same object.method(inputs)
+ syntax that JavaScript uses, and it works well. But it seems a
+ little strange that what you're supposed to think of as the active
+ object is the delimiter character, rather than the meaningful
+ strings you're combining. Compare that with JavaScript's
+ "hello".concat(" ","world"), which makes the first
+ string the actor and other strings, including delimiters, the
+ inputs. That seems more Smalltalk-like.
+
+
+
+
Smalltalk is a class/instance language. That means
+ that there's a special kind of object called a class
+ that contains all the methods for any object of that class.
+ For example, Integer is a class, and 3
+ is an instance. The inheritance of methods from parents
+ happens in the classes, not the instances.
+
+
As you know, Snap! takes a different approach.
+ Every object combines the features of classes and instances;
+ it can have methods and can inherit, like a class, but it's
+ a specific value, like an instance. (For example, sprites
+ can have methods, and can inherit them, but a sprite can be
+ shown on the stage and move around, like an instance.) This
+ approach is called prototyping OOP.
+
+
Many languages that purport to use prototyping (JavaScript,
+ for example) have a special kind of object called
+ a "prototype," and that's the kind of object that can have
+ methods and a parent. If you're asking yourself "How does
+ that differ from a class?" you're right. Snap!'s
+ prototyping is both simpler and more flexible.
+
+
+
+
+
Why would you use an object oriented language? Programmers'
+ opinions on this question have changed dramatically over time. When
+ Alan Kay and his team at
+ Xerox PARC
+ introduced Smalltalk, very few people got the point. But today, there
+ are many programmers who insist that using anything other
+ than object oriented programming is professional malpractice. (They
+ don't use Smalltalk, though; many use Java, the language of the
+ College Board AP Computer Science A course.) The main thing that's
+ made OOP so popular is information hiding, which means that
+ one object can't directly examine another object's variables or
+ call its methods, but must
+ instead send the target object a message that it accepts from
+ other kinds of objects ("public messages").
+
+
Ironically, information hiding isn't a necessary part of OOP.
+ In Smalltalk, any message an object understands can be sent to
+ it by other objects. (There are no private methods.)
+ In a language for learning, such as Smalltalk in
+ its early days and Snap!, information hiding isn't
+ important. Programs are small, and they have just one or two authors.
+ (The people who talk about malpractice are thinking about teams of 500
+ programmers, and all the ways they can step on each others' feet
+ unless the objects each one programs are protected from each other.)
+ That's why Snap!, like Smalltalk, allows an object to call
+ any method of another object, not just a few for which the
+ other object publishes messages. Snap!'s developers were
+ more interested in one of Smalltalk's central ideas:
+ simulation.
+
+
In pre-OOP programming, there's one program running all the time,
+ and it's in charge of all the necessary computations. That's fine if
+ you're computing a function, for example, but some programs are
+ meant to model the behavior of a complex system with many independent
+ actors, such as the disease simulation project in this unit. The
+ simple model used in that project has only one object type, people.
+ A better model would have different kinds of people (for example,
+ those who do and those who don't follow medical advice about wearing
+ masks) and would model the disease itself, such as its ability to
+ mutate. OOP is great at this kind of simulation, because each object
+ is responsible for its own behavior. (Scratch, from which Snap!
+ inherited the idea of sprites, was originally implemented in
+ Smalltalk, whose influence is seen in such details as multi-keyword
+ block names, as well as in the organization of a program as scripts
+ that belong to specific sprites, with no central program.)
+
+
Declarative Programming in Prolog
+
+
This section isn't going to start with "Imagine if Snap!..."
+ Declarative programming is a very, very different approach. What you
+ have to imagine is that programs don't have algorithms!
+
+
Instead, a program consists of facts and rules
+ that you are teaching the computer. One of the standard examples is
+ about family trees. "Brian's mother is Tessa" is a fact, a specific
+ piece of information.
+
+
mother('Brian','Tessa').
+
+ Rules are more general: "If person A's mother is person B,
+ and person B's mother is person C, then person A's grandmother
+ is person C." Here's how that would look in Prolog,
+ the best-known declarative language:
+
+
grandmother(A,C) :-
+ mother(A,B),
+ mother(B,C).
+
+
What about the mother of someone's father? Shouldn't that have
+ to be in the rule, too? The answer is that you can have as many
+ rules as you want about grandmotherhood:
+
+
grandmother(A,C) :-
+ father(A,B),
+ mother(B,C).
+
+
Once you've taught the computer some rules and facts, you
+ can ask questions, such as "Who is Brian's grandmother?":
+
+
?- grandmother('Brian', X)
+
+
A very important difference between declarative programming
+ (also called logic programming)
+ and the other paradigms you've seen is that a question may have
+ more than one answer! This is very different from a function,
+ which can only report one value. Prolog doesn't just pick one
+ answer to show you; it shows all the answers it can figure out
+ from the information it has (one at a time). Here's an example:
The user has asked "what two lists can be appended together
+ to get the list [a,b,c,d]?" There are five possible
+ pairs of lists that satisfy the condition. Prolog prints the
+ first answer (shown in yellow above), then waits for the user to type
+ the space key or semicolon, then displays the next answer, and
+ so on. When the user asks for a sixth answer, the result is
+ "false," which means that Prolog can't find any more values for
+ X and Y that make the query true. (That
+ doesn't mean it's proven false; for example, if you teach Prolog
+ about your family tree and then ask questions about someone else's
+ family, Prolog won't find any information, but that doesn't mean
+ the other person really doesn't have any relatives.)
+
+
Wow! Snap! has an
+
+ function; you can ask it questions such as
+ "what do I get if I append the list [a,b] and the list
+ [c,d]?" But you can't "run it backward," asking
+ questions such as "What must I append to [a,b] in order
+ to get [a,b,c,d]?" let alone "What two lists can I
+ append to get [a,b,c,d]?" But Prolog's append
+ isn't a function of two lists; it's a relation (you can
+ think of it a predicate function, although you shouldn't forget
+ that it's not really a function, running an algorithm, at all)
+ among three lists, which is
+ True if the result of appending the first two inputs is the third
+ input. There's no special magic in append; if it
+ weren't predefined in Prolog, you could
+ define it this way:
+
+
The notation
+ [A|B] represents a nonempty list whose first item is
+ A and whose all-but-first is B.
+ The first rule says that if you append an empty list and any
+ list Z, you get Z. The second rule says
+ that if the first list isn't empty, then the first item
+ of the result must be the first item of the first list, and the
+ rest of the result must be the result of appending the rest of
+ the first list and the second list.
+
+
Okay, time for binary search in Prolog:
+
+
contains(List, Value) :- even_division(_, [Value|_], List).
+
+contains(List, Value) :- % eliminate first half of list
+ even_division(_, [Center|SecondHalf], List),
+ Center < Value, SecondHalf \= [],
+ contains(SecondHalf, Value).
+
+contains(List, Value) :- % eliminate second half of list
+ even_division(FirstHalf, [Center|_], List),
+ Center > Value, FirstHalf \= [],
+ contains(FirstHalf, Value).
+
+even_division(First, Second, Xs) :- % find the middle word
+ append(First, Second, Xs),
+ length(First,F),
+ length(Second,S),
+ S >= F, S-F =< 1.
The first thing to say about this program is that it's not really a
+ good model of how to program in Prolog. The helper rule
+ even_division wants to divide a list into two equal-size
+ pieces; it ends up dividing the list into two pieces every
+ possible way (like the append example earlier), and
+ then checks each of those divisions to find one whose two pieces are
+ the same length. If you really wanted to do a binary search in
+ Prolog, you'd do it by using a more complicated data structure that
+ comes pre-divided into equal size pieces. But for the purpose of
+ this page, comparing languages, it's best to use the same
+ structure in all the sample programs.
+
+
The
+ underscore character _, used by itself, means that you
+ don't care what value goes in that slot in the program. (Underscores
+ can also be used as part of a variable name or a relation name, as in the
+ relation even_division.)
means that the given Value is in the List
+ if it happens to be the middle item of the list—that is,
+ List can be divided into two equal parts, you don't
+ care what's in the first part, and the second part has
+ Value as its first item, followed by some values you
+ don't care about.
+
+
The next rule handles the case in which the value is larger
+ than the middle item of the list. It says that List
+ contains Value provided that the middle item
+ Center is less than Value, the second
+ half of List has items other than just Center,
+ and those other items (SecondHalf) include the desired
+ Value. (The requirement that SecondHalf
+ isn't an empty list is there to prevent infinite loops in which
+ the program keeps dividing an empty list into two (equal size)
+ empty lists.)
+
+
Similarly, the third rule handles the case in which the value
+ is smaller than Center.
+
+
Why isn't there a rule saying to report False if the value
+ isn't found? This is the mind-stretching part of declarative
+ programming. A rule isn't a function, and it doesn't report a
+ value. That would be an algorithm! A rule doesn't do
+ anything; it's just another kind of data. If Prolog can't
+ match the question you ask against any combination of facts and
+ rules, then you just don't get an answer at all. That's not
+ considered an error.
+
+
The use of even_division in this program is an
+ attempt to have it work the way binary search works, by dividing
+ the list in half at each step. But if you just want to know if
+ a value is in a list and aren't worried about efficiency, the
+ entire program could be replaced by one rule:
This says that the list can be divided into two pieces
+ (the first of which might be empty; you don't care what's
+ in it), such that the desired value is the first item in
+ the second piece of the list. That example should give you
+ some feeling for the power of the declarative programming notation.
+
+
How does a Prolog program actually work? If there are no
+ algorithms, only data, how can any matching of queries to
+ things in its database happen? The answer is that the language
+ itself implements a single, universal algorithm, called
+ resolution, that will always find every answer to
+ a question you ask that can be deduced from the database,
+ provided that it doesn't get caught in an infinite loop.
+ (If resolution could guarantee the impossibility of
+ infinite loops, it would solve the Halting Problem, which
+ you know can't be done.)
The Prolog database consists of facts and rules. The
+ difference is that facts don't contain variables. So,
+ given a query such as mother('Brian',X), it's
+ pretty easy to see whether that matches a fact such as
+
+
father('Brian','Len')
+
Nope, father≠mother
+
mother('Bob','Tessa')
+
Nope, 'Bob'≠'Brian'
+
mother('Brian','Tessa')
+
Yes, provided that X='Tessa'
+
+ The only subtlety is that if the same variable is used twice
+ in a query, it has to match the same text every time, so that
+ someone who says mother(X,X), presumably wanting
+ to find someone who's their own mother, doesn't match every
+ fact about mothers in the database.
+
+
Rules are more complicated, because both the query and
+ the rule can have variables. Consider the query
+ append(X,Y,[a,b,c,d]) that you saw earlier.
+ If the same variable name is used twice in the same query,
+ or in the same rule, that name must match the same
+ value each time it's used. But it's okay for a user to use
+ a variable name in a query that happens to be the same as
+ a name used in a rule; they don't have to have the same
+ value. It's like using the same name in a script
+ variables block in two different scripts; they're
+ different variables despite the coincidence of the names.
+
+
So, when trying to match a query against a rule, the first
+ step is to systematically rename all the variables
+ in the rule, with unique names. For example, the first time
+ Prolog compares a query with the rule
+
append([],Z,Z).
+ it (temporarily) changes the rule to something like
+
append([],Z.1,Z.1).
+ The next time it compares something to that rule, it'll
+ change it to
+
append([],Z.2,Z.2).
+ And so on.
+
+
Okay, compare the append query above with
+ this first rule:
+
append(X,Y,[a,b,c,d]).
+append([],Z.1,Z.1).
+ This results in the following pairings:
+
X = []
+Y = Z.1
+Z.1 = [a,b,c,d]
+ Combining the information in the last two of those
+ pairings gives Y = [a,b,c,d], so that
+ gives both of the variables in the query values,
+ so Prolog gives the first answer.
+
+
That was a simple rule, in that its conclusion
+ always holds. The other append rule
+ includes a condition that must be true in order for
+ the rule to apply. After renaming, that rule says
+
+ The resolution rule for rules with conditions is
+ that first we try to match the query with the
+ conclusion of the rule, then if that works, we
+ take the condition of the rule as a new query. In
+ this case, we are comparing
+
+ The technical name for matching two expressions that
+ can both contain variables is unification.
+ Figuring out exactly how to get it right is hard,
+ but luckily, it's been done, so you don't have to.
+ Here are the results:
+
X = [A.2|X.2]
+Y = Y.2
+[A.2|Z.2] = [a,b,c,d]
+ But now think about what the [...|...] notation means.
+ That last match can be expressed as the two matches
+
A.2 = a
+Z.2 = [b,c,d]
+ This isn't enough to give us values for X
+ and Y in the original query with no
+ variables in the values. But knowing that A.2
+ must have the value a is a big step
+ forward. It tells us that X is a list
+ whose first item is a.
+
+
Now, remembering all the pairings so far,
+ we start again with the query append(X.2,Y.2,Z.2).
+ Compare that with the first append rule:
+
append(X.2,Y.2,Z.2).
+append([],Z.3,Z.3).
+ From this we learn
+
X.2 = []
+Y.2 = Z.3
+Z.2 = Z.3
+ This might be dizzy-making for people, but luckily
+ computers don't get dizzy. Here again are all the
+ matches Prolog has found for this second answer:
+
+ and that's the second answer. We'll stop here, but
+ if you want you can match the query
+
append(X.2,Y.2,Z.2)
+ against the second rule, and the result of that
+ against the first rule, and so on.
+
+
+
+
Why would you program in a declarative language? Some
+ problems just lend themselves to a database-ish frame of
+ mind. Think about family trees again. There may be gaps
+ in what you know about your ancestors; an algorithm that
+ expects everyone in the database to have exactly two parents
+ in the database wouldn't work if there's missing information.
+ Similarly, if you have two mothers or two fathers, a situation
+ that's more common these days than in the past, Prolog won't
+ mind. You just tell it two facts such as
+ mother('me','mom1') and mother('me','mom2').
+ Also, nothing beats declarative programming for situations in
+ which a problem can have more than one answer. Think about
+ a quadratic equation with two solutions. In ordinary programming,
+ you can write a function that reports a list of two numbers, but
+ a list isn't a number, and can't take part in further numeric
+ computations. It's better if you get two separate answers, each
+ of which is a number.
+
+
The Morals of the Story
+
+
So, one overall moral of this story is that if you have the urge to
+ learn more programming languages, you'll be intellectually better off
+ learning Haskell, Smalltalk, or Prolog, rather than learning a bunch
+ of languages that are pretty much all the same, such as JavaScript,
+ Python, C, Java, and so on. (If you want a programming job this
+ summer, though, you might need to learn the language a potential
+ employer wants to use.)
+
+
And, by the way, don't think that because this page is telling you
+ about other languages it means you've learned all there is to know
+ about Snap!. For example, read Sections VIII (OOP
+ with Procedures) and X (Continuations) in the
+ Snap!
+ Reference Manual.
+
+
But also, bear in mind that learning computer science doesn't
+ mean learning a lot of programming languages. If you study CS
+ at the university level, you won't be taking classes named after
+ programming languages; they'll have names like "Algorithms and
+ Data Structures," "Graphics," "Operating Systems," "User Interface
+ Design," "Compilers," "Recursive Function Theory," and so on.
+ Maybe instead of learning another language, you should work your
+ way through
+ Structure
+ and Interpretation of Computer Programs,
+ the course that separates the wizards from the muggles.
Do we need all this commented out text? --MF, 6/12/20
- You've used libraries in Snap!. For example, when you imported the "Bar Charts" library in Unit 5 Lab 3 Page 4: Analyzing Data.
diff --git a/cur/programming/7-recursion/2-projects/1-triangle-fractal.html b/cur/programming/7-recursion/2-projects/1-triangle-fractal.html
index 41016ab10e..d99cb4276d 100644
--- a/cur/programming/7-recursion/2-projects/1-triangle-fractal.html
+++ b/cur/programming/7-recursion/2-projects/1-triangle-fractal.html
@@ -21,7 +21,7 @@
Triangle Fractal
Open your project "U3L1-FractalArt"; save it as "U7L2-TriangleFractal".
-
Run . Then look inside the block and remind yourself and your partner how it works.
+
Run . Then look inside the block and remind yourself and your partner how it works.
Predict how the shape will change if you change the 9 in to 2 and run the instruction again. Then try it and see if it does what you expect.
Need to have them download "Words and Sentences" library and update the image. --MF, 6/17/20
Make an exaggerate block that takes a sentence as input, and reports a sentence in which every number in the input is doubled, "good" is replaced by "great," "bad" is replaced by "terrible," "like" is replaced by "love," and "dislike" is replaced by "hate."
-
To do this, use a "wrapper" function that transforms the sentence into a list of words and back again:
+
To do this, first import the "Words, sentences" library. Then use a "wrapper" function that transforms the sentence into a list of words and back again:
What should the helper function do with the other words?
+
It's the exaggerate wordlist block that will be recursive.
You'll also want a helper function exaggerate word that works on a single word, looking for specific words and types to exaggerate.
Please note, this is a adaptation of the student-facing page and was designe
- Predicates can also be used with to decide which things to keep. The keep block takes a list and a predicate as input, and it reports a new list keeping only the items from the list that make the predicate true. For example, this expression finds words from the words list whose first letter is v and reports a list of 170 matching words. The blank input slot is where each word in the list goes to decide if it will be kept.
+ Predicates can also be used with to decide which things to keep. The keep block takes a list and a predicate as input, and it reports a new list keeping only the items from the list that make the predicate true. For example, this expression finds words from the words list whose first letter is v and reports a list of 170 matching words. The blank input slot is where each word in the list goes to decide if it will be kept.
- The block applies the input function to each item in the input list and then reports a new list of each original value after being modified by the function. For example...
+ The block applies the input function to each item in the input list and then reports a new list of each original value after being modified by the function. For example...
- The block combines all the elements in the input list using the input operation. For example...
+ The block combines all the elements in the input list using the input operation. For example...
@@ -98,7 +98,7 @@
Essential Idea
You can save your work into the Snap! cloud.
- In the Snap! window, click the Cloud menu (), select "Signup...", and follow the instructions.
+ In the Snap! window, click the Cloud menu (), select "Signup...", and follow the instructions.
That might be ok for the first quiz item (you could use to get the first question and to get the first answer), but for a long quiz, you might leave out one answer by accident and then after that, the program will get questions and answers mixed up.
@@ -70,7 +70,7 @@
Please note, this is a adaptation of the student-facing page and was designe
Right-click one of the three blocks in the scripting area and select "edit..." to edit its code. The input to the report block will be the value reported when the procedure is called.
-
You will need and/or . Drag the appropriate one(s) into the procedure definition, and then drag the input parameter(s) into the input slots of the list and/or item blocks.
+
You will need and/or . Drag the appropriate one(s) into the procedure definition, and then drag the input parameter(s) into the input slots of the list and/or item blocks.
Click "OK."
Repeat for the remaining ADT blocks.
@@ -88,7 +88,7 @@
Please note, this is a adaptation of the student-facing page and was designe
Test both the selectors for different items in your list of quiz items, and debug any problems.
diff --git a/cur/programming/CSTA2020/quiz-app.html b/cur/programming/CSTA2020/quiz-app.html
index 59314c3e6d..7a2f340a51 100644
--- a/cur/programming/CSTA2020/quiz-app.html
+++ b/cur/programming/CSTA2020/quiz-app.html
@@ -71,7 +71,7 @@
- If you want to save your work, open the Snap! File menu () and choose save. You can either save the file to your computer, or if you have a Snap! account, you can save it to the Snap! cloud.
+ If you want to save your work, open the Snap! File menu () and choose save. You can either save the file to your computer, or if you have a Snap! account, you can save it to the Snap! cloud.
Creating an Account
- In the Snap! window, click the Cloud menu, , select "Signup...", and follow the instructions.
+ In the Snap! window, click the Cloud menu, , select "Signup...", and follow the instructions.
You'll be asked to click a link in your email to verify your account, but you don't have to do that right now.
-
You may change your password at any time using the Cloud menu, .
+
You may change your password at any time using the Cloud menu, .
diff --git a/cur/programming/libraries b/cur/programming/libraries
new file mode 100644
index 0000000000..26eb680537
--- /dev/null
+++ b/cur/programming/libraries
@@ -0,0 +1,62 @@
+1-introduction/3-drawing/1-exploring-motion.html: Color families. Click the file menu icon and select "Libraries..." Then, find the "Colors and Crayons" library and click "Import."
+1-introduction/3-drawing/1-exploring-motion.html:
+1-introduction/3-drawing/1-exploring-motion.html:
+1-introduction/3-drawing/1-exploring-motion.html: In the Pen menu you'll find the set pen to crayon block. Computers can display billions of colors, but unless you have to match the paint on your wall very precisely, finding your way through all those colors may be more trouble than it's worth. The crayon library, just like a box of crayons, gives you a small set of vibrant colors, arranged in families. So if you want a lot of browns in your picture, you could pick a random number between 30 and 39.
+1-introduction/3-drawing/2-exploring-snap-drawing-motion.html: Gamal: Hey! Gang! Remember we imported that crayon library? Guess what! There's a "World Map" library, too! And it makes "watercolor" maps like this:
+2-complexity/4-making-computers-do-math/1-mod-operator.html:
Using libraries simplifies the development of new programs. When you use procedures that you already know work correctly, you reduce the amount of time you need to spend coding, the number of possible bugs your code can have, and how much of your project you need to test.
Snap! libraries and Snap! projects are both exported as XML files.
+2-complexity/4-making-computers-do-math/2-math-predicates.html: Import these blocks into your U2L4-MathLibrary project, test them and resolve any issues, and save.
+2-complexity/4-making-computers-do-math/2-math-predicates.html:
Open the Snap! project into which you want to import blocks. (In this case, your U2L4-MathLibrary project.)
+2-complexity/4-making-computers-do-math/2-math-predicates.html: You are creating a math library. Snap! has libraries for many things, such as one for accessing different parts of words and sentences...
+2-complexity/4-making-computers-do-math/2-math-predicates.html:
+2-complexity/4-making-computers-do-math/2-math-predicates.html:
+2-complexity/4-making-computers-do-math/2-math-predicates.html: Copy and modify the code from your even? predicate to develop an odd? predicate for your library.
+2-complexity/4-making-computers-do-math/2-math-predicates.html:
You can create algorithms from scratch or by combining or modifying existing algorithms. When you are thinking of using existing code, you can either use your own code or use code from someone else's library.
You've now made a small library, and you might want to write a list of instructions for how to use the functions in your library (for example, divisors of takes a positive integer as input and reports a list of numbers). The instructions form an Application Program Interface for the library.
An application program interface (API) documents what a programmer needs to know about using a library: it's a description of each procedure's purpose, inputs, and outputs (but not its algorithms).
A common kind of API is a web API in which the library exists on someone else's computer. For example, the Google Maps API describes how to embed a Google Map on your own website.
Average of list and sum of list are procedures that you'll need repeatedly, so after a while, you just know how to write them, or you'll put them in a library, and you won't have to reinvent them each time. Finding the maximum or minimum value in a list and checking for divisibility are also commonly needed algorithms.
+2-complexity/5-copyrights/5-drm.html:
Temporary exemptions to the anti-circumvention part of the DMCA can be made by the Librarian of Congress for a three-year period (a surprising choice, since the Library of Congress previously wasn't involved in judging copyright issues), but any such exemption must be renewed by the Librarian every three years. Most such exemptions are made for technical reasons (e.g., to allow one piece of equipment to work with another piece of equipment from a different manufacturer), but there was great excitement in 2010 when the Librarian of Congress allowed people to jailbreak their cell phones.
+3-lists/1-abstraction/4-brick-wall.html: You might want to use the odd? predicate from your U2L4-MathLibrary. You learned about exporting and importing blocks on Unit 2 Lab 3 Page 1: What's a Predicate?
+3-lists/1-abstraction/6-debugging-recap.html: The "Unused blocks..." option in the Snap! File menu will eliminate blocks you no longer need. This is often useful when you've loaded a library but you only need one or two blocks from the library.
+3-lists/2-contact-list/4-looking-up-data.html: Make a block to sort the contact list. To do the actual sorting, you can load the "List utilities" library. It has a block
+4-internet/2-cybersecurity/2-caesar-cipher.html:
If you want to use Unicode, you'll probably want to build or import a block like is between? from your U2L4-MathLibrary project to check which Unicode values are capital letters. (You learned about exporting and importing blocks on Unit 2 Lab 4 Page 2: Making a Mathematical Library.)
You can use bignums in any Snap! project by importing the "Infinite precision integers, exact rationals, complex" library.
You learned to import libraries on the Libraries page.
They did not. --MF, 6/13/19
+5-algorithms/3-turning-data-information/1-health-data.html: Looking at clusters in the data can help you gain insight and knowledge. Do some research online or in the library to help you answer the following:
+5-algorithms/3-turning-data-information/4-filtering-data.html: You can use the pipe function from the "Bar Charts" library to work through your data analysis one function at at time:
+5-algorithms/3-turning-data-information/4-filtering-data.html:
Application programmers don't often decide "I'm going to write this program in a low level language." They may simply not realize that higher levels of abstraction are possible. For example, a computer's hardware limits the size of numbers that its arithmetic unit can add in a single step. Four billion—about ten digits—is a common size limit for integers. Programmers who use Java, JavaScript, Python, C or C++ may think that this limit is unavoidable. But programmers who use really high level languages, such as Scheme or Common Lisp, know that they can do arithmetic on numbers with millions or billions of digits, limited only by the size of the computer's memory. As you will see later, Snap! has a library that lets it do this, too.
Other common tasks (such as knowing where the mouse pointer is, doing arithmetic on huge numbers, or managing sound) also have complex parts. If programmers had to deal with all of these details in every program, no software would ever get developed. And because many applications need the same abilities, programmers write libraries for other programmers to use.
A software library is a package of procedures that you can import into your program. A library is a kind of abstraction: you don't have to know any of the details of how it's coded. You can build libraries yourself, or you can use one that someone else wrote.
An application program interface (API) documents what the user of a library needs to know about it: it's a description of each procedure's purpose, inputs, and outputs (but not its algorithms).
A common kind of API is a web API in which the library exists on someone else's computer. For example, the Google Maps API describes how to embed a Google Map on your own website.
Often when people compare what different programming languages can do, they are really comparing libraries. For example, people may think they like JavaScript because they can use it to program web pages, but that's not a property of JavaScript. It's actually a web page library built into the browser that lets you program web pages.
+6-computers/1-abstraction/04-software-libraries.html:
+6-computers/1-abstraction/04-software-libraries.html: You've used libraries in Snap!. For example, when you imported the "Bar Charts" library in Unit 5 Lab 3 Page 4: Analyzing Data.
+6-computers/1-abstraction/04-software-libraries.html:
Read through the libraries listed in Snap! (as shown above), and choose one block that interests you and that you have never used. Build a small project that uses that block, and use your project to teach that block to some of your classmates.
+6-computers/1-abstraction/06-digital-architecture.html: Image by Alfred Edward Chalon, Science & Society Picture Library, Public Domain, via Wikimedia.
+6-computers/1-abstraction/06-digital-architecture.html: EEPROM (512 Bytes–4kBytes) is non-volatile, and is used for very long term data, like a file in a computer's disk, except that there is only a tiny amount available. Programs on the Arduino have to ask explicitly to use this memory, with an EEPROM library.
+6-computers/1-abstraction/09-digital-logic-gates.html:
+6-computers/2-history-impact/1-timeline.html: Image by Alfred Edward Chalon, Science & Society Picture Library, Public Domain, via Wikimedia.
+8-recursive-reporters/1-recursive-reporters/2-writing-recursive-reporters.html:
PG: The controversy in the notes on the page is about good examples. We have an earlier controversy to deal with. Why are we teaching recursion at all?! /MY/ answer to that would be that it is a powerful IDEA, intellectually interesting, and related to some natural ways of thinking but more formalized (that is, making those already natural ways explicit). I emphasized IDEA, to distinguish from TECHNIQUE. Virtually everything, including letter count, can be done with more abbreviated code, if we build the appropriate tools first. LENGTH OF (LIST TO SENTENCE (list)) This does get to one of my total confusions about controversies about Snap, itself. Why are MAP, KEEP, and COMBINE in a library as opposed to in the language? Just to illustrate that it's possible to create them in Snap? Seems like the wrong way to advertise Snap's power. This feels like the same issue we're facing in our discussion of when/how to teach recursion. If we have to defend WHY to teach recursion only on its suitability as a technique for a particular problem, I think we're done in. The problems it is needed for are either already solved or too hard for our kids. Let's start with small problems that make great sense to think of recursively, even if someone else has already written the tool that saves us from having to do that. LETTER COUNT is fine. So is n^m. Factorial is also fine but less familiar than n^m. (Typically n^m is sixth or seventh grade; factorial is high school.) Looking through a list for an item (yes, exactly what CONTAINS does), UNIQUING a list.... An advantage is that these are all different applications with very similar structures, so kids are /learning how to do it/ rather than getting lots of different lessons and not learning anything well.
As noted in email, I don't think letter count is an exception, as Mary does. But more important, I don't think students can easily compare their my join words with the join words in the tools library, because the latter is variadic, taking multiple strings as inputs rather than taking one single list of strings. As a result, its code uses the sort of hidden and obscure "input list" feature of Snap!, which we haven't taught and I'd rather avoid teaching, at least in the middle of teaching other hard stuff. --bh
+8-recursive-reporters/3-subsets/2-subsets.html:
From the Snap! file menu, choose "Libraries..." at the bottom, then choose "List Utilities" to load append and other list operations.
There is commented out text on this page. --MF, 6/11/21
+
On this page, you will use higher order functions to perform various operations on student grades: averaging, scaling, and selecting students within certain grade ranges.
@@ -40,7 +42,7 @@
Selecting within a Range with Keep
- The block takes a predicate (with a blank input slot) and a list as input, and it creates a new list keeping only those items from the input list that match the condition defined by the predicate. For example:
+ The block takes a predicate (with a blank input slot) and a list as input, and it creates a new list keeping only those items from the input list that match the condition defined by the predicate. For example:
@@ -69,7 +71,7 @@
Selecting within a Range with Keep
Scaling with Map
- The block takes two inputs: a function (a reporter with a blank input slot) and a list, and it reports a new list. In this new list, each item is the result of running an item from the original input list through the function. For example:
+ The block takes two inputs: a function (a reporter with a blank input slot) and a list, and it reports a new list. In this new list, each item is the result of running an item from the original input list through the function. For example:
@@ -89,8 +91,9 @@
Scaling with Map
Averaging with Combine
+
These COMBINE example images are out of date. --MF, 6/11/21
- The block takes an operation (with two blank input slots) and a list as input, and it reports a single result (not a list): the combination of the elements in the list when using the given operation. For example:
+ The block takes an operation (with two blank input slots) and a list as input, and it reports a single result (not a list): the combination of the elements in the list when using the given operation. For example:
@@ -100,7 +103,7 @@
Averaging with Combine
How could you use the combine block to help you build a block that will find the average of the student scores? What other blocks will you need?
-
You will need the redlength of list block which can be found in the Variables pallete (not the green length of operator block).
+
You will need the redlength of list block which can be found in the Variables palette (not the green length of operator block).
Create an average block in Snap! that will accept a list as input and output the average of the items in the list. Try it out with your student grades list.
@@ -113,8 +116,10 @@
Averaging with Combine
Find students who are closest to the class average. Use the and block together with average and keep to report the student grades that are within 5 points of the class average.
-
- For a somewhat more challenging introduction to higher order functions in a game context, see this page.
+
+
+
For a somewhat more challenging introduction to higher order functions in a game context, see this page.
+
\ No newline at end of file
diff --git a/cur/programming/summaries/assessment-data2.html b/cur/programming/summaries/assessment-data2.html
index 140d15d229..2da4c1d6c4 100755
--- a/cur/programming/summaries/assessment-data2.html
+++ b/cur/programming/summaries/assessment-data2.html
@@ -15,7 +15,8 @@
Examples like this one are useful to test your understanding of assignment to variables, but you wouldn't use a sequence of assignments like this in an actual program.
+ What value will this code display?
a ← 3
b ← a
a ← 4
@@ -84,9 +85,9 @@
We really shouldn't be encouraging students to mutate a block's inputs. There are really two issues here; one is with the x=x+1 style of programming altogether, and the second is that formal parameters specifically shouldn't generally be mutated; it's better to make a script variable that's initialized to the input value. (If we change this, we need to update the Guided Notes.) --MF, 6/26/21 with BH
There is nothing exactly like or on the AP Exam because they don't have sprites and speech balloons, but their way of showing this text to the user is
@@ -48,7 +48,7 @@
The Alonzo character is named after Alonzo Church, a major contributor to early computer science. In this project, there are three objects related to Alonzo:
One is a sprite, which is like an actor on the stage who knows how to do many different things, such as walk around the stage and speak the lines of the play.
The transparency of an image is how much you can see what's behind it. For example, here is the Alonzo sprite shown with three different transparencies (which have been set using the ghost effect block).
@@ -30,9 +30,9 @@
A procedure is a named sequence of instructions that may take inputs and may report a value. Some languages call procedures methods or functions. Here are two types of procedures you have seen in Snap!:
@@ -69,22 +69,22 @@
An expression is a either a constant value (such as "4" or "winter") or a call to a reporter block with any input slots filled in (such as , , or ).
+
An expression is a either a constant value (such as "4" or "winter") or a call to a reporter block including its inputs (such as , , or ).
Expressions are evaluated to produce a singlevalue (a value can be a number, a string, a sprite, a costume, a script, a list—anything). For example, will be evaluated to 17.
An algorithm is a sequence of steps that are usually performed by a computer. The algorithm doesn't have to be written in any particular programming language or even in a programming language at all; you can write your algorithm in English or any other human language. Some people call an algorithm written in human language pseudocode. Once you know the steps that the computer will take, you can code your algorithm in the programming language of your choice.
What's the purpose of "pseudocode"? Why write an algorithm vaguely in English when you could write it precisely in Snap!? If you were programming in a punctuation-heavy language, designing your program in pseudocode would help you focus on the important ideas instead of on details like quotation marks and semicolons. But pseudocode isn't as necessary with a language like Snap!, and pseudocode can make it easy for you to fall into wishful thinking about what the computer is capable of (such as writing "Pick tomorrow's winning lottery numbers" or "Here's the melody; write the harmony").
1.3.3: What's an input? Parameter vs. Argument
-
+
Personally identifiable information (PII) is information that can let others figure out who you are and possibly get more information like your Social Security number, age, race, phone number(s), medical information, financial information, or biometric data (such as your thumbprint or face scan).
A code segment is a sequence of connected instructions that carry out a purposeful action, such as the one pictured on the left, which animates a conversation. The instructions in the code segment are carried out in order, from top to bottom.
A variable is like a box that can hold one value at a time, such as one word, one costume, or one list (which can contain many things). You can look at what's inside as many times as you want.
On Unit 1 Lab 2 Page 2: Making Programs Talk, you learned about procedural abstraction: giving scripts names by putting them in new blocks. Here, we are starting to look at data abstraction, giving names to numbers, text, lists, etc. When you give something a name, you can refer to it without knowing exactly what the value is.
A local variable can be set or used only in the environment in which it is defined. This term includes inputs to procedures and variables created by the for or script variables block.
An element is another name for an item in a list. (If the same value is in the list twice, that counts as two different elements.) Each element has a unique index (position) in the list.
A data type is what kind of data something is (number, text string, list, etc.). For example, number is the data type for the first input to and list is the the data type for its second input.
@@ -118,7 +119,7 @@
Traversing a list means looking at each item of the list. For each is iterative. That is, it's repetitive, like for, which can also traverse a list. But unlike for, for each traverses the list without using index numbers.
A nested conditional statement is an if or if else statement inside the else part of another if else statement. If the predicate of the outer if else statement is false, then inner (nested) conditional statement will test its predicate and decide what to do.
An application program interface (API) documents what a programmer needs to know about using a library: it's a description of each procedure's purpose, inputs, and outputs (but not its algorithms).
Ideas similar to Creative Commons are used for particular kinds of material:
-
Free software means software that anyone can copy, use, modify, and redistribute.
-
Open source software is a more general term that means that you put the program's code online. You may still restrict how people can use the program.
+
Free software means software that anyone can copy, use, modify, and redistribute, including commercially, provided that any modifications must be under the same license.
+ The reason for that restriction is to prevent other people from
+ turning a modified version of the software into non-free software
+ with restrictive licensing. That's the only thing you're not
+ allowed to do: make it unfree.
+
+
+
Open source software is a more general term that means that you make the program's source (human-readable) code available to anyone. You may still restrict how people can use the program.
+ One reason is for security software, so that people can check that
+ the software isn't leaking your password or other data, and will
+ therefore trust you. (One reason many people don't trust
+ computerized voting machines is that their manufacturers
+ keep their code secret.) Another reason for open source is that you're hoping other
+ people will contribute improvements to your proprietary software.
+
+
Open access scholarly research reports are available for free download, rather than requiring the permission of a journal publisher.
As you learned in Unit 1 Lab 2 Page 2: Making Programs Talk, procedural abstraction is the process of developing a program by breaking up a large problem into smaller sub-problems.
Creating a draw brick block lets you think in terms of a procedure with a name related to the problem you are solving. This makes your code easier to read, and once you've coded and debugged the block, you don't need to think about how it works each time you use it. That's the beauty of procedural abstraction.
A clone is a copy of a sprite that shares information with its parent sprite (the original sprite). For example, clones have copies of any scripts from the parent, and if the parent's script is changed, then the clones' scripts change too. However, changes you make to a clone are not shared with the parent, so you can do things like move each clone to a different position.
We use "input" loosely to mean the empty boxes in a block that get filled with values. But input also means information entered into a program by the user, as in the ask and wait block. Program input can also come from data tables, sounds, pictures, video, or other programs.
Similarly, program output means any data sent from your program to the user or to any device. Typically, the output depends on the input.
Modularity is the process of breaking a programming project up into separate sub-problems. For example on page 2 of this lab, you built code to add a contact to your app, and on this page, you built code to find contacts.
The Internet is a computer network that uses open protocols to standardize communication. A computing device connected to an Internet-connected device is required to access the Internet.
@@ -28,7 +28,7 @@
Bandwidth is the maximum amount of data that can be sent in a fixed amount of time (for digital data, it is measured in bits per second). Higher bandwidth is better because the data will travel more quickly.
Public key encryption uses a pair of keys: a public key for encryption and a private key for decryption. The sender uses the public key to encrypt the message, and receiver uses their private key to decrypt it.
A DDoS (Distributed Denial of Service) attack uses a virus to flood a server with many requests from many computers at once so that users of that server are denied service.
-
4.2.5: A rogue access point is a wireless access point that gives access to a secure network without the authorization of the network administrator.
-
+
4.2.5:
+
+A rogue access point is a wireless access point that gives access to a secure network without the authorization of the network administrator.
The digital divide refers to unequal access to computers and the Internet based on poverty, racism, sexism, isolation in the countryside, age, and other factors. The digital divide affects both individuals within a country and countries themselves.
Citizen science is scientific research conducted in whole or part by distributed individuals, many of whom may not be scientists, who contribute relevant data to research using their own computing devices.
+
Crowdsourcing is the general term for using the Internet to get a lot of people to help solve a problem. (Citizen science is a type of crowdsourcing.)
A computing innovation can be physical (such as a self-driving car), non-physical software (such as picture editing software), or conceptual (such as the idea of e-commerce), but regardless of the form, they must include a program as an integral part of their function.
Scientific notation (such as 2,350,000 = 2.35 × 106) uses powers of ten to represent very large or very small values. Floating point is the same idea but with powers of two.