Название: Coding All-in-One For Dummies
Автор: Nikhil Abraham
Издательство: John Wiley & Sons Limited
Жанр: Зарубежная образовательная литература
isbn: 9781119363033
isbn:
If you’re making this choice, consider the complexity of your application. Simple applications, like schedules or menus, can likely be cheaply developed with a mobile web app, whereas more complex applications, like messaging and social networking, may benefit from having a native mobile app. Even well-established technology companies struggle with this choice. Initially, Facebook and LinkedIn created mobile web applications, but both have since shifted to primarily promoting and supporting native mobile apps. The companies cited better speed, memory management, and developer tools as some of the reasons for making the switch.
Building mobile web apps
Although any website can be viewed with a mobile browser, those websites not optimized for mobile devices look a little weird; that is, they look as though the regular website font size and image dimensions are decreased to fit on a mobile screen. (See Figure 2-9.) By contrast, websites optimized for mobile devices have fonts that are readable, images that scale to the mobile device screen, and a vertical layout suitable for a mobile phone.
FIGURE 2-9: Left: starbucks.com not optimized for mobile. Right: starbucks.com optimized for mobile.
Building mobile web apps is done using HTML, CSS, and JavaScript. CSS controls the website appearance across devices based on the screen width. Screens with a small width, such as those on phones, are assigned one vertically based layout, whereas screens with a larger width, like those on tablets, are assigned a horizontally based layout. Because mobile web apps are accessed from the browser and aren’t installed on the user’s device, these web apps can’t send push notifications (alerts) to your phone, run in the background while the browser is minimized, or communicate with other apps.
Although you can write HTML, CSS, and JavaScript for your mobile web app from scratch, mobile web frameworks allow you to develop from a base of prewritten code, much like the frameworks for programming languages I mention earlier. These mobile web frameworks include a collection of generic components that are reused frequently and allow developers to build, test, and launch websites more quickly. Twitter’s Bootstrap is one such mobile web framework, which I introduce in Book 4, Chapter 1.
Building native mobile apps
Native mobile apps can be faster and more reliable and can look more polished than mobile web apps, as shown in Figure 2-10. Built using Java for use on Android devices, and Objective-C or Swift for use on Apple devices (iOS), native mobile apps must be uploaded to an app store, which may require approvals. The main benefit of an app store is its centralized distribution, and the app may be featured in parts of the app store that can drive downloads. Also, since native mobile applications are programs that are installed on the mobile device, they can be used in more situations without an Internet connection. Finally, and most importantly, users appear to prefer native mobile apps to mobile web apps by a wide margin, one that continues to increase.
FIGURE 2-10: Left: facebook.com native mobile app. Right: facebook.com mobile web app.
Native mobile apps can take advantage of features that run in the background while the app is minimized, such as push notifications, and communicate with other apps, and these features aren’t available when you’re creating a mobile web app. Additionally, native mobile apps perform better when handling graphics-intensive applications, such as games. To be clear, native mobile apps offer better performance and a greater number of features, but they require longer development times and are more expensive to build than mobile web apps.
There is an alternative way to build a native mobile app – 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.
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.”
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.
❯❯ СКАЧАТЬ