Coding All-in-One For Dummies. Nikhil Abraham

Читать онлайн книгу.

Coding All-in-One For Dummies - Nikhil Abraham


Скачать книгу
assume you have a computer running the latest version of Google Chrome. The examples in the book have been tested and optimized for the Chrome browser, which is available for free from Google. Even so, the examples may also work in the latest version of Firefox. Using Internet Explorer for the examples in this book, however, is discouraged.

      I assume you have access to an Internet connection. Some of the examples in the book can be done without an Internet connection, but most require one so that you can access and complete the exercises on www.codecademy.com.

      For the books on data analysis and machine learning, I assume you are able to download and install the Python programming language and associated programming libraries, both of which are available for free. I also assume you have some math background and understand how algorithms work.

Icons Used in This Book

      Here are the icons used in the book to flag text that should be given extra attention or that can be skipped.

      This icon flags useful information or explains a shortcut to help you understand a concept.

      This icon explains technical details about the concept being explained. The details might be informative or interesting, but are not essential to your understanding of the concept at this stage.

      Try not to forget the material marked with this icon. It signals an important concept or process that you should keep in mind.

      Watch out! This icon flags common mistakes and problems that can be avoided if you heed the warning.

Beyond the Book

      A lot of extra content that you won’t find in this book is available at www.dummies.com. Go online to find the following:

      ❯❯ The source code for the examples in this book: You can find it at

      www.dummies.com/go/codingaiodownloads.

      The source code is organized by chapter. The best way to work with a chapter is to download all the source code for it at one time.

      ❯❯ The links to the Codecademy and other exercises: You can find these at

      www.dummies.com/go/codingaiolinks.

      ❯❯ Cheat Sheet: You can find a list of common HTML, CSS, and JavaScript commands, among other useful information.

      To view this book’s Cheat Sheet, simply go to www.dummies.com and search for “Coding For Dummies All-in-One Cheat Sheet” in the Search box.

      ❯❯ Updates: Code and specifications are constantly changing, so the commands and syntax that work today may not work tomorrow. You can find any updates or corrections by visiting

      http://tinyletter.com/codingfordummies.

Where to Go from Here

      All right, now that all the administrative stuff is out of the way, it’s time to get started. You can totally do this. Congratulations on taking your first step into the world of coding!

      Book 1

      Getting Started with Coding

      Chapter 1

      What Is Coding?

      IN THIS CHAPTER

      ❯❯ Seeing what code is and what it can do

      ❯❯ Touring your first program using code

      ❯❯ Understanding programming languages used to write code

      “A million dollars isn’t cool, you know what’s cool? A billion dollars.”

– SEAN PARKER, The Social Network

      Every week the newspapers report on another technology company that has raised capital or sold for millions of dollars. Sometimes, in the case of companies like Instagram, WhatsApp, and Uber, the amount in the headline is for billions of dollars. These articles may pique your curiosity, and you may want to see how code is used to build the applications that experience these financial outcomes. Alternatively, your interests may lie closer to work. Perhaps you work in an industry in decline, like print media, or in a function that technology is rapidly changing, like marketing. Whether you are thinking about switching to a new career or improving your current career, understanding computer programming or “coding” can help with your professional development. Finally, your interest may be more personal – perhaps you have an idea, a burning desire to create something, a website or an app, to solve a problem you have experienced, and you know reading and writing code is the first step to building your solution. Whatever your motivation, this book will shed light on coding and programmers, and help you think of both not as mysterious and complex but approachable and something you can do yourself.

      In this chapter, you will understand what code is, what industries are affected by computer software, the different types of programming languages used to write code, and take a tour of a web app built with code.

Defining What Code Is

      Computer code is not a cryptic activity reserved for geniuses and oracles. In fact, in a few minutes you will be writing some computer code yourself! Most computer code performs a range of tasks in our lives from the mundane to the extraordinary. Code runs our traffic lights and pedestrian signals, the elevators in our buildings, the cell phone towers that transmit our phone signals, and the space ships headed for outer space. We also interact with code on a more personal level, on our phones and computers, and usually to check email or the weather.

      Following instructions

Computer code is a set of statements, like sentences in English, and each statement directs the computer to perform a single step or instruction. Each of these steps is very precise, and followed to the letter. For example, if you are in a restaurant and ask a waiter to direct you to the restroom, he might say, “head to the back, and try the middle door.” To a computer, these directions are so vague as to be unusable. Instead, if the waiter gave instructions to you as if you were a computer program he might say, “From this table, walk northeast for 40 paces. Then turn right 90 degrees, walk 5 paces, turn left 90 degrees, and walk 5 paces. Open the door directly in front of you, and enter the restroom.” Figure 1-1 shows lines of code from the popular game, Pong. Do not worry about trying to understand what every single line does, and don’t feel intimated. You will soon be reading and writing your own code.

      FIGURE 1-1: Computer code from the game Pong.

      One rough way to measure a program’s complexity is to count its statements or lines of code. Basic applications like the Pong game have 5,000 lines of code, while more complex applications like Facebook currently have over 10 million lines of code. Whether few or many lines of code, the computer follows each instruction exactly and effortlessly, never tiring like the waiter might when asked the hundredth time for the location of the restroom.

      Be careful of only using lines of code as a measure for a program’s complexity. Just like when writing in English, 100 well written lines of code can perform the same functionality as 1,000 poorly written lines of code.

      Writing code with some Angry Birds

If you’ve never written code before, now is your chance to try! Go to http://csedweek.org/learn,


Скачать книгу