Can HTML5 replace local programs in mobile development?

Source: Internet
Author: User
More and more companies are entering the mobile Internet field, It is a very difficult choice to choose HTML5 for cross-platform solutions or development for different platforms. . Early technology selection is very important, with slight carelessness and endless troubles, Is HTML5 used in advance, targeted development in a secure manner, or a compromise between the two? As mobile devices become more advanced and support for HTML5 is getting higher and higher, we will encounter a problem when moving into the mobile field: HTML5 and native (using native Code Compiled locally Program )? The prospect of HTML5 is undoubtedly attractive. A phrase "write once, run anywhere" can kill everything in seconds. I have studied HTML5 and native more deeply in the last two years. I feel that the two cannot be simply divided into two ways, it also makes a comprehensive selection based on the enterprise's own situation, team composition, company strategy and product features. I am undoubtedly very optimistic about the development prospects of HTML5, and major companies have spared no effort to promote it. Currently, the mainstream three smart machine operating systems iOS, Android, and Windows Phone have supported most of the HTML5 features. The hardware arms competition for mobile devices also removes hardware barriers for HTML5. According to the current development speed, I have determined that it is faster within three years, and mobile devices will have no pressure to run HTML5, either standard or hardware. Now, the mainstream smart machines have configured dual-core browsers and 1 GB or more of memory. You may be embarrassed to release this configuration when the smart machines come out again this year. HTML5 1. HTML5 allows you to get rid of the dependence on the platform. You can access your application directly by opening a browser without the approval of various stores. 2. Real-time update. Generally, it takes about seven working days to review the Platform. What if you find any problems after the release? This problem does not exist in Web mode. 3. write once, run anywhere? This is the dream of many programmers, and it was once an exciting place for Java. But anyone who has done cross-platform solutions knows that this is just a slogan and cross-platform is not so easy to play. No error. HTML5 can implement write once and run anywhere, but we cannot write a hello World to run anywhere. Different platforms have their own features, and users on different platforms also have their own operational habits. If you want to favor everyone, it means you cannot please anyone. 4. Reduce development workload or make development easier? For the Boss, this is a very attractive topic, because the decrease in workload means saving more money, and no boss does not like to do more things with less money. At present, a very big problem is that mobile device developers, especially IOS developers, are not easy to find, because they are all well-developed and applied by themselves, people can earn tens of thousands or even more monthly salaries on their own. Why should they enter your company? It is also your own business, with unlimited possibilities and full freedom. However, if we can make full use of HTML5, We can recruit Web Front-end developers to build mobile applications, so we don't have to worry about recruitment problems. In the eyes of many people, HTML5, CSS, and JavaScript are not much technical content. If you cannot find anyone, you can find some interns to learn. But is the workload actually reduced? Is the technical threshold really low? The answer is no! I spent half a year developing an HTML5-based mobile framework to simulate native applications and make HTML5 applications look as local as possible. Note: Yes. This is a bit like jtouch, but it is different that it can interact well with native programs, and can call local resources and other features. However, the final result is not that satisfactory. For example, HTML5 sometimes has some inexplicable problems during animation switching. Of course, you can tell me to turn off the animation effect, but it looks very rigid and I have to close some animations at last. There are not so many things to write a program using objective-C. A few simple codes can implement cool animations. HTML5 requires more code and cannot even be implemented at all. Moreover, HTML5 development on mobile devices has very high technical requirements for developers. It is not something that common Web Front-end personnel can solve. Generally, they have such technical talents, the salary is not much lower than that of native developers. If you only want to develop a website on a mobile device, it will be much simpler, but if you want to simulate native applications and have a high efficiency and elegant user experience, this is very technical. Do not underestimate web development languages such as JavaScript. Generally, my opinion is that the simpler the language, the higher the level of technical personnel, especially the planning and design capabilities. 5. Other problems: Resource calling restrictions. For example, JavaScript running in IOS cannot exceed 15 seconds, local hardware devices (such as cameras) cannot be called, and push services cannot be used. How to choose? In this case, we should not choose HTML5? As I said before: "We should make a comprehensive selection based on the situation of the enterprise, the composition of the team, the company's strategy and product features ", I recently talked about HTML5 on Weibo: "HTML5 is a strategic direction. Facebook and Google are already deployed, and Google mobile's experience on the iPhone is comparable to that on native. Basically, native + Web apps can kill most applications in seconds. If you don't want to be subject to various stores, separate web apps are also a good direction. For games and applications that are heavily reliant on the hardware environment, they can only be native. For more information, see Weibo. However, HTML5 is a trend. In the next three to five years, HTML5 will replace many local applications, however, just as we have been talking about B/S architecture replacing C/S architecture many years ago, this requires a process. Generally, there are three options between HTML and native: HTML5, native app, and HTML5 + native. HTML5 is a pure web mobile app. users need to open a browser, then enter the application URL for access. Native refers to applications developed based on specific platforms. Native + HTML5 is actually a shell method that encapsulates HTML5 and browsers, but this is invisible to users and users do not have any foreign experience, it is no different from the app downloaded from the store. Personally, I highly recommend HTML5 + native. This shelling method allows you to enjoy the Dual Advantages of native and HTML5, however, the disadvantage is that the technical content needs to be higher. Of course, what I mean here is not simply encapsulating HTML5 into a browser. Native and HTML5 have a lot of interaction. In fact, this is a bit like a hybrid hard disk. Even if we enjoy the fast SSD, however, we want to get the cost-effectiveness of mechanical hard disks. I think this will be a good solution within 5-10 years. When HTML5 and hardware develop to a certain level, we will completely turn to HTML5 at a very low cost. How to do it? Suppose there is a project that is less heavily dependent on the local environment, such as the Weibo client, a variety of social food and even lbs applications, we can use HTML5 + native ., We can encapsulate the core code core layer. This code has nothing to do with the platform, mainly business logic and shell interaction. The code is written in Web language. On the core layer, we create different UIS based on different mobile platforms. Finally, we put the above two layers in the shell of each platform. This shell is mainly done by the browser, and also includes some hardware operations and reading local resources, such as GPS, gravity sensing, camera calls, maps, push notifications, or IAP. We can deploy the Web upgrade part on the server. After you run the app, the app will ask the server for the latest web program and download and run it, in this way, you can skip the Update Review of various stores to achieve fast updates. In addition, if users cannot access the Internet, we can allow users to use the previous version of the program, and do not require users to be connected to the Internet as pure web apps do. Benefits 1. users can use it offline. the number of downloads updated is small. You can update all files or replace some files. the code is safe and secure. As we all know, a major problem for Web applications is code security. But now we can encrypt all the web code and decrypt the local application before running it, this greatly provides code security. 4. you can use a browser as an intermediary to make full use of the benefits of native. For example, you can use GPS, camera, local album, read local contacts, or use the push function. Most importantly, some functions that cannot be implemented on the Web can be implemented using native. 5. cross-platform, most of the core code does not need to be rewritten. If JavaScript code is used well, it can be used in many places, including mobile applications, mobile websites, PC websites, and various browser plug-ins, you can even use WebKit as a cross-platform application. It is true that this method is not completely cross-platform, but it is enough to reduce a lot of work, especially the later maintenance. In addition, the complete cross-platform architecture is meaningless. different platforms have their own styles. For better user experience, the interface layer needs to be developed in a targeted manner. Disadvantages I think the biggest disadvantage is the high technical difficulty. If you just encapsulate a few HTML files in a simple browser, there is no technical difficulty, but if you want to build a system-level thing, this is technically difficult. This requires someone to understand the browser features of the three mainstream platforms, understand native program development, and be proficient in HTML5/css3/JavaScript. The most important thing is that, strong architecture design capability is required. If you want to find another disadvantage, it cannot satisfy all the needs. It cannot replace native, but I think it can replace most of native. Is it suitable for us? First of all, from the product perspective, whether your product is heavily dependent on the local environment, such as image processing and gorgeous games. The second thing to consider is the composition of your technical team. If your team has a cool person who can solve these problems, and there are some people who can access the Web Front-end, then I think you can consider using this method. Technology Selection is very important, with a slight carelessness and endless future troubles. Third, we should consider your company's strategy, our views on the future development of HTML5, how much we are willing to pay on the mobile Internet, and whether we are willing to do anything forward-looking, whether you are willing to invest a lot of resources in the early stage, whether to allow trial and error, and so on. [From Tuya http://www.cnbeta.com/articles/173420.htm]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.