Site icon Tech-Wire

Most Popular Languages & Frameworks used in Mobile App Development

Mobile App Development

Mobile App Development

You are now at the point of no return, you need to choose the programming language you will use to Mobile App Development. If you go native, then the choices are limited to 2 per platform. Objective-C and Swift for iOS. Java and Kotlin for Android.

But if you choose the cross-platform you have more choices, we will explore the most popular frameworks to use: React Native, Xamarin, Ionic and Flutter.

We have already discussed and talked about Mobile App Development in my previous article.

iOS Native Programming Languages

1. Objective-C

Objective-C is a programming language based on C. It was developed in the 1980s by Brad Cox and Tom Love, then it was adapted by Apple to develop applications that run on their platforms like MacOS and later iOS.

It is a very stable, and efficient language, and as a result of being used for almost 40 years it has a lot of tools and experts. It is compatible with all Apple’s operating systems, old and new. Most of the core of apple OSes are even developed using Objective-C.

However, as an old language, Objective-C is difficult and complex. And compared to the modern alternative “Swift” it is complicated and time consuming and as you might expect, It is difficult to learn.

In 2014 Apple introduced Swift, their new modern programming language. And that ushered the end of Objective-C. It started a slow death, as the younger sweeter sibling started replacing it in everything. Even Apple started to abandon Objective-C and they don’t provide frequent updates to it as before.

So, Unless you are an old expert of Objective-C, or you currently work on an old existing application that was developed using Objective-C, there is no point in developing your new application using Objective-C. Use Swift instead.

2. Swift

Swift is a modern, open-source, general purpose, high-level programming language that is designed by Apple and introduced in 2014. It is very easy to read, write and understand Swift, and can be used to develop applications for all Apple platforms like iOS, macOS, watchOS plus Linux as well.

Swift is one of the easiest languages to learn and use, it has concise code syntax that enables developers to perform much with less code, which in turn minimizes the chance for error as well. Swift has an optimized compiler which means it runs fast with higher performance than Objective-C.

Swift also has better memory management than Objective-C, and this was one of the major improvements developers realized when they switched languages. Having an open-source community also helped spread the language, and build a better support base.

Let’s see the difference between Swift and Objective-C in the below code sample. The first code is written using Objective C, the next one is the same functionality but written using Swift, can you spot the difference?

const int count = 25;
double price = 17.245;
NSString *startMessage = @"I love Swift. ";
NSString *endMessage = @"It’s simple and easy.";
NSString *message = [NSString stringwithFormat:@"%@%@", startMessage, endMessage];
NSLog(@"%@", message);
let count = 25
var price = 17.245
let startMessage = "I love Swift. "
let endMessage = "It’s simple and easy."
var message = startMessage + endMessage
print(message)

As you can see, Swift’s code is so much simpler, and easier to read. Even if you are not a programmer, you can understand the code and its result. And this is just a very small basic code, imagine having a full project with tens of code files, hundreds of classes, and variables. Swift is the future of iOS development, no doubt.

Before we leave iOS development, you need to know that the IDE used for developing iOS applications is called XCode, developed by Apple for sure, and runs only on macOS. Which means of course that you will need a Mac to develop your iOS apps, test them, and compile them.

XCode supports coding with both Swift and Objective-C, and it’s free. However if you decide to submit your application to the Apple Store, you will need a $99 yearly subscription.

Android Native Programming Languages

1. Java

Java is a multi-platform programming language, developed by Sun Microsystems in the 1990s, and now maintained by Oracle Corporation. It is simple and powerful, and is considered among the most popular programming languages.

Java is platform independent, which made it easy for google to decide to use it for Android app development, it was already a known and popular language, which meant thousands of developers could jump the android wagon easily with no need to learn a new language.

It is a multi-threaded object-oriented programming language, it also has a built-in garbage collector and memory management system, unlike other old languages like C++, which makes Java simpler and safer to use.

As an old and popular language, there is no lack of tutorials, code samples, books and courses everywhere. The support community for Java is huge, either for the language itself, or for its android SDKs. 

2. Kotlin

Kotlin is an open-source programming language that was developed by JetBrains, and was officially released in 2016. 2 years later, in 2018, Google declared that Kotlin is an official programming language for Android, and they gave it their full support, since then Kotlin is competing with Java in Android app development.

Kotlin is a concise language, which means developers can write shorter code, it is also a null safe language, which means it is less error prone, and safer. It has interoperability features that allows developers to call Java codes from within Kotlin easily. And although Java is easy, Kotlin is even easier to learn and master.

So Kotlin Or Java?

So, if both Kotlin and Java are powerful, and easy to learn. Which language should you use to develop for Android? 

