Introduction

We need you to talk in a deep voice, the deepest you can manage. Actually, a deep loud whisper would work well. And talk slowly. Got it? Ok, read the next paragraph:

Legend tells of individuals with astounding powers. Scattered around the globe they have been endowed with the ability to bring the inanimate to life. Issuing instructions in varied languages, they can bend machines near and far to their will, making them do their bidding. These individuals are awesome and powerful, for they are…coders!

<ahem> Sorry!

Ok, so we may have gotten a bit carried away there. But, coders are indeed awesome and powerful. We should know; we’re coders, and we think that we’re pretty awesome and powerful (if we do say so ourselves). The truth is, for most of us, the closest we’ll ever get to being Gandalf, Bruce Wayne, Luke Skywalker, Queen Elsa, Tony Stark, Wonder Woman, or Deadpool is mastering coding and developing the ability to command machines to do our bidding.

Yep, it’s pretty heady stuff, we know. But, truthfully, that’s what coding is. Which means superpowers are quite attainable.

In this book we’ll help you hone these skills. You’ll learn coding. But, more importantly, you’ll learn how to be a coder.

But first, why? Why learn coding at all? If you ask around or search online you’ll find various answers to that question.

The most common answer is that coding is important because it is a future-ready skill. This means that if you can code, you’ll have an easier time finding a good job in the future. And while there may be some truth to that assertion, honestly, we don’t think that’s the best reason to learn to code. Why?

For starters, not everyone needs to work as a coder. That makes about as much sense as everyone being a doctor, or everyone being a chef, or everyone being a teacher, or everyone being a pilot, or everyone being a plumber running through pipes to save a princess…you get the idea. To function properly, society needs lots of different people doing lots of different things. Sorry, but humanity just does not need 8 billion coders.

In addition, the tech space (and that includes coding) changes really quickly. What coders do now is not the same as what they did 10 years ago, and what they’ll do 10 years from now will be even more different. So, what you learn today is not what you’ll be doing as a coder in the future. The best coders never stop learning, evolving, or developing skills. The basics you’ll learn in this book will remain relevant and useful, but the specifics change, and frequently. With coding there’s no learn-it-and-done; it’ll be a mistake to invest time and energy assuming otherwise.

But most importantly, if you’re interested in coding primarily from a future career perspective, it’ll feel like work rather than fun. If it’s not fun then you won’t enjoy it; you’ll be unlikely to stick with it, and you definitely won’t be motivated to really give it your all. And that would be a shame, because coding really is a lot of fun.

That’s not to say there aren’t good jobs in coding. There are, and there will be for many decades to come. But a future career should not be the only reason to become a coder.

So, why should you learn to code? And should everyone do so? We believe everyone should learn to code, even if they have no intentions of pursuing careers in coding. We believe this just like we believe that everyone should draw and sketch, and everyone should play an instrument, and everyone should cook, and everyone should take pictures and shoot videos, and more. All of these are creative endeavors, which means that they are ways to actually create stuff, and creating stuff is incredibly rewarding and satisfying. Sure, it’s fun to spend hours on your phone looking at what other people have created; but that’s nothing compared to the joy and satisfaction of creating stuff that other people consume and use.

And, on top of that, when you learn to code, you develop all sorts of invaluable skills and traits beyond just coding. These include planning, problem solving, communication, logic, empathy, attention to detail, patience, resilience, persistence, and creativity.

Oh, and back to jobs and careers—it turns out that these skills (especially creativity and creative problem solving) are some of the most in demand out there. So, yes, coding will indeed help your future career, even if you don’t become a coder.

Great, so you should learn coding. But where to start? In our experience, too many books, videos, and lessons overly focus on the mechanics of coding—things like syntax and exact details of how to use specific language elements. They get caught up in the minute details of specific projects. It all feels a whole lot like being talked to, as opposed to being encouraged to tinker and play. And that’s boring. As in really enthusiasm-draining, soul-crushingly, yawn-inducingly boring. It’s kinda like spending hours and hours learning dictionary words and grammar and then getting to use those by copying someone else’s writing, and not being given the chance to find your own words and voice. That’s crazy, right? And yet that’s how most people are first introduced to coding.

We’ve been teaching coding for many years. In fact, we’ve helped over a million people become coders, including lots of young people your age. And we know how to help you develop these skills—we do it the same way we taught ourselves to code. It’s fast, fun, results oriented, and it works.

And that’s why we wrote this book, to help you learn to code; and, more importantly, to discover your coding superpower and turn you into a coder.

What’s in This Book

