Jump to content

Write once, compile anywhere

From Wikipedia, the free encyclopedia

Write once, compile anywhere (WOCA) is a philosophy taken by a compiler and its associated software libraries or by a software library/software framework which refers to a capability of writing a computer program that can be compiled on all platforms without the need to modify its source code. As opposed to Sun's write once, run anywhere slogan, cross-platform compatibility is implemented only at the source code level, rather than also at the compiled binary code level.

Introduction

[edit]

There are many languages that follow the WOCA philosophy, such as C++, Pascal (see Free Pascal), Ada, Cobol, or C, on condition that they don't use functions beyond those provided by the standard library. Languages like Go go even further in as far that no system specific things are used, it should just work, and for system-specific elements a system of platform-specific files is used. A computer program may also use cross-platform libraries, which provide an abstraction layer hiding the differences between various platforms, for things like sockets and GUI, ensuring the portability of the written source code. This is, for example, supported by Qt (C++) or the Lazarus (Pascal) IDE via its LCL and corresponding widgetsets.

Today, we have very powerful desktop computers as well as computers in our phones, which often have sophisticated applications such as word processing, Database management, and spreadsheets, that can allow people with no programming experience to, sort, extract, and manipulate their data. and create documents (such as PDF files) showing their now organized information, or printing it out. Before 2000, some of these were not available, and prior to 1980, almost none of them were.

From the start of computer automation in the early 1960s, if you wanted a report from data you had, or needed to print up invoices, payroll checks, purchase orders, and other paperwork businesses, schools and governments generated, you typed them up on a physical typewriter, possibly using pre-printed forms. Otherwise, if you did have information stored in a computer, and wanted it sorted, manipulated, or printed, it required someone to write a program to do so. In some cases, the person needed information that professional programmers either could not understand how to provide a program to do what they wanted; the available programmers could not produce something in a reasonable amount of time; or there weren't any programmers they could use, caused some non-programming professionals to learn some programming skills, at least to know how to manipulate and print out information they needed from their data.

Whether the work was done by a professional programmer, or an end-user writing a program to provide them information for their own use, the means to do this in either case is the same. Write a program, submit it to a compiler (another program that converts written programs into instructions the computer can understand), fix any errors, then repeat until the program worked.

While this helped fix part of the problem, it created a new one. People who wrote programs, or hired someone to write them (purchasing software was not a thing until the 1970s or 1980s), discovered when their employer or school bought a new computer, their programs no longer worked.

Development of high-level programming languages

[edit]

To combat these problems, various high-level languages were developed that were usable for general purpose application program development, but could be used to provide reports and information for people with specialized requirements.

These include:

  • BASIC, a simplified programming language which could be used to build "real world" complex applications, as well as simple programs to solve a problem, and was very accessible for amateur programmers. Its ease of use made BASIC well suited as an introductory computer programming class in many colleges.
  • C, a general-purpose programming language often suitable for writing programs which would otherwise require assembly language.
  • Cobol, a general-purpose programming language which tended to be used for developing business applications.
  • Fortran, a general-purpose programming language which is well suited for scientific and engineering problems.
  • Pascal, a general-purpose programming language, which tended to be targeted toward use in schools as an introductory class to teach programming as an alternative to BASIC. Pascal became commonly used for hobbyist programmers in the 1970s and 1980s due to them being part of an integrated development environment allowing a person to edit, compile, and run their programs, providing immediate results. Programs such as UCSD Pascal and Turbo Pascal opened up the world of programming to millions of people,
  • RPG, a domain-specific programming language designed to take the contents of data files, manipulate data and do calculations, then produce printed reports, similar to the way a person can use a spreadsheet to organize data and create PDF files today.

While compilers and interpreters of all of these languages, and dozens of others, were available for different machines and different vendors, often each manufacturer would develop proprietary enhancements which made programing on that machine easier, but again, made programs difficult to port (move the program to a different type of computer or a different vendor's computers), and increased vendor lock in. Something had to change.

Standardization

[edit]

Starting in the late 1960s and early 1970s, efforts came into play to create standards and specifications of how machine-independent programs could be written using compilers from any vendor. Standards-making organizations, like the International Standards Organization (ISO), and ANSI, among others, in cooperation with large users of computers and software (like governments, financial institutions and manufacturers), and computer manufacturers, to create standardized specifications to provide a description of how each specific language should be implemented.

Computer manufacturers could still have their own proprietary extensions to a programming language, but if they wanted to be able to claim compliance with the standard, they had to specify the differences in the reference manual, so that a program written according to the standard able to compile and operate on their machine would also operate, without further change, on a different manufacturer's computer whose compiler also followed the standard. The requirements of the standard were enforced by large software buyers, such as military, government, and manufacturing companies, by refusing to buy such computing equipment if the vendor only offered a compiler for the programming languages they used which wasn't compliant with the standard,

Results

[edit]

Currently, there are more than a dozen programming languages that have standards describing how programs in the language are supposed to be written, including Ada, APL, BASIC, C++, COBOL, ECMAScript (the generic name for JavaScript), Forth, FORTRAN, Pascal, PL/I, Ruby and SQL. Many of these are still in use, in some cases, because customers were able to take their source code to a different manufacturer's computer, where it was recompiled, often without change, because of the standardization of programming languages.

While the standards helped, the WOCA philosophy works only when the makers of compilers ensure that they follow the standard.

See also

[edit]