Coding All-in-One For Dummies. Nikhil Abraham
Чтение книги онлайн.
Читать онлайн книгу Coding All-in-One For Dummies - Nikhil Abraham страница 7
Defining web and mobile applications
Web applications are websites you visit using a web browser on any device. Websites optimized for use on a mobile device, like a phone or tablet, are called mobile web applications. By contrast, native mobile applications cannot be viewed using a web browser. Instead, native mobile applications are downloaded from an app store like the Apple App Store or Google Play and are designed to run on a specific device such as an iPhone or an Android tablet. Historically, desktop computers outnumbered and outsold mobile devices, but recently two major trends in mobile usage have occurred:
❯❯ In 2014, people with mobile devices outnumbered people with desktop computers. This gap is projected to continue increasing, as shown in Figure 2-7.
❯❯ Mobile-device users spend 80 percent of their time using native mobile applications and 20 percent of their time browsing mobile websites.
FIGURE 2-7: Mobile devices have increased at a faster pace than desktops.
The increase in mobile devices happened so quickly over the past 10 years that many companies are becoming “mobile first,” designing and developing the mobile version of their applications before the desktop version. WhatsApp and Instagram, two popular mobile applications, first built mobile applications, which continue to have more functionality than their regular websites.
Web applications are easier to build than mobile applications, require little to no additional software to develop and test, and run on all devices, including desktops, laptops, and mobile devices. Although mobile applications can perform many common web-application tasks, such as email, some tasks are still easier to perform using web applications. For example, booking travel is easier using web applications, especially since the steps necessary – reviewing flights, hotels, and rental cars, and then purchasing all three – are best achieved with multiple windows, access to a calendar, and the entry of substantial personal and payment information.
The programming languages used to code basic web applications, further defined in the following sections, include HTML (Hypertext Markup Language), CSS (Cascading Style Sheets), and JavaScript. Additional features can be added to these websites using languages like Python, Ruby, or PHP.
Starting with HTML, CSS, and JavaScript
Simple websites, such as the one shown in Figure 2-8, are coded using HTML, CSS, and JavaScript:
❯❯ HTML is used to place text on the page.
❯❯ CSS is used to style that text.
❯❯ JavaScript is used to add interactive effects like the Twitter or Facebook Share button that allows you to share content on social networks and updates the number of other people who have shared the same content.
FIGURE 2-8: The lindaliukas.fi website, built with HTML, CSS, and JavaScript.
Websites conveying mainly static, unchanging information are often coded only in these three languages. You read about each of these languages in Book 3.
Adding logic with Python, Ruby, or PHP
Websites with more advanced functionality, such as user accounts, file uploads, and e-commerce, typically require a programming language to implement these features. Although Python, Ruby, and PHP aren’t the only programming languages these sites can use, they are among the most popular ones. This popularity means that there are large online communities of online developers who program in these languages, freely post code that you can copy to build common features, and host public online discussions that you can read for solutions to common issues.
Each of these languages also has popular and well-documented frameworks. A framework is a collection of generic components, such as user accounts and authentication schemes that are reused frequently, allowing developers to build, test, and launch websites more quickly.
Popular frameworks for these languages include
❯❯ Django and Flask for Python
❯❯ Rails and Sinatra for Ruby
❯❯ Zend and Laravel for PHP
Mobile applications are hot topics today, in part because mobile apps such as WhatsApp and Instagram were acquired for billions of dollars, and mobile app companies like Rovio, makers of Angry Birds, and King Digital, makers of Candy Crush, generate annual revenues of hundreds of millions to billions of dollars.
When coding mobile applications, developers can build in one of the following ways:
❯❯ Mobile web applications, using HTML, CSS, and JavaScript.
❯❯ Native mobile applications using a specific language. For example, Apple devices are programmed using Objective-C or Swift, and Android devices are programmed using Java.
The choice between these two options may seem simple, but there are a few factors at play. Consider the following:
❯❯ Companies developing mobile web applications must make sure the mobile version works across different browsers, different screen sizes, and even different manufacturers, such as Apple, Samsung, RIM, and Microsoft. This requirement results in thousands of possible phone combinations, which can greatly increase the complexity of testing needed before launch. Native mobile apps run on only one phone platform, so there is less variation to account for.
❯❯ Despite running on only one platform, native mobile apps are more expensive and take longer to build than mobile web apps.
❯❯ Some developers have reported that mobile web applications have more performance issues and load more slowly than native mobile applications.
❯❯ As mentioned earlier, users are spending more time using native mobile applications and less time using browser-based mobile web apps.
❯❯ Native mobile apps are distributed through an app store, which may require approval from the app store owner, whereas mobile web apps are accessible from any web browser. For example, Apple has a strict approval policy and takes up to six days to approve an app for inclusion in the Apple App Store, while Google has a more relaxed approval policy and takes two hours to approve an app.