In this book we don’t just teach you how to code; lots of books do that. Some even do a pretty good job of it, too.

No, learning to code is not enough. Instead, we’re going to help you learn how to think like a coder, analyze problems like a coder, plan like a coder, progressively iterate like a coder, craft elegant solutions like a coder ... In fact, when we’re done we’ll have morphed you into <drumroll> a coder!

To that end, this book is quite different from others you may have read. We built it to help you become a coder quickly while having fun, too.

We divided this book into three sections that build upon each other. Here’s how it all works.

Part I: It’s All Fun and Games

In this section, we cover some basics (and some not so basics, too). By the time you’re done with the section, you will have learned every major coding concept, and you’ll have the knowledge you need to write just about any application.

This section is made up of 10 chapters:

  • Chapter 1 will help you get up and running, including helping you install needed software and getting it ready to use.

  • In Chapters 2 through 7 you’ll create small games and other programs, lots and lots of them. Each chapter will introduce new coding concepts that you’ll utilize immediately in a new project. And in each chapter you’ll get a chance to tweak, tinker, and make the code your own.

  • Then things will get a bit more sophisticated, and you’ll create a more ­complex game starting in Chapter 8 and finishing it in Chapter 9.

  • In Chapter 10 we’ll wrap this section with all sorts of ideas for you to try yourself.

We designed these chapters so that they build upon each other; skills you develop in one chapter will help you in subsequent chapters. But we also designed these chapters to be short and focused, and so you’ll mostly write small standalone programs in each.

You’ll want to take your time working through this section. Try every lesson and example yourself, tinker, tweak, play. Make changes to the code we provide and see what happens to the program. You can’t break it because you can always undo it! The stuff you’ll learn here is what you’ll use most, be it while working through this book or in any future projects.

Part II: On an Adventure

No more kiddie pool, you’re in the deep end now. In this section you’ll create a bigger (and more fun) game. We’ll start slow, and incrementally add functionality. What kind of game? A cool retro-style text-based adventure game that will seriously impress family and friends, and one that you can make complex enough to make hardcore gamers cry.

This section has 8 chapters:

  • Chapter 11 gets you started.

  • You’ll start creating the game in Chapter 12, and you’ll keep adding ­functionality and sophistication all the way through Chapter 17.

  • Chapter 18 will provide all sorts of ideas so you can keep improving your game.

Unlike Part I, in this section we want you to go on your own adventure, tell your own story, write your own game. We’ll help you get started, and we’ll show you all the techniques you need. You are free to use our code. We’ll even tell you how to download other story starters, but then we’ll turn things over to you to create your own masterpiece.

Part III: Hit the Road

Just as in Part II, this section is one larger game that you’ll build incrementally. This time it’s a graphical game complete with images, movement, user interaction, scores, and more.

There are 6 chapters in this section:

  • Chapter 19 gets you started using a game engine (and explains what that actually is).

  • You’ll build a complete working game in Chapters 20 through 23. We’ll even give you graphics that you can use (yeah, we’re just that nice).

  • And Chapter 24 concludes with lots of fun ideas for you to add to the game.

In this section, we’ll also give you less code to copy (as you’ll be a pro by the time you get here). Instead, we’ll tell you how to change and update your code to get it to do what you want.

Oh, one more thing. We should mention Chapter 25, “Tinkering, Testing, and Debugging Revisited.” Yep, we love you guys so much that we tossed in a bonus chapter. You’ll find it online on the book web page. Use the link or QR code at the end of this introduction to access it.

Watch Out for These

As you work through this book you’ll come across boxes and icons. This is what they all mean:

Image New Term

Title We’re not just going to help you code, we’re also going to help you talk like a real coder. Whenever we use a new word or phrase, we’ll explain it in a box that looks like this.

Image Tip

Title Coders love saving time. When you see a box with this symbol, you’ll know that it contains shortcuts, time-saving ideas, or just stuff we think will make coding easier.

And finally, watch for QR codes (like this one) throughout the book. They’ll take you to web pages that contain useful links, downloadable code, challenge solutions, and more.

Image

Getting Help

As you work through this book, you’re going to occasionally need some help. When that happens, here’s what you need to do:

  • First, check the book web page at https://forta.com/books/0137653573 or scan this QR code. We’ve posted lots of tips, solutions, and more for you.

    Image
  • You can also do what most coders do and Google it. Type really specific questions (complete with the exact language problem, for example) and you will find answers.

  • And you are always free to contact us. You’ll find contact information on https://forta.com/ and in the front of this book.

And with that, welcome, turn the page, and let’s get started!

Ben & Shmuel

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset