A technology book for kids! Learning how to code can be like learning a foreign language.This book serves as an excellent guide to help you start writing in the odd-looking languages that make the web work. Follow simple steps as you work with real code to build your own web robots. * Create your robot--write code that builds your robot's body and structure * Give your bot some style--add code lines that customize your robot's color and shape * Get your robot moving--finish off your robot with code that teaches it how to dance Technology Requirements: Hardware - PC or tablet with Internet connection running Windows 7 or higher or Mac with Internet connection running Mac OS X 10.7 or higher Software - Web browser to access JSFiddle.net: Google Chrome(TM), Mozilla Firefox, Apple Safari, Microsoft Edge, or Microsoft Internet Explorer version 9.0 or higher
Ebooka przeczytasz w aplikacjach Legimi na:
Liczba stron: 100
WRITING COMPUTER CODE
Published byJohn Wiley & Sons, Inc.111 River StreetHoboken, NJ 07030-5774
Copyright © 2016 by John Wiley & Sons, Inc., Hoboken, New Jersey
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.
Trademarks: Wiley, For Dummies, Dummies.com, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc., and may not be used without written permission. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc., is not associated with any product or vendor mentioned in this book.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services or to obtain technical support, please contact our Customer Care Department within the U.S. at 800-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.
Library of Congress Control Number: 2016941390ISBN 978-1-119-17730-2 (pbk); ISBN 978-1-119-17732-6 (ebk); ISBN 978-1-119-17733-3 (ebk)
Table of Contents
About This Book
About The Icons
The First Step
PROJECT 1: BECOMING A PROGRAMMER
What Is Programming?
Gathering Your Tools
Sharing Your Fiddle
PROJECT 2: GATHERING THE PARTS TO BUILD YOUR ROBOT
Saying What You Mean
Giving and Receiving Data
Knowing Your Operands and Operators
PROJECT 3: BUILDING YOUR ROBOT’S BODY
Introducing Douglas the Robot
PROJECT 4: GIVING YOUR ROBOT STYLE
Giving Douglas Style
Getting the Basics of CSS
Customizing Your Own Robot
PROJECT 5: ANIMATING YOUR ROBOT
Experimenting with Douglas
Making Douglas Dance
Creating a Variable Story
Creating the Word Replacement Game
Writing the HTML
Styling the Word Game
Finishing the Program
ABOUT THE AUTHORS
END USER LICENSE AGREEMENT
Table of Contents
SO, YOU WANT TO GET STARTED WRITING REAL COMPUTER CODE! Maybe you’ve played with drag-and-drop programming languages or you’ve done modding in Minecraft, and you’re ready for the next level. Great! There are currently more than 500 different languages for coding on computers (which isn’t very many, when you consider that there are about 6,500 human languages!). You’re about to learn the most popular languages that are used by millions of coders all over the world.
Computer code is fun and easy to learn. With some determination and a lot of imagination, you’ll be creating your very own computer programs in no time!
Just as the only way to become a great athlete or musician is to practice, practice, practice, the only way to become a computer programmer is to write code, write code, write code!
This book is put together as a series of projects with steps for constructing each project from start to finish. The projects also build upon one another, so that by the end of the book you’ll have an animated robot that you can control with your mouse and continue to modify and improve long after you finish all the projects.
Here’s what you need to do the projects in this book:
A computer running the Windows, Mac OS X, or Linux operating system
A web browser, like Chrome, Firefox, or Safari
An Internet connection
As you work through each project, keep in mind the following:
Code and web addresses are in monofont. If you’re reading this as an ebook, you can click web addresses, like
, to visit that website.
When you’re getting started, the best way to learn is to see how other people do it. For this reason, we’ve included pictures for every important step in the book, and all our examples are online at
. If you want to check your work, or just copy ours, be sure to look at both of these.
Every project wraps up with a last look at the project’s big ideas in coding. The big ideas consist of codes and concepts you’ll find useful for future projects.
Coding isn’t that hard, but it does come with a lot of technical details. If you don’t feel like reading all the explanations, just skip ahead to the next code example and try it out.
We already know that you’re ready and willing to code. Because you’re reading this, we know you’re fully qualified and able to get started right away. We don’t make many assumptions, but here are the things we wanted to mention upfront:
You should be comfortable with using a web browser to visit websites, and with typing on a keyboard.
The projects in this book won’t likely work on a phone or tablet without a keyboard.
You’re comfortable with very basic math.
We’re talking about addition, subtraction, multiplication, and division. We don’t require anything very advanced at all, but basic math is an important part of programming.
You have the patience and dedication to stick with it and troubleshoot bugs.
We guarantee that programming can be a lot of fun, but we also guarantee that it can be frustrating when you have to track down the one typo or missed command that is making your whole program not work. Stick with it!
That’s really all there is to it. If you get stuck, keep in mind that many problems in writing computer code happen simply because of spelling errors or words that you type that a computer can’t understand. Proceed slowly and carefully, and you’ll do great!
As you read through the projects in this book, you’ll see a few icons. The icons point out different things:
Watch out! The Warning icon marks important information that you can use to avoid common pitfalls when coding.
The Remember icon marks concepts you’ve encountered before and should keep in mind while coding.
The Tip icon marks advice and shortcuts that will help you create code and graphics quickly and easily.
The Fun with Code icon describes how the coding you’re doing relates to the bigger picture of computer programming.
The Fun with Math icon describes the everyday math you use while coding computer programs. Finally, you see how that stuff really is used!
Once you take your first steps down the road of writing code, the world of computers will open up to you and you’ll be able to use your computer to do some pretty amazing things. You’ll also join the community of millions of programmers around the world as we shape the web and the future! Congratulations on taking the first step!
COMPUTERS CAN’T DO THINGS ON THEIR OWN. They need a computer program to tell them what to do, and they need people to write those computer programs. The people who write the code to make computers do all sort of things are called computer programmers.
A computer program is a group of instructions that can be understood and followed by a computer. Another name for a computer program is software. Computer programming, also known as coding, is what we call it when we write these instructions.
Figure 1-1 shows a computer program.
Figure 1-1: The computer program you'll make in this book!
Right now, this computer code may look confusing, but after you’ve read this book, you'll understand how to read it and even write it yourself!
Electronic computers were first invented in the 1930s. But it was in the middle of the 1800s when the first computer program — a set of instructions designed to be carried out by a machine — was written.
Tysiące ebooków i audiobooków
Ich liczba ciągle rośnie, a Ty masz gwarancję niezmiennej ceny.
Napisali o nas:
Nowy sposób na e-księgarnię
Czytelnicy nie wierzą
Legimi idzie na całość
Projekt Legimi wielkim wydarzeniem
Spotify for ebooks