Page 4: The Software Domain: Libraries
Unit 6, Lab 1, Page 4
On this page, you’ll learn that a library is a package of procedures written by other programmers that helps solve a problem.
Suppose a programmer wants a picture to move around on a screen that also has other pictures on it. In Snap!, that’s built in: import a picture as a sprite costume, and then move it by moving the sprite. The sprite abstraction lets a programmer move a picture over other pictures without thinking about what happens where the images overlap or how to get back parts of the image after they are covered up. Not all languages have the sprite abstraction.
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.
: Software Libraries
- 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.
Languages vs. Libraries
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.
Libraries in Snap!
Do we need all this commented out text? –MF, 6/12/20
You’ve used libraries in Snap!. For example, you used the “Bar Charts” library in Unit 5 Lab 3 Page 4: Analyzing Data.
- 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.