Tagged articles
13 articles
Page 1 of 1
Top Architect
Top Architect
Oct 10, 2024 · Backend Development

Avoiding Excessive Null Checks in Java: Using Assertions, Exceptions, and the Null Object Pattern

This article explains why overusing null‑check statements in Java leads to verbose code, distinguishes cases where null is a valid response versus an error, and offers practical techniques such as assertions, throwing exceptions, returning empty collections, and applying the Null Object pattern to write cleaner backend code.

Backend DevelopmentExceptionsJava
0 likes · 9 min read
Avoiding Excessive Null Checks in Java: Using Assertions, Exceptions, and the Null Object Pattern
Java Architect Essentials
Java Architect Essentials
Oct 8, 2021 · Fundamentals

How to Avoid Excessive Null Checks in Java: Best Practices and the Null Object Pattern

This article explains why excessive null‑checking in Java code is problematic, distinguishes when null is a valid response versus an error, and offers practical techniques such as using assertions, throwing exceptions, returning empty collections, and applying the Null Object pattern to write cleaner, safer code.

JavaNull Object patternassertions
0 likes · 7 min read
How to Avoid Excessive Null Checks in Java: Best Practices and the Null Object Pattern
21CTO
21CTO
Oct 8, 2021 · Backend Development

How to Eliminate Null Checks in Java: Use Null Object Pattern and Best Practices

This article explains why excessive null‑checking clutters Java code, distinguishes valid versus invalid null returns, and shows how to replace them with assert statements, exceptions, empty collections, or the Null Object pattern to write cleaner, more reliable backend code.

AssertJavaNull Object pattern
0 likes · 6 min read
How to Eliminate Null Checks in Java: Use Null Object Pattern and Best Practices
Top Architect
Top Architect
Jul 4, 2021 · Fundamentals

Avoiding Null Checks in Java: Assertions, Exceptions, and the Null Object Pattern

This article explains how to distinguish between valid and invalid null returns in Java, recommends using assertions or exceptions for erroneous nulls, suggests returning empty collections or objects, and demonstrates the Null Object pattern with code examples to eliminate repetitive null‑pointer checks.

Exception HandlingJavaNull Object pattern
0 likes · 6 min read
Avoiding Null Checks in Java: Assertions, Exceptions, and the Null Object Pattern
macrozheng
macrozheng
Apr 22, 2021 · Backend Development

How to Eliminate Redundant Null Checks in Java with the Null Object Pattern

This article explains why excessive null‑checking code appears in Java projects, distinguishes valid versus error null values, and offers practical techniques—including asserts, exceptions, empty collections, and the Null Object pattern—to write cleaner, safer backend code.

JavaNull Object patternbest practices
0 likes · 6 min read
How to Eliminate Redundant Null Checks in Java with the Null Object Pattern
Selected Java Interview Questions
Selected Java Interview Questions
Apr 14, 2021 · Backend Development

Avoiding Null Checks in Java: When to Use Assertions, Exceptions, and the Null Object Pattern

This article explains why excessive null‑checking in Java code is problematic, distinguishes valid versus invalid null returns, and presents better alternatives such as assertions, throwing exceptions, returning empty collections or objects, and applying the Null Object pattern with concrete code examples.

Exception HandlingJavaNull Object pattern
0 likes · 6 min read
Avoiding Null Checks in Java: When to Use Assertions, Exceptions, and the Null Object Pattern
Top Architect
Top Architect
Apr 12, 2021 · Backend Development

Avoiding Null Checks in Java: When to Use Assertions, Exceptions, and the Null Object Pattern

The article explains why excessive null‑checking in Java code is problematic, distinguishes between null as a valid response and as an error, and offers practical techniques such as assertions, throwing exceptions, returning empty collections, and applying the Null Object pattern to write cleaner, safer backend code.

JavaNull Object patternnull check
0 likes · 7 min read
Avoiding Null Checks in Java: When to Use Assertions, Exceptions, and the Null Object Pattern
Programmer DD
Programmer DD
Dec 7, 2019 · Fundamentals

Eliminate NullPointerExceptions with the Null Object Pattern and Optional

This article explains why excessive null‑checks cause a "null‑check disaster", introduces the Null Object design pattern and Java 8 Optional as clean alternatives, and showcases the NR Null Object IntelliJ plugin that can generate null‑object scaffolding automatically.

IntelliJ PluginJavaKotlin
0 likes · 10 min read
Eliminate NullPointerExceptions with the Null Object Pattern and Optional