|This article needs additional citations for verification. (July 2009) (Learn how and when to remove this template message)|
In computing, cross-platform software (multi-platform, or platform independent software) is computer software that is implemented on multiple computing platforms. Cross-platform software may be divided into two types; one requires individual building or compilation for each platform that it supports, and the other one can be directly run on any platform without special preparation, e.g., software written in an interpreted language or pre-compiled portable bytecode for which the interpreters or run-time packages are common or standard components of all platforms.
For example, a cross-platform application may run on Microsoft Windows on the x86 architecture, Linux on the x86 architecture and Mac OS X on either the PowerPC or x86-based Apple Macintosh systems. Cross-platform programs may run on as many as all existing platforms, or on as few as two platforms.
- 1 Platforms
- 2 Cross-platform software
- 3 Cross-platform programming
- 4 Challenges to cross-platform development
- 5 See also
- 6 References
Platform can refer to the type of processor or other hardware on which a given operating system or application runs, the type of operating system on a computer or the combination of the type of hardware and the type of operating system running on it. An example of a common platform is Microsoft Windows running on the x86 architecture. Other well-known desktop computer platforms include Linux/Unix and Mac OS X - both of which are themselves cross-platform. There are, however, many devices such as smartphones that are also effectively computer platforms but less commonly thought about in that way. Application software can be written to depend on the features of a particular platform—either the hardware, operating system, or virtual machine it runs on. The Java platform is a virtual machine platform which runs on many operating systems and hardware types, and is a common platform for software to be written for.
A hardware platform can refer to a computer’s architecture or processor architecture. For example: x86 architecture and its variants such as IA-32 and x86-64. These machines often run one version of Microsoft Windows, though they can run other operating systems as well, including Linux, OpenBSD, NetBSD, Mac OS X and FreeBSD.
Software platforms can either be an operating system or programming environment, though more commonly it is a combination of both. A notable exception to this is Java, which uses an operating system independent virtual machine for its compiled code, known in the world of Java as bytecode. Examples of software platforms include:
- Android for smartphones and tablet computers (x86, ARM)
- iOS (ARM)
- Microsoft Windows (x86, ARM)
- Linux (x86, PowerPC, ARM, and other architectures)
- OS X (x86, PowerPC (on 10.5 and below))
- Solaris (SPARC, x86)
- PlayStation 4 (x86), PlayStation 3 (PowerPC based) and PlayStation Vita (ARM)
- AmigaOS (m68k), AmigaOS 4 (PowerPC), AROS (x86, PowerPC, m68k), MorphOS (PowerPC)
- BSD (Many platforms; see NetBSD, for example)
- DOS-type systems on the x86: MS-DOS, IBM PC DOS, DR-DOS, FreeDOS
- OS/2, eComStation
As previously noted, the Java platform is an exception to the general rule that an operating system is a software platform. The Java language typically compiles to a virtual machine: a virtual CPU which runs all of the code that is written for the language. This enables the same executable binary to run on all systems that implement a Java Virtual Machine (JVM). Java programs can be executed natively using a Java processor. This isn't common and is mostly used for embedded systems.
Java code running in the JVM has access to OS-related services, like disk I/O and network access, if the appropriate privileges are granted. The JVM makes the system calls on behalf of the Java application. This setup allows users to decide the appropriate protection level, depending on an ACL. For example, disk and network access is usually enabled for desktop applications, but not for browser-based applets. JNI can also be used to enable access to operating system specific functions.
Currently, Java Standard Edition programs can run on Microsoft Windows, Mac OS X, several UNIX-like operating systems, and several more non-UNIX-like operating systems like embedded systems. For mobile applications, browser plugins are used for Windows and Mac based devices, and Android has built-in support for Java. There are also subsets of Java, such as Java Card or Java Platform, Micro Edition, designed for resource-constrained devices.
For a piece of software to be considered cross-platform, it must be able to function on more than one computer architecture or operating system. Developing such a program can be a time-consuming task because different operating systems have different application programming interfaces (API). For example, Linux uses a different API for application software than Windows does.
Just because a particular operating system may run on different computer architectures, that does not mean that the software written for that operating system will automatically work on all architectures that the operating system supports. One example as of August 2006 was OpenOffice.org, which did not natively run on the AMD64 or Intel 64 lines of processors implementing the x86-64 standards for computers; this has since been changed, and the OpenOffice.org suite of software is “mostly” ported to these 64-bit systems. This also means that just because a program is written in a popular programming language such as C or C++, it does not mean it will run on all operating systems that support that programming language—or even on the same operating system on a different architecture.
Web applications are typically described as cross-platform because, ideally, they are accessible from any of various web browsers within different operating systems. Such applications generally employ a client–server system architecture, and vary widely in complexity and functionality. This wide variability significantly complicates the goal of cross-platform capability, which is routinely at odds with the goal of advanced functionality.
Basic web applications perform all or most processing from a stateless server, and pass the result to the client web browser. All user interaction with the application consists of simple exchanges of data requests and server responses. These types of applications were the norm in the early phases of World Wide Web application development. Such applications follow a simple transaction model, identical to that of serving static web pages. Today, they are still relatively common, especially where cross-platform compatibility and simplicity are deemed more critical than advanced functionalities.
Because of the competing interests of cross-platform compatibility and advanced functionality, numerous alternative web application design strategies have emerged. Such strategies include:
- Graceful degradation
Graceful degradation attempts to provide the same or similar functionality to all users and platforms, while diminishing that functionality to a least common denominator for more limited client browsers. For example, a user attempting to use a limited-feature browser to access Gmail may notice that Gmail switches to basic mode, with reduced functionality. This differs from other cross-platform techniques, which attempt to provide equivalent functionality, not just adequate functionality, across platforms.
- Multiple codebases
Multiple codebase applications maintain distinct codebases for different (hardware and OS) platforms, with equivalent functionality. This obviously requires a duplication of effort in maintaining the code, but can be worthwhile where the amount of platform-specific code is high.
- Single codebase
This strategy relies on having one codebase that may be compiled to multiple platform-specific formats. One technique is conditional compilation. With this technique, code that is common to all platforms is not repeated. Blocks of code that are only relevant to certain platforms are made conditional, so that they are only interpreted or compiled when needed. Another technique is separation of functionality, which disables functionality not supported by client browsers or operating systems, while still delivering a complete application to the user. (See also: Separation of concerns). This technique is used in web development where interpreted code (as in scripting languages) can query the platform it is running on to execute different blocks conditionally.
- Third-party libraries
Third-party libraries attempt to simplify cross-platform capability by hiding the complexities of client differentiation behind a single, unified API.
- Responsive Web design
Responsive web design (RWD) is a Web design approach aimed at crafting the visual layout of sites to provide an optimal viewing experience—easy reading and navigation with a minimum of resizing, panning, and scrolling—across a wide range of devices, from mobile phones to desktop computer monitors. Little or no platform-specific code is used with this technique.
One complicated aspect of cross-platform web application design is the need for software testing. In addition to the complications mentioned previously, there is the additional restriction that some web browsers prohibit installation of different versions of the same browser on the same operating system. Although, there are several development approaches that companies use to target multiple platforms, all of them result in software that requires substantial manual effort for testing and maintenance across the supported platforms.Techniques such as full virtualization are sometimes used as a workaround for this problem.
Using tools such as the Page Object Model, cross platform tests can be scripted in such a way that one test case is usable for multiple versions of an app. So long as the different versions have similar user interfaces, both versions can be tested at one time, with one test case.
Although web applications are becoming increasingly popular, many computer users still use traditional application software which does not rely on a client/web-server architecture. The distinction between traditional and web applications is not always unambiguous, however, because applications have many different features, installation methods and architectures; and some of these can overlap and occur in ways that blur the distinction. Nevertheless, this simplifying distinction is a common and useful generalization.
Traditionally in modern computing, application software has been distributed to end-users as binary file, especially executable files. Executables only support the operating system and computer architecture that they were built for—which means that making a single cross-platform executable would be something of a massive task, and is generally replaced by offering a selection of executables for the platforms supported.
For software that is distributed as a binary executable, such as software written in C or C++, the programmer must build the software for each different operating system and computer architecture, i.e. must use toolset that translates—transcompiles—a single codebase into multiple binary executables. For example, Firefox, an open-source web browser, is available on Windows, OS X (both PowerPC and x86 through what Apple Inc. calls a Universal binary), Linux, and *BSD on multiple computer architectures. The four platforms (in this case, Windows, OS X, Linux, and *BSD) are separate executable distributions, although they come from the same source code.
The use of different toolsets to perform different builds may not be sufficient to achieve a variety of working executables for different platforms. In this case, the software engineer must port it, i.e. amend the code to be suitable to a new computer architecture or operating system. For example, a program such as Firefox, which already runs on Windows on the x86 family, can be modified and re-built to run on Linux on the x86 (and potentially other architectures) as well. The multiple versions of the code may be stored as separate codebases, or merged into one codebase by conditional compilation (see above). Note that, while porting must be accompanied by cross-platform building, the reverse is not the case.
As an alternative to porting, cross-platform virtualization allows applications compiled for one CPU and operating system to run on a system with a different CPU and/or operating system, without modification to the source code or binaries. As an example, Apple's Rosetta, which is built into Intel-based Macintosh computers, runs applications compiled for the previous generation of Macs that used PowerPC CPUs. Another example is IBM PowerVM Lx86, which allows Linux/x86 applications to run unmodified on the Linux/Power operating system.
Scripts and interpreted languages
A script can be considered to be cross-platform if its interpreter is available on multiple platforms and the script only uses the facilities provided by the language. That is, a script written in Python for a Unix-like system will likely run with little or no modification on Windows, because Python also runs on Windows; there is also more than one implementation of Python that will run the same scripts (e.g., IronPython for .NET Framework). The same goes for many of the open-source programming languages that are available and are scripting languages.
Unlike binary executable files, the same script can be used on all computers that have software to interpret the script. This is because the script is generally stored in plain text in a text file. There may be some issues, however, such as the type of new line character that sits between the lines. Generally, however, little or no work has to be done to make a script written for one system, run on another.
Some quite popular cross-platform scripting or interpreted languages are:
- bash – A Unix shell commonly run on Linux and other modern Unix-like systems, as well as on Windows via the Cygwin POSIX compatibility layer.
- Perl – A scripting language first released in 1987. Used for CGI WWW programming, small system administration tasks, and more.
- PHP – A scripting language most popular in use for web applications.
- Python – A modern scripting language where the focus is on rapid application development and ease-of-writing, instead of program run-time efficiency.
- Ruby – A scripting language whose purpose is to be object-oriented and easy to read. Can also be used on the web through Ruby on Rails.
- Tcl – A dynamic programming language, suitable for a wide range of uses, including web and desktop applications, networking, administration, testing and many more.
Cross-platform or Crossplay is a term that can also apply to video games released on a range of video game consoles, specialized computers dedicated to the task of playing games in order to populate servers or extend the lifespan of the game. Examples of cross-platform video games include:
The characteristics of a particular system may lengthen the time taken to implement a video game across multiple platforms. So, a video game may initially be released on a few platforms and then later released on remaining platforms. Typically, this situation occurs when a new gaming system is released, because video game developers need to acquaint themselves with the hardware and software associated with the new console.
Some games may not become cross-platform because of licensing agreements between developers and video game console manufacturers that limit development of a game to one particular console. As an example, Disney could create a game with the intention of release on the latest Nintendo and Sony game consoles. Should Disney license the game with Sony first, Disney may in exchange be required to release the game solely on Sony’s console for a short time or indefinitely—effectively prohibiting a cross-platform release for the duration.
Several developers have implemented means to play games online while using different platforms. Epic Games, Microsoft, and Valve Corporation all possess technology that allows Xbox 360 and PlayStation 3 gamers to play with PC gamers, leaving the decision of which platform to use to consumers. The first game to allow this level of interactivity between PC and console games was Quake 3.
Games that feature cross-platform online play include:
- DC Universe Online
- Kane & Lynch: Dead Men
- Lost Planet: Colonies
- Phantasy Star Online
- BlazBlue: Calamity Trigger
- Final Fantasy XI Online
- Final Fantasy XIV: A Realm Reborn
- Universe at War: Earth Assault
- Game Room
- Street Fighter V
- Team Fortress 2
- Portal 2
- Dust 514 with Eve Online
- Hero Academy
- Rocket League
- War Thunder
Cross-platform programming is the practice of actively writing software that will work on more than one platform.
Approaches to cross-platform programming
There are different ways of approaching the problem of writing a cross-platform application program. One such approach is simply to create multiple versions of the same program in different source trees—in other words, the Windows version of a program might have one set of source code files and the Macintosh version might have another, while a FOSS *nix system might have another. While this is a straightforward approach to the problem, it has the potential to be considerably more expensive in development cost, development time, or both, especially for the corporate entities. The idea behind this is to create more than two different programs that have the ability to behave similarly to each other. It is also possible that this means of developing a cross-platform application will result in more problems with bug tracking and fixing, because the two different source trees would have different programmers, and thus different defects in each version.
Another approach that is used is to depend on pre-existing software that hides the differences between the platforms—called abstraction of the platform—such that the program itself is unaware of the platform it is running on. It could be said that such programs are platform agnostic. Programs that run on the Java Virtual Machine (JVM) are built in this fashion.
Cross-platform programming toolkits and environments
- Anant Computing: A mobile application platform that works in all Indian languages, including their keyboards, which is also supports AppWallet and Native performance inside all operating systems.
- AppearIQ: A framework that supports the workflow of app development and deployment in an enterprise environment. Natively developed containers present hardware features of the mobile devices or tablets through an API to HTML5 code thus facilitating the development of mobile apps that run on different platforms.
- Cairo: A free software library used to provide a vector graphics-based, device-independent API. It is designed to provide primitives for 2-dimensional drawing across a number of different backends. Cairo is written in C and has bindings for many programming languages.
- Eclipse: An open source cross-platform development environment. Implemented in Java with a configurable architecture which supports many tools for software development. Add-ons are available for several languages, including Java and C++.
- FLTK: Another open source cross platform toolkit, but more lightweight because it restricts itself to the GUI.
- fpGUI: An open source widget toolkit that is completely implemented in Object Pascal. It currently supports Linux, Windows and a bit of Windows CE.
- GeneXus: A Windows rapid software development solution for cross-platform application creation and deployment based on knowledge representation and supporting C#, COBOL, Java including Android and BlackBerry smart devices, Objective-C for Apple mobile devices, RPG, Ruby, Visual Basic, and Visual FoxPro.
- GTK+: An open source widget toolkit for Unix-like systems with X11 and Microsoft Windows.
- Haxe: An open source cross-platform language.
- Juce: An application framework written in C++, used to write native software on numerous systems (Microsoft Windows, POSIX, Mac OS X), with no change to the code.
- Lazarus: A programming environment for the FreePascal Compiler. It supports the creation of self-standing graphical and console applications and runs on Linux, MacOSX, iOS, Android, WinCE, Windows and WEB.
- Max/MSP: A visual programming language that encapsulates platform-independent code with a platform-specific runtime environment into applications for Mac OS X and Windows.
- MechDome: A cross-platform Android runtime. It allows unmodified Android apps to run natively on iOS and OS X
- Mono: An open-source cross-platform version of Microsoft .NET (a framework for applications and programming languages)
- MonoCross: An open-source model-view-controller design pattern where the model and controller are shared cross-platform but the view is platform-specific.
- MoSync: An open-source SDK for mobile platform app development in the C++ family
- Mozilla application framework: An open source platform for building Mac OS X, Windows and Linux applications
- OpenGL: A cross-platform 3D graphics library.
- Qt: An application framework and widget toolkit for Unix-like systems with X11, Microsoft Windows, Mac OS X, and other systems—available under both open source and proprietary licenses.
- Xojo: A RAD IDE developed by Xojo, Inc. that uses an object-oriented programming language to create desktop, web and iOS apps. Xojo makes native, compiled desktop apps for Mac OS X, Windows, Linux and Raspberry Pi. It creates compiled web apps that can be run as standalone servers or through CGI. And it recently added the ability to create native iOS apps.
- Simple and Fast Multimedia Library: A multimedia C++ API that provides low and high level access to graphics, input, audio, etc.
- Simple DirectMedia Layer: An open-source cross-platform multimedia library written in C that creates an abstraction over various platforms’ graphics, sound, and input APIs. It runs on many operating systems including Linux, Windows and Mac OS X and is aimed at games and multimedia applications.
- Ultimate++: A C++ cross-platform rapid application development framework focused on programmers productivity. It includes a set of libraries (GUI, SQL, etc..), and an integrated development environment. It supports Windows and Unix-like OS-s. The U++ competes with popular scripting languages while preserving C/C++ runtime characteristics. It has its own integrated development environment, TheIDE, which features BLITZ-build technology to speedup C++ rebuilds up to 4 times.
- WinDev: Integrated Development Environment for Internet and Intranet.
- WinDev: Integrated Development Environment for Windows, Linux, .Net and Java.
- wxWidgets: An open source widget toolkit that is also an application framework. It runs on Unix-like systems with X11, Microsoft Windows and Mac OS X. It permits applications written to use it to run on all of the systems that it supports, if the application does not use any operating system-specific programming in addition to it.
- XPower++: A cross-platform IDE for Windows, Linux, Mac OS X, and mobile operating systems.
- Delphi: A cross platform IDE, which uses Pascal language for Development. Currently it supports Android, iOS, Windows, OS X.
- Unreal: A cross-platform SDK which uses Unreal Engine.
- Unity: Another cross-platform SDK which uses Unity Engine.
- 8th: A cross-platform development language, which utilizes Juce as its GUI layer. The platforms it currently supports are: Android, iOS, Windows, OS X, Linux and Raspberry Pi.
Challenges to cross-platform development
There are certain issues associated with cross-platform development. Some of these include:
- Testing cross-platform applications may be considerably more complicated, since different platforms can exhibit slightly different behaviors or subtle bugs. This problem has led some developers to deride cross-platform development as "write once, debug everywhere", a take on Sun Microsystems' "write once, run anywhere" marketing slogan.
- Developers are often restricted to using the lowest common denominator subset of features which are available on all platforms. This may hinder the application's performance or prohibit developers from using platforms’ most advanced features.
- Different platforms often have different user interface conventions, which cross-platform applications do not always accommodate. For example, applications developed for Mac OS X and GNOME are supposed to place the most important button on the right-hand side of a window or dialog, whereas Microsoft Windows and KDE have the opposite convention. Though many of these differences are subtle, a cross-platform application which does not conform appropriately to these conventions may feel clunky or alien to the user. When working quickly, such opposing conventions may even result in data loss, such as in a dialog box confirming whether the user wants to save or discard changes to a file.
- Scripting languages and virtual machines must be translated into native executable code each time the application is executed, imposing a performance penalty. This penalty can be alleviated using advanced techniques like just-in-time compilation; but even using such techniques, some computational overhead may be unavoidable.
- Different platforms require the use of native package formats such as RPM and MSI. Multi-platform installers such as InstallAnywhere address this need.
- Cross-platform execution environments may suffer cross-platform security flaws, creating a fertile environment for cross-platform malware.
- List of widget toolkits
- Platform virtualization
- Java (software platform)
- Language binding
- Binary code compatibility
- "Design Guidelines: Glossary". java.sun.com. Retrieved 2011-10-19.
- "Encyclopedia > cross platform". PC MAgazine Encyclopedia. Retrieved 2011-10-19.
- "Platform Definition". The Linux Information Project. Retrieved 2014-03-27.
- "About Mono". mono-project.com. Retrieved 2015-12-17.
- Porting to x86-64 (AMD64, EM64T) – Apache OpenOffice Wiki. Wiki.services.openoffice.org (2012-06-22). Retrieved on 2013-07-17.
- Corti, Sascha P. (October 2011). "Browser and Feature Detection". MSDN Magazine. Retrieved 28 January 2014.
- Choudhary, S.R. (2014). "Cross-platform testing and maintenance of web and mobile applications.". Companion Proceedings of the 36th International Conference on Software Engineering - ICSE Companion 2014.
- Cross Platform Mobile Testing with the Page Object Model
- "Team Fortress 2 Now available on OS X". Valve Corporation.
- "Portal 2 PC/PS3 Cross-platform". Eurogamer. Retrieved January 24, 2012.
- The GUI Toolkit, Framework Page
- Platform Independent FAQ
- WxWidgets Description