Coding All-in-One For Dummies. Nikhil Abraham

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

Coding All-in-One For Dummies - Nikhil Abraham


Скачать книгу
a hybrid approach that involves building an app using HTML, CSS, and JavaScript, packaging that code using a “wrapper,” and then running the code inside a native mobile app container. The most popular “wrapper” is a product called PhoneGap, and it recognizes specific JavaScript commands that allow access to device-level functionality that’s normally inaccessible to mobile web applications. After one version of the app is built, native mobile app containers can be launched for up to nine platforms, including Apple, Android, BlackBerry, and Windows Phone. The major advantage to using this hybrid approach is building your app once, and then releasing it to many platforms simultaneously.

      Imagine you knew how to play the piano, but you wanted to also learn how to play the violin. One way you could do this is to buy a violin and start learning how to play. Another option is to buy a synthesizer keyboard, set the tone to violin, and play the keyboard to sound like a violin. This is similar to the hybrid approach, except in this example, the piano is HTML, CSS, and JavaScript, the violin is a native iOS app, and the synthesizer keyboard is a wrapper like PhoneGap. Just like the synthesizer keyboard can be set to violin, cello, or guitar, so too can PhoneGap create native apps for Apple, Android, and other platforms.

WHAT ABOUT ALL THOSE OTHER PROGRAMMING LANGUAGES? (C, JAVA, AND SO ON)

      You may wonder why so many languages exist, and what they all do. Programming languages are created when a developer sees a need not addressed by the current languages. For example, Apple recently created the Swift programming language to make developing iPhone and iPad apps easier than Objective-C, the current programming language used. After they’re created, programming languages are very similar to spoken languages, like English or Latin. If developers code using the new language, then it thrives and grows in popularity, like English has over the past six centuries; otherwise, the programming language suffers the same fate as Latin, and becomes a dead language.

      You may remember languages like C++, Java, and FORTRAN. These languages still exist today, and they’re used in more places than you might think. C++ is preferred when speed and performance are extremely important and is used to program web browsers, such as Chrome, Firefox, and Safari, along with games like Call of Duty and Counter Strike. Java is preferred by many large-scale businesses and is also the language used to program apps for the Android phone. Finally, FORTRAN isn’t as widespread or popular as it once was, but it is popular within the scientific community, and it powers some functionality in the financial sector, especially at some of the largest banks in the world, many of which continue to have old code.

      As long as programmers think of faster and better ways to program, new programming languages will continue to be created, while older languages will fall out of favor.

      Chapter 3

      Becoming a Programmer

      IN THIS CHAPTER

      ❯❯ Discovering the process programmers follow when coding

      ❯❯ Understanding the different roles people play to create a program

      ❯❯ Picking tools to start coding offline or online

      “The way to get started is to quit talking and begin doing.”

– WALT DISNEY

      Programming is a skill that can be learned by anyone. You might be a student in college wondering how to start learning or a professional hoping to find a new job or improve your performance at your current job. In just about every case, the best way to grasp how to code is pretty straightforward:

      ❯❯ Have a goal of what you would like to build.

      ❯❯ Actually start coding.

      In this chapter, you discover the process every programmer follows when programming, and the different roles programmers play to create a program (or, more commonly these days, to create an app). You also find out about the tools to use when coding either offline or online.

Writing Code Using a Process

      Writing code is much like painting, furniture making, or cooking – it isn’t always obvious how the end product was created. However, all programs, even mysterious ones, are created using a process. Here are two of the most popular processes used today:

      ❯❯ Waterfall: A set of sequential steps followed to create a program.

❯❯ Agile: A set of iterative steps followed to create a program. (See Figure 3-1.)

      FIGURE 3-1: The waterfall and agile processes are two different ways of creating software.

      Let me describe a specific scenario to explain how these two processes work. Imagine that you want to build a restaurant app that does the following two things:

      ❯❯ It displays restaurant information, such as the hours of operation and the menu.

      ❯❯ It allows users to make or cancel reservations.

      Using the waterfall method, you define everything the app needs to do: You design both the information-display and the reservation parts of the app, code the entire app, and then release the app to users. In contrast, using the agile method, you define, design, and code only the information-display portion of the app, release it to users, and collect feedback. Based on the feedback collected, you then redesign and make changes to the information-display to address major concerns. When you’re satisfied with the information-display piece, you then define, design, and build the reservation part of the app. Again, you collect feedback and refine the reservation feature to address major concerns.

      The agile methodology stresses shorter development times and has increased in popularity as the pace of technological change has increased. The waterfall approach, on the other hand, demands that the developer code and release the entire app at once, but since completing a large project takes an enormous amount of time, changes in technology may occur before the finished product arrives. If you use the waterfall method to create the restaurant-app example, the technology needed to take reservations may change by the time you get around to coding that portion of the app. Still, the waterfall approach remains popular in certain contexts, such as with financial and government software, where requirements and approval are obtained at the beginning of a project, and whose documentation of a project must be complete.

      The healthcare.gov website, released in October 2013, was developed using a waterfall style process. Testing of all the code occurred in September 2013, when the entire system was assembled. Unfortunately, the tests occurred too late and weren’t comprehensive, resulting in not enough time to fix errors before launching the site publicly.

      Regardless of whether you pick the agile or waterfall methodology, coding an app involves four steps:

      1. Researching what you want to build

      2. Designing your app

      3. Coding your app

      4. Debugging your code

      On average, you’ll spend much more time researching, designing, and debugging your app than doing the actual coding, which is the opposite of what you might expect.

      These steps are described in the sections that follow. You’ll use this process when you create your own app in Book 5, Chapter 1.

      Researching what you want to build

      You have an idea for a web or mobile application, and usually it starts with, “Wouldn’t it be great if… .” Before writing any code, it helps to do some investigating. Consider the possibilities in your project as you answer the following questions:

      ❯❯ What similar website/app already exists? What technology was used to build it?

      ❯❯


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