In June of 2021, I was lucky enough to take part in the Codebar Literary Festival, a collaboration between codebar.io and The Pragmatic Bookshelf.
As stated on codebar’s website:
codebar is a charity that facilitates the growth of a diverse tech community by running free regular programming workshops for minority groups in tech.
Great event, great purpose, and I had a blast talking about the current state of mobile development.
If you wish you could have seen that presentation, you’re in luck! All the presentations from the Literary Festival are available on YouTube, including mine:
Now, if you prefer reading to watching, you’re also in luck! The following post is a written version of the same topic. This isn’t a transcription of the talk but me re-telling the same general story again.
tl; dr
Short on time/attention span? Here’s a quick summary of what we’re covering today:
- We have three primary options for mobile dev in 2021
- Native
- Cross-platform (e.g. Flutter, React Native, Xamarin)
- Web
- Which is the best?
- Native is the best* (but maybe not for you/your team)
- Cross-platform options are great now
- Websites are the quickest/easiest to get out there, but may be lacking
Mobile App Development
Before we start talking about options, let’s make sure we’re on the same page with what “mobile app” here means. I’m considering a “mobile app” to be something that you use on a phone or tablet. This may mean a native app installed on your phone like the Albert app or a mobile web site accessed through Chrome/Safari/etc like MLB.com.
Even when talking native apps, there are options out there with some great cross-platform frameworks. We’ll get to those in a little bit, though, as it makes sense to instead start with the native languages for each platform.
Native Apps
When people think of native apps on mobile, they generally mean apps written in Kotlin or Java (for Android) and Swift or Objective-C (for iOS). I listed both languages for each platform, but you really want to use Kotlin or Swift if you have the choice.
Positives
The native languages are great as they’re the way the platform creators meant for app development to happen. You’ll get a nice, high-quality experience on all sorts of devices. That’s not to say you can’t make the app run terribly (ask me how I know) but you have all the tools you need to make your app work.
Plus, there are a ton of great resources available for both platforms: text guides, videos, and books. I happen to be partial to this one:
Yes, it’s my book, so I’m completely biased, but “Kotlin and Android Development featuring Jetpack” is a great resource for getting started with Android (or just Kotlin). I’m done with the shameless plugs for now, I swear.
Negatives
That being said, native isn’t always perfect. The main issue with native development is that you have two completely separate code bases in different languages with all their own patterns/concepts/structures. Generally, you’re going to want two teams to handle the apps and that can be a mess as well.
There are ways to mitigate this issue, however. In particular, moving as much logic as possible to your web services (the calls made by the apps to the server). If you focus on displaying data on the apps rather than executing business logic (code that’s specific to how your business works), you can reduce the amount of work in each codebase. Leave your complex logic on the server if you can and it’ll save you a bunch of time.
The other issue that comes up with native dev, mainly Android, is that rebuilding and redeploying your app can be slow. Most of the cross-platform libraries have figured out ways to get quick updates on a device but that’s not always the case natively. Again, this is much more of an Android issues as iOS is integrated really well into MacOS, but it’s something to note.
Speaking of cross-platform frameworks…
Cross-Platform
Cross-platform mobile frameworks allow you to write an app once and deploy to multiple platforms. And my word choice of “multiple” is deliberate as you get more than Android and iOS apps from these frameworks.
Flutter
First up is Flutter, Google’s cross-platform framework focused on super smooth UI.
Positives
Flutter offers a near-native experience via pre-made or custom widgets, allowing you to build the app you want quickly without too much trouble.
Speaking of building quickly, Flutter has a Stateful Hot Reload feature that can deploy your changes in a matter of seconds rather than minutes. This saves you a ton of development time and allows for more experimentation in your code.
When I mentioned multiple platforms previously, I especially had Flutter in mind. With Flutter, you can build apps for mobile, web, desktop, and even embedded devices all from one codebase, all with excellent performance.
Negatives
Now, not everything is perfect with Flutter. While you do get native-level performance, the widgets are not quite native components, meaning they look a bit different than you’d get from a traditional native app. In most cases, this likely won’t matter but it depends on the pickiness of your users.
Also, Flutter uses the Dart programming language, which can be a negative depending on your view. Dart itself is fine, but it’s much less widespread than something like JavaScript, so there aren’t as many resources or experienced developers in that space. Still, Google has put together some codelabs and workshops for beginners which are beneficial.
The biggest issue you’ll find with Flutter (and most cross-platform frameworks) is that the library support can be lacking. You may not have access to all native features for your OS and some third-party libraries may not work nicely (or at all) with Flutter. For most apps, this isn’t an issue, but it can be troublesome if you need some specific function.
React Native
React Native brings Facebook’s ever-popular ReactJS framework to mobile devices. You can write a native app using React and JavaScript in a similar fashion to web developers all over the world.
Positives
The popularity of React is one of its greatest strengths as you can find overviews, tutorials, and getting started guides for both React and React Native all over the place. Along those same lines, JavaScript is everywhere and there’s no shortage of JS devs to add to a team or offer up advice.
Similarly to Flutter, React Native has a Fast Refresh feature for getting speedy feedback on your code. This way you can see your changes almost immediately and often keep your current state in the process.
Negatives
Like Flutter, React Native isn’t perfect. The library support isn’t always there and can be a pain to get the features you want. Also, the performance of a React Native app doesn’t always match what you’d get from a truly native app or even a Flutter app.
Also, you’re using JavaScript. I happen to like JavaScript, but I know plenty of developers do not. Do keep in mind that you have the option to use TypeScript if you want static typing for your code (meaning you know what type of variable you’re using at runtime).
Finally, React is from Facebook, so take that for what you will.
Xamarin
Microsoft’s Xamarin platform is our third cross-platform option here. Built on top of the .NET platform, Xamarin allows you to build apps while taking advantage of the large .NET ecosystem.
Positives
Probably the best feature of Xamarin is that you’re compiling to native controls. This means you write your app and you end up with the same components you would have with a truly native app. This applies when using both Xamarin.Native and Xamarin.Forms.
Speaking of which, another great Xamarin feature is that you have options when creating your app. You can use Xamarin.Forms to write a single app and let the framework handle the conversion to native components, or you can use Xamarin.Native and have separate Android and iOS projects (plus other platforms if you wish).
This flexibility even extends to your code in that you can use C#, F#, or even Visual Basic to write your app.
Negatives
The largest barrier to entry with Xamarin is probably Visual Studio. You can get a Community Edition for learning and personal use, but companies require a (rather expensive) Professional or Enterprise license for development. In most cases, it’s not a lot of money for a company, but it can be the deciding factor vs. Flutter or React Native.
From my personal experience, the Hot Reload feature is inconsistent as well. I do think it’s improved in recent years, but it’s not always great. Also, Xamarin suffers from the same issue as other frameworks in that external libraries can have compatibility issues.
One thing that isn’t a negative here is that it’s made by Microsoft. The old tech monolith has surprisingly become a very dev-friendly company in recent years. Please don’t let a 20-year old opinion of Microsoft keep you away from good tools and features.
Mobile Web
When discussing mobile options, we tend to forget about the apps everyone has on their phones: web browsers.
Positives
Web sites are (pretty much) universally supported and take no effort from the user other than clicking a link or entering a URL. The user can’t uninstall your website, either, so it’s smoother for them to re-acclimate themselves with your site.
Deploying to a proper app store can be a pain and is almost always slower than deploying to your own server. This means you can more efficiently fix issues on a web site than you can with any kind of native app, cross-platform or otherwise.
Oh, and just like the cross-platform options before, you have a single codebase to worry about with a website. You may have different views for mobile vs. tablet vs. desktop (though often they’re responsive, eliminating some of the extra work), but they likely won’t be completely separate.
Negatives
While websites have come a long way to matching native apps, they aren’t 100% there. Some native integrations are still missing, though most features you’ll likely need are in there (camera, GPS, etc.)
You can’t preload content in the same as you can with an installed app, but again, there are options here. Progressive web apps (PWAs) offer features like offline support to mirror a native app. With PWAs, you can even allow users to install your website on their devices as if it’s an app.
Certain use cases do not work well on web, such as games or other more graphically-intensive apps. These generally need some kind of native app to work at the level users expect.
Finally, there’s the simple fact that users expect companies to have a mobile app. It may be unnecessary from a functionality perspective, but it’s still an expectation of the public.
Final Thoughts
Let’s jump back to our tl;dr from above:
- We have three primary options for mobile dev in 2021
- Native
- Cross-platform (Flutter, React Native, Xamarin)
- Web
- Which is the best?
- Native is the best* (but maybe not for you/your team)
- Cross-platform options are great now
- Websites are the quickest/easiest to get out there, but may be lacking
The main point here? We have multiple ways to get content out to users on their devices, and more importantly, multiple good ways to do this. Figure out what makes the most sense for you and your team and go for it as there is no longer a “right” away to approach mobile development.