This is not an easy question, both languages have their own features, and we can debate for hours about the answer. However the short answer for this question is learn and use Kotlin if you are just starting.

Kotlin is much simpler to write, and its syntax is more modern than Java. It is currently the preferred language for Android development. Google is now increasingly taking the Kotlin-first approach. Most of the new tools introduced by google (like Android Jetpack) are either written by Kotlin, or support Kotlin only features.

Does this mean that Java is dying, or do we expect Google to abandon Java? Definitely not. As most Android SDKs are already written with Java, and a lot of major applications in Android are developed with Java. So it’s very unlikely that Google will abandon it anytime soon. They just recommend using Kotlin as a better, more modern alternative.

Why is Kotlin considered better? It has many features that are not found in Java. The most loved features of Kotlin are extension functions, which allows you to extend the functionality of existing classes, which is not very easy to do in Java.

And Coroutines, which means you can suspend the execution of a code and resume it later when a certain condition is achieved, or data is received.

This helps avoid situations that may block the main thread of your application and might cause it to crash or become unresponsive, this is another functionality that is not supported by Java, the alternative is to create multiple threads which complicates the code.

The official IDE used to develop Android apps is Android Studio, which is a special version of IntelliJ IDEA developed by JetBrain. It is free and available to download by anyone, and supports developing apps using both Kotlin and Java.

It can run on Windows, MacOS and Linux as well. You can use other popular IDEs like Eclipse, IntelliJ IDEA, NetBeans and others, but Android Studio is the most complete IDE for Android development. 

Cross Platform Frameworks

In the previous article, we discussed the concept of cross platform app development, where you develop one app with one code, and build it for both iOS and Android. The benefit for this technique is saving time, effort and money.

Cross platform development is done using frameworks, each framework is built using a base programming language, and offers a set of tools and libraries that are dedicated to building applications for the 2 mobile platforms.

In this article we will explore the 4 most popular frameworks used in cross platform app development.

1. React Native

Till recently, React Native was the most popular cross platform framework. It is built on JavaScript and developed by Facebook in 2015. It gives the application you develop the native look and feel for both iOS and Android. Some of the most popular applications used by billions of users are built using React Native including Facebook, Instagram and Skype.

React Native uses a special markup language called JSX with JavaScript to build the UI of the application. It uses tags to describe the components to be rendered, like <View>, <Text>, <ScrollView> and so on. The UI delivered by React Native is highly responsive And fast.

The wide usage of React Native means that there is a large support community, the internet is full of tutorials, sample codes and open-source projects based on React Native. It is very easy to learn especially if you have a good background with web development and JavaScript.

To give you a taste of React Native, the below code is a very basic code for a simple application that counts the clicks on a button. As you can see it is very similar to web development, JavaScript code, stylesheet that defines the look of the UI, and HTML-like tags that describe the UI layout.

import React, { Component } from 'react'
import {
  StyleSheet,
  TouchableOpacity,
  Text,
  View,
} from 'react-native'

class App extends Component {
  state = {
    count: 0
  }

  onPress = () => {
    this.setState({
      count: this.state.count + 1
    })
  }

