ArticleslgStudy

science

Standard library

Standard library is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Standard library rather than just read about it. In short: In computer programming, a standard library is the library made available across implementations of a programming language. Often, a standard library is specified by its associated programming language specification, however, some are set in part or whole by more informal practices of a language community.

Key takeaways

  • Standard library belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Standard library to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Standard library from memory before moving on to harder problems.

Reference excerpt

In computer programming, a standard library is the library made available across implementations of a programming language. Often, a standard library is specified by its associated programming language specification, however, some are set in part or whole by more informal practices of a language community. Some languages define a core part of the standard library that must be made available in all implementations while allowing other parts to be implemented optionally. In many languages, the standard library often has its own namespace. For example, C++, D, and Rust use std::* as the standard library namespace. C# uses System.*, while Java uses java.*, javax.* and jdk.*. However, in some like Python and Go, there is no "standard library namespace" or common prefix for modules belonging to the standard library. As defined with the core language aspects, the line between the core language and its standard library is relatively subtle. A programmer may confuse the two aspects even though the language designers intentionally separate the two. The line between the core language and its standard library is further blurred in some languages by defining core language constructs in terms of its standard library. For example, Java defines a string literal as an instance of the java.lang.String class. Smalltalk defines an anonymous function expression (a "block") as an instance of its library's BlockContext class. Scheme does not specify which portions must be implemented as core language vs. standard library.

Contents Depending on the constructs available in the core language, a standard library may include:

Subroutines Macro definitions Global variables Class definitions Templates Commonly provided functionality includes:

Algorithms, such as sorting algorithms Data structures, such as the list, tree, and hash table Interaction with external systems (input/output) Interaction with the host operating system

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. 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. As a result, the C standard library and C++ Standard Library are significantly smaller in size and scope compared to, for instance, the Java standard library and C# standard library, which feature more extensive abilities. 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. 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. 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, left relegated to third-party libraries, of which some popular providers are Boost or POCO. In Java, the formerly standard libraries Java Platform, Enterprise Edition (now Jakarta EE) and JavaFX were moved to separate independent libraries.

Examples

C standard library C++ Standard Library .NET Framework Class Library (FCL) Java Class Library (JCL) Rust standard library Factor standard library Ruby standard library Python standard library Common Language Infrastructure (CLI) standard libraries

References

Worked examples

Example 1 — a first encounter with Standard library

Start with the simplest possible case. Write down what Standard library claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Standard library before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Standard library ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Standard library

In research
Standard library appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Standard library in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Standard library is common in secondary-school and first-year university syllabi. It links to neighbouring topics Programming language standards, Programming libraries, so understanding it makes those chapters shorter.
In everyday life
Look for Standard library outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Standard library” →

How to study Standard library in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Standard library means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Standard library out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Standard library in simple terms?

In computer programming, a standard library is the library made available across implementations of a programming language. Often, a standard library is specified by its associated programming language specification, however, some are set in part or whole by more informal practices of a language co…

Why does Standard library matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Standard library?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Standard library.

Tags

  • Programming language standards
  • Programming libraries

Keep exploring