Standard library

Last updated

In computer programming, a standard library is the library made available across implementations of a programming language. These libraries are conventionally described in programming language specifications; however, contents of a language's associated library may also be determined (in part or whole) by more informal practices of a language's community.

Contents

Overview

A language's standard library is often treated as part of the language by its users, although the designers may have treated it as a separate entity. Many language specifications define a core set that must be made available in all implementations, in addition to other portions which may be optionally implemented. The line between a language and its libraries therefore differs from language to language. Indeed, some languages are designed so that the meanings of certain syntactic constructs cannot even be described without referring to the core library. For example, in Java, a string literal is defined as an instance of the java.lang.String class; similarly, in Smalltalk, an anonymous function expression (a "block") constructs an instance of the library's BlockContext class. Conversely, Scheme contains multiple coherent subsets that suffice to construct the rest of the language as library macros, and so the language designers do not even bother to say which portions of the language must be implemented as language constructs, and which must be implemented as parts of a library.

Contents

Standard libraries typically include definitions for commonly used algorithms, data structures, and mechanisms for input and output. Depending on the constructs made available by the host language, a standard library may include:

Most standard libraries include definitions for at least the following commonly used facilities:

Philosophies

Philosophies of standard library design vary widely. For example, Bjarne Stroustrup, designer of C++, writes:

What ought to be in the standard C++ library? One ideal is for a programmer to be able to find every interesting, significant, and reasonably general class, function, template, etc., in a library. However, the question here is not, "What ought to be in some library?" but "What ought to be in the standard library?" The answer "Everything!" is a reasonable first approximation to an answer to the former question but not the latter. A standard library is something every implementer must supply so that every programmer can rely on it. [1]

This suggests a relatively small standard library, containing only the constructs that "every programmer" might reasonably require when building a large collection of software. This is the philosophy that is used in the C and C++ standard libraries.

By contrast, Guido van Rossum, designer of Python, has embraced a much more inclusive vision of the standard library. Python attempts to offer an easy-to-code, object-oriented, high-level language.[ citation needed ] In the Python tutorial, he writes:

Python has a "batteries included" philosophy. This is best seen through the sophisticated and robust capabilities of its larger packages. [2]

Van Rossum goes on to list libraries for processing XML, XML-RPC, email messages, and localization, facilities that the C++ standard library omits. This other philosophy is often found in scripting languages (as in Python or Ruby) or languages that use a virtual machine, such as Java or the .NET Framework languages. In C++, such facilities are not part of the standard library, but instead are included in other libraries, such as Boost.

Examples of standard libraries

Related Research Articles

Multiple inheritance is a feature of some object-oriented computer programming languages in which an object or class can inherit features from more than one parent object or parent class. It is distinct from single inheritance, where an object or class may only inherit from one particular object or class.

In computer programming, operator overloading, sometimes termed operator ad hoc polymorphism, is a specific case of polymorphism, where different operators have different implementations depending on their arguments. Operator overloading is generally defined by a programming language, a programmer, or both.

<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.

In computing, serialization is the process of translating a data structure or object state into a format that can be stored or transmitted and reconstructed later. When the resulting series of bits is reread according to the serialization format, it can be used to create a semantically identical clone of the original object. For many complex objects, such as those that make extensive use of references, this process is not straightforward. Serialization of object-oriented objects does not include any of their associated methods with which they were previously linked.

Yacc is a computer program for the Unix operating system developed by Stephen C. Johnson. It is a lookahead left-to-right rightmost derivation (LALR) parser generator, generating a LALR parser based on a formal grammar, written in a notation similar to Backus–Naur form (BNF). Yacc is supplied as a standard utility on BSD and AT&T Unix. GNU-based Linux distributions include Bison, a forward-compatible Yacc replacement.

In a computer language, a reserved word is a word that cannot be used as an identifier, such as the name of a variable, function, or label – it is "reserved from use". This is a syntactic definition, and a reserved word may have no user-defined meaning.

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

