Cross-platform
From Wikipedia, the free encyclopedia
Cross-platform is a term which can refer to computer programs, operating systems, computer languages, programming languages, or other computer software and their implementations which can be made to work on multiple computer 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 based Apple Macintosh or the x86 based Apple Macintosh systems. A cross-platform application could run on all common platforms, or simply more than one. This type of software could also correctly be called multi-platform software.
Contents |
[edit] Platforms
A platform is a combination of hardware and software used to run software applications. A platform can be described as simply as an operating system or computer architecture, or it could be the combination of both. Probably the most familiar platform is Microsoft Windows running on the x86 architecture. Other well-known desktop computer platforms include GNU/Linux and Mac OS X (both of which are themselves cross-platform). There are, however, many devices such as cellular telephones 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.
[edit] Hardware platforms
A hardware platform can refer to a computer’s architecture or processor architecture. For example, the x86 and x86-64 CPUs make up one of the most common computer architectures in use in home machines today. These machines commonly run Microsoft Windows, though they can run other operating systems as well, including Linux, OpenBSD, NetBSD, and FreeBSD.
[edit] Software platforms
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:
[edit] Java platform
As previously noted, the Java platform is an exception to the general rule that an operating system is a software platform. The Java language provides a virtual machine, or 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 which support the Java software, through the Java Virtual Machine. Java executables do not run directly on the operating system; that is, neither Windows nor Linux execute Java programs directly. Instead, a special computer program called the JVM, or Java Virtual Machine, is run by the operating system, which in turn runs the Java program.
Because of this, however, Java is limited in that it does not support system-specific functionality. Java programs can run on at least the Microsoft Windows, Linux, and Solaris operating systems, and so the language is limited to functionality that exists on all three systems. This includes things such as computer networking, Internet sockets, but not necessarily raw hardware input/output.
[edit] Cross-platform software
In order for software to be considered cross-platform, it must be able to function on more than one computer architecture or operating system. This can be a time-consuming task given that different operating systems have different application programming interfaces or APIs (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 is OpenOffice.org, which does not yet natively run on the AMD64 or EM64T lines of processors implementing the x64 64-bit standards for computers[1]. 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. One solution that exists for C++ programmers to write cross-platform application software is to use the wxWidgets library, which runs on a number of different operating systems, helping to remove operating system or computer architecture specific dependencies.
[edit] Web applications
Web applications are typically considered to be cross-platform because the user of the web application can, in theory, use any web browser to access web applications. Basic web applications perform the actual processing on the web server, and pass the result to the web browser for display to the user. Data is exchanged in a cycle of user interaction, processing, and user interaction, making the responsibility of the web browser simple: To send and receive data. In the earlier days of computing on the World Wide Web, these types of applications were very common. Today, they are still relatively common, and are still in wide use due to their ability to be more cross-platform than others.
Recently, more advanced web applications such as the WWW interface to Gmail and other Ajax enabled web applications have been developed. These applications make use of additional features found in some of the more recent web browsers, such as Firefox and MSIE. These features include JavaScript, “Dynamic” HTML, and of course Ajax technologies. These types of technologies limit the browsers that a user is able to utilize with such web applications; for example, a user attempting to use Konqueror with Gmail may notice that Gmail switches to “Basic Mode,” with reduced functionality. While these types of applications are still cross-platform, they are not as cross-platform as their non-Ajax enabled counterparts.
[edit] “Standard” applications
While web applications are becoming more and more popular, many computer users still use traditional application software which installs on the computer itself. This can in itself be a somewhat confusing topic, however, because there are different types of application software that can be installed on any given operating system.
[edit] Binary software
Traditionally throughout the history of computing, application software has been distributed to end-users as binary images, which are stored in executables, a specific type of binary file. Such executables only support the operating system and computer architecture that they were built for—which means that making a “cross-platform executable” would be something of a massive task, and is generally not done.
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. For example, Mozilla Firefox, an open-source web browser, is available on Microsoft Windows, Mac OS X (both PowerPC and x86 through something Apple calls a Universal binary), and Linux (x86). The three platforms (in this case, Windows, OS X, and Linux) are separate executable distributions, although they come from the same source code.
In the context of binary software, cross-platform programs are written in the source code and then “translated” to each system that it runs on through compiling it on different platforms. Also, software can be ported to a new computer architecture or operating system so that the program becomes more cross-platform than it already is. Specifically, it is not possible to take a program such as Firefox built for Linux on the x86 and run it directly on Windows on the x86; but it is possible to rebuild it to work on Windows on the x86.
[edit] Scripts and interpreted languages
A script can be considered to be cross-platform if the scripting language is cross-platform 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. The same goes for many of the open source programming languages that are available and are scripting languages.
Unlike binary executables, 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.
- Python—A modern scripting language where the focus is on rapid application development and ease-of-writing, instead of necessarily program run-time efficiency.
- 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 on the WWW for web applications.
[edit] Video games
Cross-platform is a term that can also apply to video games. Such games are released on a range of video game consoles and handheld game consoles, which are specialized computers dedicated to the task of playing games (and thus, are a platform as any other computer). Examples of these games include:
… which are spread across a variety of platforms, such as the Nintendo GameCube, PlayStation 2, and the Xbox.
In some cases, depending on the hardware of a particular system it may take longer than expected to create a video game across multiple platforms. So, a video game may only get released on a few platforms and then later released on the remaining platforms. Typically, this is what occurs when a new system is released, because the developers of the video game need to become acquainted with the hardware and software associated with the new console.
Some games may not become cross-platform because of licensing agreements between the developers and the maker of the video game console which state that the game will only be made for one particular console. As an example, Disney could create a new game and wish to release it on the latest Nintendo and Sony game consoles. If Disney licenses the game with Sony first, Disney may be required to only release the game on Sony’s console for a short time, or indefinitely—effectively prohibiting the game from cross-platform at least for a period of time.
[edit] Platform independent software
Software that is platform independent does not rely on any special features of any single platform, or, if it does, handles those special features such that it can deal with multiple platforms. Many algorithms, such as the quicksort algorithm, are able to be implemented on different platforms.
[edit] Porting software
Computer software that runs on a subset of all available computer architectures or operating systems can be altered to work on new architectures or operating systems through a process called porting. For example, as of August, 2006, work is underway to port the OpenOffice.org software application to a 64-bit architecture[2].
[edit] Cross-platform programming
Cross-platform programming is the practice of actively writing software that will work on more than one platform.
[edit] 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 would have one set of source code files and the Macintosh version could 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. The idea behind this is to create two different programs that look and act similar 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.
Some applications mix various methods of cross-platform programming to create the final application. An example of this is the Firefox web browser, which uses abstraction to build some of the lower-level components, and the implementation of more than one scripting language to help facilitate ease of portability. Firefox implements XUL, CSS and JavaScript for extending the browser, in addition to classic Netscape-style browser plugins. Much of the browser itself is written in XUL, CSS and JavaScript, as well.
[edit] Cross-platform programming tools
There are a number of tools which are available to help facilitate the process of cross-platform programming:
- Simple DirectMedia Layer--An opensource cross-platform multimedia library written in C that creates an abstraction over various platforms' graphics, sound, and input APIs...
- wxWidgets—An open source widget toolkit that is also an application framework. 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.
- Qt—An open source widget toolkit and application framework which runs on Unix-like systems and Microsoft Windows.
- GTK+—An open source widget toolkit for Unix-like systems and Microsoft Windows.
- FLTK—Another open source cross platform toolkit, but more light weight because it restricts itself to the GUI.
- Runtime_Revolution - A proprietary IDE, compiler engine and CGI builder that cross-compiles to Windows, MacOS X (PPC, Intel), Linux, Solaris, BSD, Irix.
[edit] Criticisms of cross-platform development
There are certain issues associated with cross-platform development. The most important of these include:
- Cross-platform techniques may increase application development time, especially for developers who are unaccustomed to using them. Developers who are trained to write software using platform-dependent APIs, such as the Microsoft Windows API, may have to be retrained to use a completely new set of platform-independent APIs. This increased development time may not always justifiable, especially when the application's target audience has overwhemlingly adopted a single platform.
- Testing cross-platform applications may also 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", an ironic take on Sun's “Write Once, Run Anywhere” marketing slogan.
- Developers are often restricted to using the 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 windows and dialogs, 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.
- Scripting languages and virtual machines must be translated into native executable code each time the application is executed, imposing a performance penalty. This performance hit can be alleviated using advanced techniques like just-in-time compilation; but even using such techniques, some performance overhead may be unavoidable.
[edit] See also
- Virtual OS
- Java Platform
- Compiled language
- Scripting language
- Interpreted language
- Perl, PHP, Python, JavaScript, XUL, ECMAScript—some interpreted/scripting languages commonly used in cross-platform application software
- wxWidgets, Qt, GTK+, FLTK—some common cross-platform widget toolkits
- Firefox—an open source, cross-platform web browser
- OpenOffice.org—an open source, cross-platform productivity suite
- Blender —an open source, cross-platform 3D graphics suite
- Linux, NetBSD, OpenBSD, FreeBSD—open-source, cross-platform operating systemsast:Multiplataforma
ca:Multiplataforma cs:Multiplatformní software da:Platformsuafhængighed de:Plattformunabhängigkeit es:Multiplataforma eo:Multesistema eu:Plataforma-anitz fr:Multi-plate-forme it:Multipiattaforma hu:Platformfüggetlenség nl:Multiplatform ja:クロスプラットフォーム pt:Multiplataforma ru:Кроссплатформенное программное обеспечение fi:Alustariippumattomuus sv:Multiplattform zh:跨平台

