“To dream the impossible dream” when it comes to software is the concept of a universal programming language/environment/runtime that runs on any hardware. Of course, embedded developers know that attaining that goal is a lot harder than it looks. Just getting something to look good on two different-size displays is hard enough, let alone supporting multiple input devices, different power management schemes, a variety of connectivity mechanisms, and so on.
Oracle’s Java originally touted the “write once, run everywhere” ideal. Java has been successful running across a wide variety of platforms, but it is still a “write once, run almost everywhere, otherwise customize” solution. The Java virtual machine (JVM) made running the code on another platform easier, but it does not address details like user interface or device support.
Even C was designed to provide a level of portability, but system interfaces are the bane of developers. Frameworks like Qt (pronounced “cute”) provide a degree of display portability by providing the same API to developers while hiding the underlying operating system specifics. The graphics support allows an application to work on many different platforms, but there are challenges when providing controls to handle touch support because of differences in size and convention between platforms like PCs, tablets, and smartphones.
I was reminded of this challenge while working with Microsoft’s Visual Studio 2015 and the company’s new Universal App framework (Fig. 1). The goal is to have an app in the Windows Store that would work across the Microsoft operating systems from phone to tablets to desktops. This is not the first time Microsoft has pushed portable application development. Its Common Language Infrastructure (CLI), C# and .NET provide portability similar to Java.
The Universal App framework builds on this and preserves common code within a project that is designed to be the bulk of an application with additional platform-specific code to address different platforms like smartphones and tablets (Fig. 2). Shared Projects within Visual Studio allow developers to create contextually appropriate user interfaces for the target platforms. This approach allows projects to target a platform while sharing code with other related projects.
Visual Studio targets Microsoft Windows platforms including the forthcoming Windows 10. By adding the Xamarin plugin, Visual Studio projects can target Android and iOS platforms as well. Xamarin maintains Mono, an open-source implementation of CLI that runs C# applications.
Of course, Visual Studio can also package apps for the Windows Store and can upload the packages for multiple targets.
Designers still need to consider all targets and take into account their advantages and limitations. At least with Visual Studio 2015, the job is easier to manage.