C++ is a high-level, general-purpose programming language created by Danish computer scientist Bjarne Stroustrup. First released in 1985 as an extension of the C programming language, it has since expanded significantly over time; as of 1997, C++ has object-oriented, generic, and functional features, in addition to facilities for low-level memory manipulation for making things like microcomputers or to make operating systems like Linux or Windows. It is almost always implemented as a compiled language, and many vendors provide C++ compilers, including the Free Software Foundation, LLVM, Microsoft, Intel, Embarcadero, Oracle, and IBM.

Generic programming is a style of computer programming in which algorithms are written in terms of data types to-be-specified-later that are then instantiated when needed for specific types provided as parameters. This approach, pioneered by the ML programming language in 1973, permits writing common functions or types that differ only in the set of types on which they operate when used, thus reducing duplicate code.

In computer science, primitive data types are a set of basic data types from which all other data types are constructed. Specifically it often refers to the limited set of data representations in use by a particular processor, which all compiled programs must use. Most processors support a similar set of primitive data types, although the specific representations vary. More generally, "primitive data types" may refer to the standard data types built into a programming language. Data types which are not primitive are referred to as derived or composite.

Resource acquisition is initialization (RAII) is a programming idiom used in several object-oriented, statically typed programming languages to describe a particular language behavior. In RAII, holding a resource is a class invariant, and is tied to object lifetime. Resource allocation is done during object creation, by the constructor, while resource deallocation (release) is done during object destruction, by the destructor. In other words, resource acquisition must succeed for initialization to succeed. Thus the resource is guaranteed to be held between when initialization finishes and finalization starts, and to be held only when the object is alive. Thus if there are no object leaks, there are no resource leaks.

<span class="mw-page-title-main">History of programming languages</span> History of languages used to program computers

The history of programming languages spans from documentation of early mechanical computers to modern tools for software development. Early programming languages were highly specialized, relying on mathematical notation and similarly obscure syntax. Throughout the 20th century, research in compiler theory led to the creation of high-level programming languages, which use a more accessible syntax to communicate instructions.

In computer science and object-oriented programming, a passive data structure (PDS), also termed a plain old data structure or plain old data (POD), is a record, in contrast with objects. It is a data structure that is represented only as passive collections of field values, without using object-oriented features.

The C++ programming language has support for string handling, mostly implemented in its standard library. The language standard specifies several string types, some inherited from C, some designed to make use of the language's features, such as classes and RAII. The most-used of these is std::string.

In generic programming, a concept is a description of supported operations on a type, including syntax and semantics. In this way, concepts are related to abstract types but concepts do not require a subtype relationship.

ACCU, previously known as the Association of C and C++ Users, is a non-profit user group of people interested in software development, dedicated to raising the standard of computer programming. The ACCU publishes two journals and organizes an annual conference.

ZK is an open-source Ajax Web application framework, written in Java, that enables creation of graphical user interfaces for Web applications with little required programming knowledge.

The Dr. Dobb's Excellence in Programming Award was an annual prize given to individuals who, in the opinion of the editors of Dr. Dobb's Journal, "made significant contributions to the advancement of software development." The Excellence in Programming Award includes a $1,000 prize that was donated in the award winner's name to a charity of the winner's choice. The award was launched in 1995 in the print edition of Dr. Dobb's Journal and was given each year until 2009. In his March 1995 article introducing the awards, then editor-in-chief Jonathan Erickson wrote that the award was intended to recognize "achievement and excellence in the field of computer programming." Erickson explained that the winners were "selected by a special editorial committee" of the magazine. Because Dr. Dobb's serves an audience of software developers, the Excellence in Programming Award is specifically intended to recognize resources for programmers: languages, code libraries, tutorial books, and so on. Developers of shrinkwrap software intended for retail sale, custom software for corporate use, embedded software, or general-purpose applications were not considered for the award.

The following outline is provided as an overview of and topical guide to C++:

In computer programming, several language mechanisms exist for exception handling. The term exception is typically used to denote a data structure storing information about an exceptional condition. One mechanism to transfer control, or raise an exception, is known as a throw; the exception is said to be thrown. Execution is transferred to a catch.

References

  1. Bjarne Stroustrup. The C++ Programming Language. 3rd Ed. Addison-Wesley, 1997
  2. Guido van Rossum. .