 render() {
    return (
      <View style={styles.container}>
        <TouchableOpacity
         style={styles.button}
         onPress={this.onPress}
        >
         <Text>Click me</Text>
        </TouchableOpacity>
        <View>
          <Text>
            You clicked { this.state.count } times
          </Text>
        </View>
      </View>
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  button: {
    alignItems: 'center',
    backgroundColor: '#DDDDDD',
    padding: 10,
    marginBottom: 10
  }
})

export default App;

And like everything, nothing is without downsides, React Native included. The applications built with React Native usually have lower performance than native apps, this is expected as we added a layer between your code and the platform which is the framework itself.

Another main drawback of using React Native is that it is very hard to debug. As the apps are built using a combination of JavaScript, Java and C++.

Many developers also consider updating React Native releases that their app is built on a complicated process. It requires a lot of steps and in a lot of cases breaks the code and requires a lot of modifications.

2 .Ionic

Ionic is an open-source UI toolkit that was created in 2013 and is used to build mobile and desktop apps using web technologies like HTML, CSS and JavaScript. It provides platform-specific UI elements through a library of native components for both Android and iOS.

It uses AngularJS architecture to build single page applications optimized for mobile devices. Also Apache Cordova provides APIs to access native devices functionality. It is estimated that 5 million apps are built using the Ionic framework.

Ionic is easy to learn, especially if you have knowledge of frontend web development. The official documentation is rich, well structured and covers all the aspects you may need to start developing apps with Ionic.

The UI of the applications built with Ionic is highly customizable, and it can adapt to whatever platform it is running on. The apps built with Ionic are modular and very easy to update when needed.

Like many cross platform frameworks, developing with Ionic face challenges, including difficulty to debug the applications. Lower performance than the native application due to having layers in between your app and the platform.

Ionic depends heavily on plugins to access native functionality. You might end up using several plugins in your apps, and it is not uncommon for plugins to interfere with each other and produce errors that are not easy to debug.

3. Xamarin

Xamarin is a development framework used for cross-platform development using the C# language. It is used to develop apps for Android, iOS and Windows. It was developed by a company with the same name in 2011, but was later acquired by Microsoft in 2016, and was made an open-source framework which made it more popular.

Xamarin uses C#, a modern stable language developed by Microsoft, that has many improvements over the original native languages like Objective-C and Java, and as modern as the newer native alternatives like Swift and Kotlin.

Xamarin also provides tools to include libraries made with Java, Objective-C and C++, which enables developers to use third party code and libraries. It also has project binding capabilities, which allows developers to bind Java or Objective-C libraries by declaring them.

Applications developed with Xamarin are very close to native apps in performance, unlike apps developed with Web based frameworks like Ionic and React Native. The UI of these apps give a very similar experience like native apps. Xamarin. Forms tool converts the application UI elements to platform specific UI elements.

Hardware support is also one of the strong points of Xamarin, it uses plugins to eliminate hardware compatibility issues. And with full support of a tech giant like Microsoft, you can guarantee that Xamarin will receive the best support there is, plus the added value of the community of open-source.

The main drawbacks of Xamarin is common with all cross-platform frameworks, there is always a delay in adapting latest platform updates. It is almost impossible for any 3rd party framework to immediately implement the latest additions or updates in the platforms. They will always take some time to publish updates to follow them.

Applications built with Xamarin tend to have larger size than native apps, this is due to the large libraries needed to run the apps, this might cause problems to developers who want their apps to be small and accessible to everyone.

4. Flutter

Flutter is the latest arrival to the cross-platform development world, it was created by google based on the Dart programming language, and was first introduced in 2017 and officially released in 2018. It is open source and is considered as a complete SDK rather than a simple framework.

It included a full rendering engine, widgets and APIs. It can build applications that run almost everywhere, from mobile platforms like iOS and Android, to desktop platforms like Windows, Linux and MacOS, and even on the web.

Flutter supports hot reload, which means you can see the changes you make to your code in the test app instantaneously. This is a great feature that makes changing and testing UI changes a breeze.

Flutter is currently used by large corporations to deliver apps with great customer experience, several Google apps are currently developed by Flutter, Alibaba, eBay, Groupon, Etsy, BMW are also among the big corporations that adapted Flutter to develop their mobile apps. It’s no surprise that in 2021 Flutter passed React Native to be the most popular cross platform development kit.

Applications developed by Flutter have similar performance as native apps. This is because Flutter doesn’t have a middle layer like other frameworks, as Dart, the underlying language behind Flutter, compiles directly to native code. The rendering engine of Flutter is very fast. Google promises Flutter can render up to 120 frames per second in devices capable of that.

Dart, the programming language behind Flutter is a modern and strong language created by Google, it is very easy to learn and use. However it is not a very popular language, which is one of the few drawbacks of Flutter. However with the quick spread of the language and framework, Dart will be more popular with time.

To give you the sense of Flutter and Dart language, the below code and screenshot show the basic default app that is created when you start a new Flutter project. A simple button that counts and displays the number in a text box on the screen.

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:internet_connection_checker/home/home_page_controller.dart';

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetBuilder<HomeController>(
      builder: (controller) => Scaffold(
        appBar: AppBar(
          title: Text('Counter App'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              const Text(
                'You have pushed the button this many times:',
              ),
              Text(
                '${controller.counter}',
                style: Theme.of(context).textTheme.headline4,
              ),
            ],
          ),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: controller.incrementCounter,
          tooltip: 'Increment',
          child: const Icon(Icons.add),
        ),
      ),
    );
  }
}

Conclusion

In this article we discussed all the options you have to start developing your new app. From native apps to cross-platform. Which technique to use should be the first decision you make. Based on your priorities as discussed earlier.

Our own recommendation, unless you have a very valid reason, you should develop a cross-platform app. And the best option you have based on our experience and global trends is Flutter.

The most complete, and highest performance framework to use for cross-platform development, with the full support of Google, which is also the company developing Android, one of the 2 platforms, you can guarantee that Flutter is made to stay and evolve.

If you still want to go native, then Swift for iOS and Kotlin for Android are the way forward.

In future articles, we will dive deeper into mobile app development for both platforms, so follow us.

Exit mobile version