General-purpose programming language

Last updated

In computer software, a general-purpose programming language (GPL) is a programming language for building software in a wide variety of application domains. Conversely, a domain-specific programming language (DSL) is used within a specific area. For example, Python is a GPL, while SQL is a DSL for querying relational databases.

Contents

History

Early programming languages were designed for scientific computing (numerical calculations) or commercial data processing, as was computer hardware. Scientific languages such as Fortran and Algol supported floating-point calculations and multidimensional arrays, while business languages such as COBOL supported fixed-field file formats and data records. Much less widely used were specialized languages such as IPL-V and LISP for symbolic list processing; COMIT for string manipulation; APT for numerically controlled machines. Systems programming requiring pointer manipulation was typically done in assembly language, though JOVIAL was used for some military applications. [1]

IBM's System/360, announced in 1964, was designed as a unified hardware architecture supporting both scientific and commercial applications, and IBM developed PL/I for it as a single, general-purpose language that supported scientific, commercial, and systems programming. Indeed, a subset of PL/I was used as the standard systems programming language for the Multics operating system.

Since PL/I, the distinction between scientific and commercial programming languages has diminished, with most languages supporting the basic features required by both, and much of the special file format handling delegated to specialized database management systems.

Many specialized languages were also developed starting in the 1960s: GPSS and Simula for discrete event simulation; MAD, BASIC, Logo, and Pascal for teaching programming; C for systems programming; JOSS and APL\360 for interactive programming. [1]

GPL vs. DSL

The distinction between general-purpose programming languages and domain-specific programming languages is not always clear. [2] A programming language may be created for a specific task, but used beyond that original domain and thus be considered a general purpose programming language.  For example, COBOL, Fortran, and Lisp were created as DSLs (for business processing, numeric computation, and symbolic processing), but became GPL's over time.[ dubious discuss ] Inversely, a language may be designed for general use but only applied in a specific area in practice. [3] A programming language that is well suited for a problem, whether it be general-purpose language or DSL, should minimize the level of detail required while still being expressive enough in the problem domain. [4] As the name suggests, general-purpose language is "general" in that it cannot provide support for domain-specific notation while DSLs can be designed in diverse problem domains to handle this problem. [4] General-purpose languages are preferred to DSLs when an application domain is not well understood enough to warrant its own language. In this case, a general-purpose language with an appropriate library of data types and functions for the domain may be used instead. [5] While DSLs are usually smaller than GPL in that they offer a smaller range of notations of abstractions, some DSLs actually contain an entire GPL as a sublanguage. In these instances, the DSLs are able to offer domain-specific expressive power along with the expressive power of GPL. [6]

General Purpose programming languages are all Turing complete, meaning that they can theoretically solve any computational problem. Domain-specific languages are often similarly Turing complete but are not exclusively so.

Advantages and disadvantages

General-purpose programming languages are more commonly used by programmers. According to a study, C, Python, and Java were the most commonly used programming languages in 2021. [7]  One argument in favor of using general-purpose programming languages over domain-specific languages is that more people will be familiar with these languages, overcoming the need to learn a new language.

Additionally, for many tasks (e.g., statistical analysis, machine learning, etc.) there are libraries that are extensively tested and optimized. Theoretically, the presence of these libraries should bridge the gap between general-purpose and domain-specific languages. [4]

