Skip to main content

Questions tagged [null]

Null is the absence of a value. Null is typically used to indicate that a reference or pointer variable points to no object in memory.

8 votes
7 answers
5k views

We have entities with numeric properties, they are of boxed types (e.g. Integer). Typically, each of those properties has a pair of getters: getInt(), which returns zero on null values, and ...
Sergey Zolotarev's user avatar
3 votes
5 answers
1k views

I work with a lot of Groovy code. One feature of the language is the "safe navigation operator" (?), which I think of as an inline null check. There are many things about Groovy that I like, ...
Gus Murphy's user avatar
2 votes
1 answer
246 views

With the introduction of JEP 358 in Java 14, which provides more informative NullPointerException (NPE) messages, is it advisable to remove existing explicit null checks in cases where the null-check ...
ftb457932's user avatar
3 votes
4 answers
4k views

Some fields may be optional. That is, a value doesn't have to be ever assigned to it. Luckily, Java has a special null-safer type for optional values — Optional However, if I try to make a field of ...
Sergey Zolotarev's user avatar
0 votes
2 answers
128 views

I am practicing tactical DDD and having trouble as exemplified below. Fundamentally, whether some fields of the value object should be nullable depends on another field of the same value object. ...
STHA's user avatar
  • 71
-7 votes
1 answer
159 views

Since we all know that few couple days ago there was a global outage (BSOD) because of the CrowdStrike updated which caused that global outage and the reason behind that was just an ...
procrastinator1771's user avatar
5 votes
5 answers
1k views

I've set up a ternary operator in place of a pile of if-else's, the final expression being nullptr in order to finish the loop, like so: int menuSelect; std::string operation=""; (...
Hench's user avatar
  • 61
0 votes
3 answers
200 views

Semantically, C++ std::optional, Rust Option<T>, and other optional/nullable types represent a value that can be present or absent: you have to handle both cases, or you can opt-in to crash. Is ...
JJW's user avatar
  • 9
1 vote
4 answers
3k views

When retreiving data with an api and saving it in a DTO, some values are nullable: null on initial class initialization but VS also warns you for this. For example, an employee: public class ...
Jannick Breunis's user avatar
16 votes
10 answers
5k views

I was looking at an SQL query recently and found what I think is likely a bug. It was related to case statements on inequalities. I was trying to replace it with a min/max type alternate and when ...
JimmyJames's user avatar
  • 31.1k
4 votes
3 answers
1k views

I was reading the excellent book by Axel Raushmayer, Tackling TypeScript. In this section of Chapter 7, the author makes the interesting claim In many programming languages, null is part of all ...
Ray Toal's user avatar
  • 1,335
20 votes
8 answers
9k views

Let's consider the following test. [Fact] public void MyTest() { // Arrange Code var sut = new SystemWeTest(); // Act Code var response = sut.Request(); // Assert ...
BAmadeusJ's user avatar
  • 326
2 votes
4 answers
742 views

I am working on implementing some stock order types for a financial technology application. There are six different types of stock orders - market, limit, stop_loss, stop_loss_limit, trailing_stop, ...
Treker's user avatar
  • 197
2 votes
3 answers
234 views

Suppose that we have a SQL relational database for, let's say, asset management system. It uses a table of assets (1 row per one real-world object). There can be various metadata etc. To allow the ...
jiwopene's user avatar
  • 191
47 votes
8 answers
30k views

I've recenlty been greeted by CS8603 - Possible null reference return, which indicates that my code could possibly return null. It's a simple function that looks up an entity in a database by id - if ...
MechMK1's user avatar
  • 669

15 30 50 per page
1
2 3 4 5
9