
Adventures in Coding
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
More details
Other editions
Additional editions

Persons
Content
- Intro
- Title Page
- About the Authors
- Contents
- Introduction
- What Is Scratch?
- Who Should Read This Book?
- What You Will Learn
- How This Book Is Structured
- What You Need to Use This Book
- Conventions
- Companion Website
- Contact Us
- Adventure 1: Scratching the Surface
- Coding Is Everywhere
- Speaking the Language of Machines
- Knowing Your Coding Lingo
- Writing Your First Scratch Program
- Learning the Scratch Environment
- Further Adventures in Coding
- Adventure 2: Where in the World Is Scratch?
- Setting the Stage
- Understanding Coordinates on the Stage
- Knowing Your Directions
- Moving a Sprite
- Creating Random Scratch Art
- Further Adventures in Coding
- Adventure 3: Using Control Blocks
- Understanding Code Nesting
- Branching Programs in Scratch
- Making Comments in Scratch
- Looping in Scratch
- Building the Fly Catcher Game
- Further Adventures in Coding
- Adventure 4: Using Sensing Blocks
- Learning the Sensing Blocks
- Getting and Using Text Input
- Detecting Key Presses
- Watching for Mouse Moves
- Using Timing
- Sensing Touching and Distance
- Building the Apple Patrol Game
- Further Adventures in Coding
- Adventure 5: Using Event Blocks
- Understanding the Role of Events
- Working with Key Press Events
- Using Backdrop Change Events
- Implementing Sensing and Timing Events
- Getting Your Message Across
- Putting on the Big Event
- Further Adventures in Coding
- Adventure 6: Variables and Lists
- Understanding Variable Blocks
- Making Lists
- The Ultimate Party Host
- Further Adventures in Coding
- Adventure 7: Using Operators in Scratch
- Saying Hello to the Operators
- Doing the Math
- Coding Logically
- Operating on Text
- Understanding Other Operations
- Make a Math Practice Game
- Further Adventures in Coding
- Adventure 8: Using Graphics and the Pen
- Creating Art with the Paint Editor
- Use the Pen to Make a Skywriting Plane
- Further Adventures in Coding
- Adventure 9: Building Your Own Blocks
- Making Your Own Blocks
- Borrowing Blocks with the Backpack
- Putting on a Fashion Show
- Further Adventures in Coding
- Adventure 10: Making and Using Sounds and Music
- Using Sounds
- The Sound Library
- Using the Sound Editor
- Editing Sounds
- Recording Sounds
- Importing Sounds
- Forming the Scratch Jazz Band
- Further Adventures in Coding
- Adventure 11: Exploring the Scratch Universe
- Visiting scratch.mit.edu
- Sharing Your Projects
- The Scratch Community Rules
- Remixing Projects
- Interfacing with the Real World
- Sensing with the PicoBoard
- Further Adventures in Coding
- Appendix A: Installing the Scratch Offline Editor
- Installing the Scratch Offline Editor on Windows
- Installing the Scratch Offline Editor to Your Mac Operating System
- Other Resources
- Appendix B: Testing Your Programs
- Practice Proper Planning
- Ask Other People to Test
- Look for Possible Invalid Input
- Use Comments Often
- Test Early and Often
- Keep Track of Tests and What Breaks Things
- Use Custom Blocks
- Use Sliders for Numbers
- Keep Learning
- Keep Practicing
- Glossary
- End User License Agreement
PROGRAMMING COMPUTERS IS a lot of fun. It's also a skill that many people see as mysterious and even magical. This chapter unmasks programming to show you just how easy it can be to start your own coding adventure.
Coding Is Everywhere
Computer programming, also known as coding, is how people tell computers what to do. What sorts of things can you do after you learn to program? For starters, you can write your own computer games, create modifications (or "mods") for existing games, program robots to do your bidding, create beautiful computer art and animations, and instruct your computer to play songs! The best part is that the whole time you're doing all these fun things, you're learning a valuable skill that is in sky-high demand!
Coding is a common name for computer programming. When you code, you're using a computer language to tell computers what to do.
Can you think of other things that computers can do? Think of all the things that programmers can tell computers to do. There are hundreds, or thousands, of things. Think about all the things you see computers do every day-and not just the fun things. Computer programs are used to create new medicines, design buildings, do complex mathematics, control cars, and so much more.
This is the amazing world in which computer programmers live; we get to solve interesting problems every day and do things that other people see as magic.
Speaking the Language of Machines
All sorts of different people are programmers. Programmers come from different places and countries, with different experiences and different training. They speak different languages, have many different interests, and program for different reasons. What they have in common is that they've learned to speak at least one language that is understood by computers.
A programmer is a person who writes computer programs.
Computers don't speak the same languages that people do. People speak languages such as English, French, Spanish, Portuguese, Japanese, and many others. Computers speak machine language. Machine language is a difficult-to-read (for us) language that uses numbers to provide instructions to computers.
If machine language were the only way people could talk to computers, coding would be difficult. Fortunately, people have invented languages, called programming languages, which make it easier for people to talk to computers. Here are some examples of programming languages:
- JavaScript
- BASIC
- Perl
- PHP
- Python
- Java
- Visual Basic
- C
- C++
- Scratch
These languages all have one thing in common: They take words and symbols that people understand and translate them into words and symbols that computers understand.
A programming language is a language used for giving instructions to computers.
The examples in this book use Scratch. Scratch is a language that was invented at the Massachusetts Institute of Technology (MIT). It was designed to be easy for beginners to learn while using (and teaching) all of the most important things that programmers need to know.
Knowing Your Coding Lingo
You already know some of the lingo of coding. You know that "coding" is just another name for "computer programming," and you know that people who do computer programming-or coding-are called computer programmers (or coders).
Programming languages, like human languages, are made up of different parts. In English, we have nouns, verbs, adjectives, pronouns, and other parts of speech, not to mention punctuation, and they form sentences and paragraphs. In programming languages, you combine different statements (also known as commands) to make computer programs, which are also known as applications (or apps).
A command is an instruction, written in a programming language, that tells a computer to do a task.
An application is a set of programming commands that follow each other in a particular order to accomplish tasks. Application is another name for a computer program.
Scratch, and certain other programming languages, use the term script. Script is just another name for a program.
A script is another term for a computer program that is smaller and more limited than an application.
There are a lot of specialized words in coding that all have very specific meanings, and you'll find that sometimes there are many different words for the same thing. For this reason, we've included a glossary at the back of this book where you can look up or remind yourself of the meaning of terms you're not familiar with.
One of the greatest things about Scratch is that it's easy to dive right into! To get started, you don't need to learn a lot of new concepts or vocabulary. So enough talk! Let's begin!
Writing Your First Scratch Program
When we were growing up, kids didn't care about learning a specific style of dance. Instead of trying to learn complicated dance moves like the cha-cha or the hustle, we ran around like lunatics, jumping off of things, and we sometimes got hurt in the process. Your first Scratch program will be a simulator of an old-fashioned punk rock mosh pit.
Figure 1-1 shows what the finished product will look like. If you imagine the two characters in the figure bouncing off the walls and off each other while a drumbeat plays, you'll have a good idea of the program you'll be learning to make.
Figure 1-1 Your first Scratch program
Joining Scratch
In order to create, save, and share your programs on the Scratch website, you need to use your favorite web browser to visit http://scratch.mit.edu, where you can sign up for a free account. When you go to the website, you see a screen that looks similar to Figure 1-2.
Figure 1-2 The Scratch website
Follow these steps to create your free account:
- Click the Join Scratch link in the upper-right corner or center of the screen.
The Join Scratch window opens.
- Type a username into the field labeled Choose a Scratch Username.
Your username is how Scratch will know you and how other users will see you when you start to share programs. Be creative! Choosing a username can be fun! For everyone's safety, a good username shouldn't reveal any personal information, such as your full name, age, gender, or address. Try personalizing your username by including the name of your favorite sports team or musical group.
- Choose a password and enter it into the Password and Confirm Password fields.
When creating your password, avoid using information that other people are likely to know, such as your address or birthday. Your password should be something you can remember, but it should also contain numbers or punctuation to make it more secure.
-
Click Next.
You see the second screen of the signup form.
- Enter your birthday, gender, and country and then click Next.
-
When you're asked for an email address, enter your email address in both the Email Address and Confirm Email Address fields and click Next.
Scratch sends a confirmation email to the address you provided.
- Click the OK Let's Go! button.
- Check your email. When you get the email from Scratch, click the link in it to confirm your account.
Now you're ready to go. The next section tells you how to start coding!
Meeting Scratch the Cat
After you've joined Scratch and you're ready to start coding, click the Create tab in the top menu of the screen. When the new page loads, you see the scratch Project Editor, which looks like Figure 1-3.
Figure 1-3 The Scratch Project Editor
Don't worry too much about what the things on this screen do. We'll be talking in detail about each part later. For now, let's build something!
See that cool cat in the middle of the screen? Her name is Scratch the Cat. Every new Scratch program starts with her sitting right there, waiting for instructions from you. The area where she lives is called the Stage. This is where all the action of your program takes place.
Below the Stage is an area called the Sprite Pane. The Sprite Pane shows small images of each of the characters (also known as sprites) in your program.
To the right of the Stage is a rectangle containing differently shaped blocks. This is called the Block...
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.