Home >Web Front-end >JS Tutorial >Detailed explanation of why JavaScript wins on mobile devices?

Detailed explanation of why JavaScript wins on mobile devices?

黄舟
黄舟Original
2017-03-11 15:30:181033browse

JavaScript is not the most beautiful programming language in the world. That's why a world-class expert has written a book about the "essence" of the language. The name of this book is "Deep Digging into the Highlights of JavaScript" because the good stuff is buried quite deep. Even so, it is quickly becoming one of the most popular languages ​​in the world. This popularity is well deserved, because despite the language's shortcomings, JavaScript provides developers with important advantages that other languages ​​cannot. There are some advantages that come after browser developers agreed on Javascript (well, technically ECMAScript) as the standard for the web language. The rest is the inherent web application programming model and has not been improved through any enhancements. However, although native applications dominate web applications on mobile devices, JavaScript's dominance is gradually shifting to mobile devices. Will it eventually dominate?

为什么 JavaScript 会在移动端中胜出?

Popular but Not Prioritized

The most recent TIOBE community list ranked JavaScript sixth among all programming languages ​​and continues to rise. The TIOBE method's rankings tend to favor older, more mature languages ​​and are less good at following trends. In contrast, the Redmonk ranking method places JavaScript in the first position. The Redmonk approach will be biased to some extent toward languages ​​with strong open source communities, but at the same time will substantially reflect current trends and interests. Our own Developer Economy Overview has shown that the HTML5/Javascript combination is already the second most popular language used by mobile developers, used by almost 55%. Only by a small margin, 57% of people use Java. However, while we found that the combination of HTML5 and Javascript was the preferred choice among people (19%), it was far behind Java (29%) in this square. This looks set to improve significantly in the coming years. [How do you think of this? We've got a new survey, so check it out and let us know what you think]

JavaScript flies to freedom in browsers

This isn't a standard "web" win" argument. I don’t think browsers or webview-based applications will eventually dominate mobile devices. Even if it is used and grows, it will not be the norm. If web standards are really to be opened up to rule mobile devices in the future then they need to start with the Document Object Model (DOM). The DOM is not the foundation on which applications are built, but documents. Of course you could initially design an app for documents around a platform, but you'd be stuck. Take a look at the current frameworks that allow you to design fairly high-performance applications for mobile browsers or web views: React.js, Famo.us, and lonic. What these three have in common is to use DOM as little as possible.

Yes, there are too many WebGL (or HTML5 Canvas must-have), but these are low-level APIs. What you need is a large, possibly multi-byte, good framework to create an excellent platform for developing most applications. This doesn't fit well with the web application programming model, where the latest application code is hosted on a remote server, and especially not in a mobile environment. It's true that you can create a hybrid application on top of a big, nice WebGL store that's local, and just get application-specific code from a remote server. But why use a browser? Why not just javaScript outperforms other cross-platform frameworks in hardware graphics accelerators (hint: Qt offers a good one). A high-level API wouldn't have that much overhead in bridging between languages. There may also be a lack of restrictions when it comes to accessing certain features.

There are now several very interesting new options that fit this description. React Native and NativeScript. They work in different ways, but both use JavaScript to build an application with a native UI. Appcelerator's TiNext might also be interesting, even if they've been talked about a lot over the years without ever releasing a version, so let's wait and get a glimpse of it.

JavaScript Exception

Apple has restored JavaScript’s dominance on mobile. One of the key things that prevents most developers from adopting an agile, web-style continuous delivery model on mobile is Apple's ban on code downloads. Without this significant slowdown in iteration mode, comparative testing would be much more difficult. This actually means that developers, especially beginners, will learn slower. Until recently, the only way to get faster iterations was to start with Android first and develop a hybrid app because Apple made JavaScript an exception in the webview code download rules. In the first case, it means that most early adopters are moving away from the platform. Unfortunately, the UX trade-off in the second case is too great, and most developers take that route due to user application failures or switching to local. However, in ios7, the JavaScriptCore interface was added for running JavaScript, and in the latest ios developer program license terms, they modified the rules for code download exceptions to include JavaScriptCore.

This makes sense from a security perspective. Apple can audit and update their runtimes, however if they allow third-party runtimes to download code, they are not effectively monitoring security issues. Because JavaScript is Apple's only scripting option and they don't allow code to be downloaded locally, JavaScript is regaining its privileged position as the only option for those who want to iterate quickly. The availability of JavaScript has sparked efforts like React and NativeScript and Apple's relaxed grip on code download policies has been perfectly publicized.

Will openness win?

Web advocates sometimes suggest that open standards based on the web will ultimately win, because openness always wins. However, Linux is a clear example of an open and rapidly evolving ecosystem without committee-aligned standards. React, Facebook seems to have become a rapidly building developer ecosystem in open source projects. There's already a rapidly growing committee around React.js, which clearly gives them a head start. But the NativeScript team at Telerik is working with Google, so Angualr 2.0 needs to be seamlessly integrated. Google intends to support non-DOM environments regardless of whether web standards move towards it. It may take Microsoft and Google a long time to support the standards they will implement in future browsers. But they are working together towards TypeScript, making it easier to build a less complex application with JavaScript (proven that the compiler is smarter than humans at spotting type mismatches).

Apple has built a lot of pretty impressive tools for their new Swift language, especially interactive playgrounds. However, Facebook may have had a better coding experience on React Native based on immediate feedback and high-frequency on-the-fly coding. Apple will continue to iterate their tools, and the developer community has now added these new JavaScript environment tools. Android may be technically open source, but it's not open in terms of community building. Google is on its own to enhance Android's platform and tools. Perhaps it is the open developer community that will win, and open source that is truly community-based can iterate faster than open source based on open source standards. To this end, a "native UX using JavaScript to build" environment and success, such a platform will certainly not fail. Applications will still be built based on the look and feel of the platform and using new platform-specific APIs.

At this point, it looks like the very open JavaScript developer community is going to win, because they create apps that have the look, feel, and performance of the native platform, in addition to requiring web development experience. Closed platforms have always won in the past because apps at that time needed to be customized for their closed ecosystems. Currently, open web standards are still losing. If mobile browser manufacturers can agree to new standards and allow the applications they create to have the experience of native applications, thenthey will definitely win.

What did you use to make it?

Do you think JavaScript will control the future of mobile development? Or will Java, Objective-C and Swift continue their leadership position? As for the Internet of Things, will its backend pass Node.js? Take the survey and let us know what you use to build your app.

The above is the detailed content of Detailed explanation of why JavaScript wins on mobile devices?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn