A-Z Popular Blog Coding Search »
Related Guides
Software Design

IT Artifact



Why Null Is Useful

 , June 10, 2018
Null is the representation of nothingness, the abyss or undefined objects in computing. This is a pervasive feature in the design of programming languages, databases, operating systems and computing platforms.

Examples of Null

The following are common examples of how null is used in computing.
Null ValueA null value indicates that a variable or field has not been set. For example, in a database of guest responses to wedding invitations, a value of null might indicate the guest did not respond.
Null PointerA null pointer indicates an object has not been created. For example, if you query a database and there are no results, a null pointer may be returned to indicate an empty result set.
Nullable Type A datatype in a programming language that can be set to null. A datatype that is not nullable can be tricky because there may be no universal way to flag that the variable has not been initialized.
Null CharacterA character of text that represents nothing such that it is not displayed. This may be used to delimit strings with a non-printing character.
Null StringA string that has not been initialized. This often has a different meaning from the empty string, or "". For example, a voice recognition app could use empty string to indicate that the user didn't say anything and null to indicate that the microphone could not be accessed.
Null DeviceA null device such as /dev/null on linux is a way to send something into the abyss. For example, if you don't want to print errors on to your screen or into a file you can simply redirect them to /dev/null and they will disappear.
Null RouteA null route is a network route for the abyss. This is a way to discard a message for purposes such as information security.
Null Pointer ExceptionAn error that occurs if code tries to use an object that hasn't been initialized. For example, a connection to a database that hasn't been established.

Why Null is Unpopular

Null is a special case that often requires handling in code. If you try to perform an operation on a object that hasn't been created, it may throw a null pointer exception. As a special case, null requires a lot of attention from programmers. When errors occur, they are often null related such as a null pointer exception. This leads may software developers, administrators and users to view null as an annoyance.

Why Null is Useful

Null is an essential part of the semantics and functionality of a computing environment. Null values make it explicitly clear that something hasn't been created or initialized in a way that can't be ignored. A computing platform can be designed to always create things with defaults, leaving no possibility of null. However, this is error prone as you end up using default values and objects thinking that they are meaningful when they aren't.

Example #1

Null pointer exceptions are meaningful as they tell you that something hasn't been initialized and code failed to handle this. In an environment with default values in place of nulls, errors tend to be more difficult to detect and trace. They can also have more business impact. For example, a banking website that initializes your balance to 0 when it can't connect to a backend system may make customers nervous if not angry. This is the type of error that surfaces without the elegant feature of null that explicitly tells you a value hasn't been set. In our banking example, a null could be handled to tell the customer their balance isn't currently available. If the null weren't handled, resulting in a null pointer exception, an error page might be shown. This is generally better than telling a customer their balance is 0 when it isn't.

Example #2

A null device on an operating system is a way to send data to nowhere. One of the advantages of a digital environment as opposed to the physical world is that garbage can instantly disappear without a trace. A null device is an elegant way to achieve this.
Overview: Null
DefinitionA representation of nothingness, the abyss or undefined objects in computing environments.
Related Concepts


This is the complete list of articles we have written about coding.
Code Refactoring
Code Smell
Complexity Hiding
Deep Magic
Edge Case
Event Processing
Forward Compatibility
IT Artifact
IT Examples
Negative Code
Proof Of Work
Software Design
More ...
If you enjoyed this page, please consider bookmarking Simplicable.


A complete overview of localhost with an example.

Animated Gif

Everything you ever wanted to know about animated GIFs but were afraid to ask.

Software vs Hardware

The difference between software and hardware with examples.

Cached Data

The definition of cached data with examples. Includes an explanation of why cached data can usually be deleted safely.


The definition of network node with examples.


The definition of delete with examples.


The common types of modern computer.

Keep Alive

A complete overview of keep alive with examples and diagrams.

Application Server

An overview of application server with examples.


A list of coding considerations and techniques.

Negative Code

An overview of negative code.


The definition of synchronous with examples.

Division By Zero

A complete overview of division by zero and why it has no meaning.

Linux Processes

The basic types of linux process.


A quick reference of useful ls commands.

Linux Commands

A list of unusually useful linux commands with brief explanations.

Runtime Error

The definition of runtime error with examples.
The most popular articles on Simplicable in the past day.

New Articles

Recent posts or updates on Simplicable.
Site Map