An empirical study in 2010 sought to measure problem-solving and productivity between GPLs and DSLs by giving users problems who were familiar with the GPL (C#) and unfamiliar with the DSL (XAML). Ultimately, users of this specific domain-specific language performed better by a factor of 15%, even though they were more familiar with GPL, warranting further research. [4]


Examples

C

The predecessor to C, B, was developed largely for a specific purpose: systems programming. [8] By contrast, C has found use in a variety of computational domains, such as operating systems, device drivers, application software, and embedded systems.

C is suitable for use in a variety of areas because of its generality. It provides economy of expression, flow control, data structures, and a rich set of operators, but does not constrain its users to use it in any one context. [9] As a result, though it was first used by its creators to rewrite the kernel of the Unix operating system, [10] it was easily adapted for use in application development, embedded systems (e.g., microprocessor programming), video games (e.g., Doom), and so on. Today, C remains one of the most popular and widely-used programming languages. [11]

C++

Conceived as an extension to C, C++ introduced object-oriented features, as well as other conveniences like references, operator overloading, and default arguments. Like C, C++'s generality allowed it to be used in a wide range of areas. While its C++'s core area of application is in systems programming (because of C++'s ability to grant access to low-level architecture), [12] it has been used extensively to build desktop applications, video games, databases, financial systems, and much more. [13] Major software and finance companies, such as Microsoft, Apple, Bloomberg, and Morgan Stanley, still widely use C++ in their internal and external applications. [13]

Python

Python was conceived as a language that emphasized code readability and extensibility. [14] [15] The former allowed non-software engineers to easily learn and write computer programs, while the latter allowed domain specialists to easily create libraries suited to their own use cases. For these reasons, Python has been used across a wide range of domains.

Below are some of the areas where Python is used: [16]

List

The following are some general-purpose programming languages:

See also

Related Research Articles

In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that map values to other values, rather than a sequence of imperative statements which update the running state of the program.

In computer science, the abstract syntax of data is its structure described as a data type, independent of any particular representation or encoding. This is particularly used in the representation of text in computer languages, which are generally stored in a tree structure as an abstract syntax tree. Abstract syntax, which only consists of the structure of data, is contrasted with concrete syntax, which also includes information about the representation. For example, concrete syntax includes features like parentheses or commas, which are not included in the abstract syntax, as they are implicit in the structure.

A programming paradigm is a relatively high-level way to structure and conceptualize the implementation of a computer program. A programming language can be classified as supporting one or more paradigms.

Metaprogramming is a computer programming technique in which computer programs have the ability to treat other programs as their data. It means that a program can be designed to read, generate, analyse, or transform other programs, and even modify itself, while running. In some cases, this allows programmers to minimize the number of lines of code to express a solution, in turn reducing development time. It also allows programs more flexibility to efficiently handle new situations with no recompiling.

A system programming language is a programming language used for system programming; such languages are designed for writing system software, which usually requires different development approaches when compared with application software. Edsger Dijkstra referred to these languages as machine oriented high order languages, or mohol.

Axiom is a free, general-purpose computer algebra system. It consists of an interpreter environment, a compiler and a library, which defines a strongly typed hierarchy.

A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains. There are a wide variety of DSLs, ranging from widely used languages for common domains, such as HTML for web pages, down to languages used by only one or a few pieces of software, such as MUSH soft code. DSLs can be further subdivided by the kind of language, and include domain-specific markup languages, domain-specific modeling languages, and domain-specific programming languages. Special-purpose computer languages have always existed in the computer age, but the term "domain-specific language" has become more popular due to the rise of domain-specific modeling. Simpler DSLs, particularly ones used by a single application, are sometimes informally called mini-languages.

Language-oriented programming (LOP) is a software-development paradigm where "language" is a software building block with the same status as objects, modules and components, and rather than solving problems in general-purpose programming languages, the programmer creates one or more domain-specific languages (DSLs) for the problem first, and solves the problem in those languages. Language-oriented programming was first described in detail in Martin Ward's 1994 paper Language Oriented Programming.

In software engineering, profiling is a form of dynamic program analysis that measures, for example, the space (memory) or time complexity of a program, the usage of particular instructions, or the frequency and duration of function calls. Most commonly, profiling information serves to aid program optimization, and more specifically, performance engineering.

Intentional Software was a software company that designed tools and platforms that followed the principles of intentional programming in which programmers focus on capturing the intent of users and designers, and spend as little time as possible interacting with machines and compilers. Its tools included language workbenches, tools that separated software function from implementation, and allowed 'language-focused' development. This allowed automatic rewriting of code as expert knowledge of implementation options changed. The company later began developing a platform for improving productivity of software groups.

<span class="mw-page-title-main">Incremental computing</span> Software feature

Incremental computing, also known as incremental computation, is a software feature which, whenever a piece of data changes, attempts to save time by only recomputing those outputs which depend on the changed data. When incremental computing is successful, it can be significantly faster than computing new outputs naively. For example, a spreadsheet software package might use incremental computation in its recalculation features, to update only those cells containing formulas which depend on the changed cells.

In engineering, debugging is the process of finding the root cause of and workarounds and possible fixes for bugs.

Gradual typing is a type system in which some variables and expressions may be given types and the correctness of the typing is checked at compile time and some expressions may be left untyped and eventual type errors are reported at runtime. Gradual typing allows software developers to choose either type paradigm as appropriate, from within a single language. In many cases gradual typing is added to an existing dynamic language, creating a derived language allowing but not requiring static typing to be used. In some cases a language uses gradual typing from the start.

A general-purpose language is a computer language that is broadly applicable across application domains, and lacks specialized features for a particular domain. This is in contrast to a domain-specific language (DSL), which is specialized to a particular application domain. The line is not always sharp, as a language may have specialized features for a particular domain but be applicable more broadly, or conversely may in principle be capable of broad application but in practice used primarily for a specific domain.

A language workbench is a tool or set of tools that enables software development in the language-oriented programming software development paradigm. A language workbench will typically include tools to support the definition, reuse and composition of domain-specific languages together with their integrated development environment. Language workbenches were introduced and popularized by Martin Fowler in 2005.

Multitier programming is a programming paradigm for distributed software, which typically follows a multitier architecture, physically separating different functional aspects of the software into different tiers. Multitier programming allows functionalities that span multiple of such tiers to be developed in a single compilation unit using a single programming language. Without multitier programming, tiers are developed using different languages, e.g., JavaScript for the Web client, PHP for the Web server and SQL for the database. Multitier programming is often integrated into general-purpose languages by extending them with support for distribution.

Servant is a web framework based on the programming language Haskell, with an emphasis on data type safety. It is free and open-source software released under a BSD 3-clause license.

References

  1. 1 2 Jean E. Sammet, "Programming Languages: History and Future", Communications of the ACM15:7:601-610 (July 1972) doi : 10.1145/361454.361485
  2. van Deursen, Arie; Klint, Paul; Visser, Joost (2000). "Domain-Specific Languages: An Annotated Bibliography". ACM SIGPLAN Notices. 35 (6): 26–36. CiteSeerX   10.1.1.33.8207 . doi:10.1145/352029.352035.
  3. Berry, Gerard (May 2006). "Real time programming: special purpose or general purpose languages". HAL Open Science.
  4. 1 2 3 4 Kosar, Tomaz (May 2010). "Comparing General-Purpose and Domain-Specific Languages: An Empirical Study" (PDF). Computer Science and Information Systems. 7 (2): 247–264. doi:10.2298/CSIS1002247K.
  5. van Deursen, Arie (December 1998). "Little languages: little maintenance?". Journal of Software Maintenance: Research and Practice. 10 (2): 75–92. doi:10.1002/(SICI)1096-908X(199803/04)10:2<75::AID-SMR168>3.0.CO;2-5.
  6. van Deursen, Arie; Klint, Paul; Visser, Joost (June 2000). "Domain-specific languages: an annotated bibliography". ACM SIGPLAN Notices. 35 (6): 26–36. doi: 10.1145/352029.352035 . ISSN   0362-1340. S2CID   1049872.
  7. "The Most Popular Programming Languages - 1965/2021 - New Update - Statistics and Data". statisticsanddata.org. Retrieved 2022-06-03.
  8. Thompson, K. (1972-01-07). "Cover sheet for technical memorandum" (PDF). Bell Telephone Laboratories. Archived (PDF) from the original on 2015-06-11. Retrieved 2022-06-03.
  9. W., Kernighan, Brian (2016). The C programming language. Prentice Hall. ISBN   978-0-13-110370-2. OCLC   1004153413.{{cite book}}: CS1 maint: multiple names: authors list (link)
  10. Ritchie, Dennis (April 1993). "The development of the C language" (PDF). ACM SIGPLAN Notices. 28 (3): 201–208. doi:10.1145/155360.155580.
  11. "TIOBE Index". TIOBE. Retrieved 2022-06-03.
  12. Stroustrup, Bjarne (1995). The C++ Programming Language. Addison-Wesley.
  13. 1 2 "C++ Applications". www.stroustrup.com. Retrieved 2022-06-03.
  14. "artima - The Making of Python". www.artima.com. Retrieved 2022-06-03.
  15. "General Python FAQ — Python 3.10.4 documentation". docs.python.org. Retrieved 2022-06-03.
  16. "Applications for Python". Python.org. Retrieved 2022-06-03.
  17. "Programming Languages Popularity in 12,086 Research Papers – Quantifying Health" . Retrieved 2022-06-03.
  18. Pedregosa, Fabian (2011). "Scikit-learn: Machine learning in Python" (PDF). The Journal of Machine Learning Research. 12: 2825–2830. arXiv: 1201.0490 . Bibcode:2011JMLR...12.2825P.