Teacher feedback from 2017-2018: despite the strong intention of understanding abstract data types and making a point block, this was very difficult for students to understand, as they just could not relate, lost interest and didn’t really understand the why behind what they were doing --MF, 3/6/19
PG: clean up
point
to make your U2L2-DrawShape code easier to read, debug, and use:
Just as the name suggests, a data type is what type of data something is (number, text string, list, etc.). Each programming language provides some primitive (built in) data types. Snap! provides numbers, text (words and sentences), lists, Booleans, and some you haven't yet used as data:
An abstract data type (or ADT) is a kind of data that's meaningful to your program but not built into the language. You develop it as you program.
For example in this lab, you'll create a point data type with:
The word "abstract" is often used casually to mean something harder to understand or more complex, but in computer science, its meaning is almost the opposite. ADTs are things that you, the programmer, create to make your program easier for you and others to read, debug, and improve.
point
ADT, you won't have to think about how points are represented as lists.item 2 of
.item 2 of
, so what's the use? It won't make the program shorter.x coordinate
and y coordinate
instead of item of
as inputs to the go to
block.#
symbol in the point
block's input names. Just like the ⋮
symbol for inputs that you declared to be lists, the #
is not part of the input's name but is a type hint that Snap! shows when you select the number input type:point
ADT because they each select one component of a point. go to point
block (from "U2L2-DrawShape") by using selectors inside the go to point
block as Betsy and Gamal described.point
constructor in the list of points. Check to see that your draw shape ()
block works with this new list.draw message ()
block that takes a list of letters as input and uses draw shape ()
several times to draw a message.draw message
draws the letters next to each other instead of replacing one with another: