Bootstrap, PhoneGap, React Native, and dozens of other frameworks and libraries were created to keep both developer and customer happy. Can they bring the “Write once, run everywhere” paradigm into reality? Let’s see.
Due to the growing difficulty of modern software (be it websites or mobile applications), the possibility to eliminate the efforts on routine tasks becomes one of the most significant and important advantages. A lot of libraries and frameworks emerged to simplify the development process.
The Bootstrap framework consists of a wide variety of HTML and CSS templates for creating different website elements. jQuery helps interact with different parts of the existing web page. Each created for its own range of tasks, these tools significantly simplify the web development process. They save time and guarantee browser compatibility.
Due to the decreased development time, the customer receives his product faster and can count on cost-cutting. The use of well-tested components reduces the risk of possible errors. It would seem that there are no causes for concern since you can always find a suitable technology for the required website. No matter how complex idea you want to embody. But there’s another important issue. It destroys the idyllic picture and gives rise to new questions. We’re talking about the possibility for software to migrate between the existing platforms.
You see, a web app as a single available option is not always a good choice. To reach the target audience better, it’s reasonable to create a mobile app along with the web app. Higher accessibility and possibility to use the hardware features can increase the attractiveness of your business. But everything has its price. The possible advantages of multi-platform applications entail obvious difficulties. The most significant of which is the requirement of the valuable amount of time and resources to reach every mobile platform. Choosing native apps you can expect high performance, but the cost will be high too. Different teams of developers for every platform, lack of code reuse, and other features of this approach can overshadow the possible benefits.
Lately, among the other solutions that can help you implement the “Write once, run everywhere” paradigm, the React framework, occupies an important position. Or, if we want to be more precise, React Native. This technology helps develop native mobile applications using React. First of all, the word “Native” is not accidentally here. React applications look and feel like an actual native app for Android or iOS. Moreover, the performance level stays pretty high even for the high-loaded apps. In the case of web applications, you can achieve high performance, among the other features, by using the so-called Virtual DOM.
Talking shortly, Virtual DOM is a lightweight abstraction of the actual DOM, the hierarchical representation of the web page structure. It’s usually quite heavy and clumsy. Instead of checking its changes, React creates Virtual DOM and regularly compares its current state with the previous iterations. And it adds changes, if needed. Thus, instead of DOM, react developers can define series of nested “pseudo” components that will resolve to actual UI widgets or DOM elements.
Usually, while creating a user interface, the developer should think ahead. He should think how the properties of a particular component will behave when something changes. He should also think over how add or remove views, etc. With React, the whole UIs can be described as a function of their state. Then the framework will define how the components should look, behave, and change. Such kind of abstraction helps erase the difference between the web and the mobile application. Just as the hierarchy of the website components, the hierarchy of iOS components and UI widgets can be created. Combining this feature with the ability of code reuse, we can assume that a significant gain in speed of development can be achieved with ease.
But let’s dispel possible misleading. There’s no reason to believe that the code written once for a web app can be used as is for mobile apps. The ugly truth is that you will have to rewrite the existing views for the mobile platform. There’s a bunch of platform specific components you should remember about. For example, you can use
TabBarIOS for creating tabbed interfaces for iOS applications. You have probably guessed that in the case of Android you should use another component. But still, the structure of mobile applications for different platforms looks quite similar. So, if you have required react development skills, it won’t be such a painful task to migrate your code between the platforms. The good news is that besides the views you can reuse the most of the remaining code of a web application for mobile development.
Most developers, as well as customers, will adore the possibility to run the code that was written once in every possible environment. The necessity to create an application from scratch for every target platform may become a huge obstacle. Especially in case of complex projects. There are different types of workarounds with their own weak and strong sides.
“Write once, run everywhere” principle pretty much stays the dream. However, the React framework gives the possibility to get closer to this dream. As developers insist, this framework implements another important principle: “Learn once, write anywhere.” Although you can’t run your web application on the mobile platform as if it were native, you can always use the same skill set for reaching the different platforms. The overall architecture of the mobile application remains the same. All you need to do for adapting your app to a new environment is only to change the existing components with the suitable ones. Quite an excellent alternative to the necessity to re-architect everything from scratch.
Latest posts by Svetlana Gordiyenko (see all)
- XB Software Among Top Developers from Belarus 2017 - April 3, 2017
- How to Build a Cross-Browser/Hybrid Video Chat App with WebRTC - March 16, 2017
- XB Software Participated In The ‘I’m Testing Yandex’ Contest - March 13, 2017