Write once, compile anywhere

Last updated

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.

Contents

Introduction

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

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:

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

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

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

Related Research Articles

<span class="mw-page-title-main">Assembly language</span> Low-level programming language

In computer programming, assembly language, often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence between the instructions in the language and the architecture's machine code instructions. Assembly language usually has one statement per machine instruction (1:1), but constants, comments, assembler directives, symbolic labels of, e.g., memory locations, registers, and macros are generally also supported.

<span class="mw-page-title-main">BASIC</span> Family of programming languages

BASIC is a family of general-purpose, high-level programming languages designed for ease of use. The original version was created by John G. Kemeny and Thomas E. Kurtz at Dartmouth College in 1963. They wanted to enable students in non-scientific fields to use computers. At the time, nearly all computers required writing custom software, which only scientists and mathematicians tended to learn.

Computer programming or coding is the composition of sequences of instructions, called programs, that computers can follow to perform tasks. It involves designing and implementing algorithms, step-by-step specifications of procedures, by writing code in one or more programming languages. Programmers typically use high-level programming languages that are more easily intelligible to humans than machine code, which is directly executed by the central processing unit. Proficient programming usually requires expertise in several different subjects, including knowledge of the application domain, details of programming languages and generic code libraries, specialized algorithms, and formal logic.

<span class="mw-page-title-main">Computer program</span> Instructions a computer can execute

A computer program is a sequence or set of instructions in a programming language for a computer to execute. It is one component of software, which also includes documentation and other intangible components.

<span class="mw-page-title-main">COBOL</span> Programming language with English-like syntax

COBOL is a compiled English-like computer programming language designed for business use. It is an imperative, procedural, and, since 2002, object-oriented language. COBOL is primarily used in business, finance, and administrative systems for companies and governments. COBOL is still widely used in applications deployed on mainframe computers, such as large-scale batch and transaction processing jobs. Many large financial institutions were developing new systems in the language as late as 2006, but most programming in COBOL today is purely to maintain existing applications. Programs are being moved to new platforms, rewritten in modern languages, or replaced with other software.

<span class="mw-page-title-main">Fortran</span> General-purpose programming language

Fortran is a third generation, compiled, imperative programming language that is especially suited to numeric computation and scientific computing.

<span class="mw-page-title-main">Programming language</span> Language for communicating instructions to a machine

A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their syntax (form) and semantics (meaning), usually defined by a formal language. Languages usually provide features such as a type system, variables, and mechanisms for error handling. An implementation of a programming language is required in order to execute programs, namely an interpreter or a compiler. An interpreter directly executes the source code, while a compiler produces an executable program.

PL/I is a procedural, imperative computer programming language initially developed by IBM. It is designed for scientific, engineering, business and system programming. It has been in continuous use by academic, commercial and industrial organizations since it was introduced in the 1960s.

Pascal is an imperative and procedural programming language, designed by Niklaus Wirth as a small, efficient language intended to encourage good programming practices using structured programming and data structuring. It is named after French mathematician, philosopher and physicist Blaise Pascal.

Turbo Pascal is a software development system that includes a compiler and an integrated development environment (IDE) for the programming language Pascal running on the operating systems CP/M, CP/M-86, and MS-DOS. It was originally developed by Anders Hejlsberg at Borland, and was notable for its very fast compiling. Turbo Pascal, and the later but similar Turbo C, made Borland a leader in PC-based development tools.

The Business Operating System, or BOS, was initially developed as an early cross-platform operating system, originally for Intel 8080 and Motorola 6800 microprocessors and then for actual businesses and business models. The technology was used in Zilog Z80-based computers and later for most microcomputers of the 1980s. The system was developed by CAP Ltd, a British company that later became one of the world's largest information technology consulting firms. BOS and BOS applications were designed to be platform-independent.

<span class="mw-page-title-main">Pointer (computer programming)</span> Object which stores memory addresses in a computer program

In computer science, a pointer is an object in many programming languages that stores a memory address. This can be that of another value located in computer memory, or in some cases, that of memory-mapped computer hardware. A pointer references a location in memory, and obtaining the value stored at that location is known as dereferencing the pointer. As an analogy, a page number in a book's index could be considered a pointer to the corresponding page; dereferencing such a pointer would be done by flipping to the page with the given page number and reading the text found on that page. The actual format and content of a pointer variable is dependent on the underlying computer architecture.

In computer science, automatic programming is a type of computer programming in which some mechanism generates a computer program to allow human programmers to write the code at a higher abstraction level.

<span class="mw-page-title-main">PRIMOS</span> Operating System

PRIMOS is a discontinued operating system developed during the 1970s by Prime Computer for its minicomputer systems. It rapidly gained popularity and by the mid-1980s was a serious contender as a mainline minicomputer operating system.

Programmable calculators are calculators that can automatically carry out a sequence of operations under control of a stored program. Most are Turing complete, and, as such, are theoretically general-purpose computers. However, their user interfaces and programming environments are specifically tailored to make performing small-scale numerical computations convenient, rather than general-purpose use.

<span class="mw-page-title-main">BASICODE</span>

BASICODE was a computer project intended to create a unified standard for the BASIC programming language. BASIC was available on many popular home computers, but there were countless variants that were mostly incompatible with each other. The project was initiated in 1980 by Hobbyscoop, a radio program of the Dutch broadcasting organisation Nederlandse Omroep Stichting (NOS).

<span class="mw-page-title-main">Scripting language</span> Programming language designed for scripting

In computing, a script is a relatively short and simple set of instructions that typically automate an otherwise manual process. The act of writing a script is called scripting. Scripting language or script language describes a programming language that is used for scripting.

In computer programming, a function is a callable unit of software logic that has a well-defined interface and behavior and can be invoked multiple times.

A third-generation programming language (3GL) is a high-level computer programming language that tends to be more machine-independent and programmer-friendly than the machine code of the first-generation and assembly languages of the second-generation, while having a less specific focus to the fourth and fifth generations. Examples of common and historical third-generation programming languages are ALGOL, BASIC, C, COBOL, Fortran, Java, and Pascal.