Tag

defensive programming

0 views collected around this technical thread.

JD Tech
JD Tech
Oct 9, 2024 · Fundamentals

Defensive Programming: Concepts, Core Principles, and Practical Java Examples

This article explains defensive programming as a proactive coding paradigm that anticipates and mitigates errors through input validation, error handling, assertions, and continuous testing, and demonstrates its application with detailed Java examples covering pagination, loop safety, exception management, and boundary checks.

Javadefensive programmingerror handling
0 likes · 15 min read
Defensive Programming: Concepts, Core Principles, and Practical Java Examples
JD Tech Talk
JD Tech Talk
Jul 26, 2024 · Fundamentals

Defensive Programming: Concepts, Core Principles, and Practical Cases

This article introduces defensive programming, explains its fundamental concepts and core principles such as risk identification and input validation, and demonstrates practical applications through multiple Java code examples covering pagination, loop prevention, exception handling, boundary checks, and assertions to improve software robustness.

Javabest practicescode quality
0 likes · 13 min read
Defensive Programming: Concepts, Core Principles, and Practical Cases
IT Services Circle
IT Services Circle
Jul 14, 2024 · Backend Development

Understanding MyBatis Dynamic SQL, OOM Incidents, and the Importance of Backend Parameter Validation

This article explains MyBatis dynamic SQL, recounts a first‑hand OOM incident caused by missing backend validation, and shares practical lessons on parameter checking, balancing reusable versus specialized interfaces, and adopting defensive programming to build more reliable backend systems.

Backend ValidationDynamic SQLMyBatis
0 likes · 11 min read
Understanding MyBatis Dynamic SQL, OOM Incidents, and the Importance of Backend Parameter Validation
Architecture Digest
Architecture Digest
Jun 23, 2024 · Backend Development

Debugging and Preventing NullPointerException in Java Backend Data Processing

This article presents a real-world Java backend case where null pointer exceptions arise during data matching and batch insertion, analyzes the root causes in each code line, and offers defensive programming, ternary, Optional, collection checks, and utility methods to safely handle null values.

BackendJavaOptional
0 likes · 5 min read
Debugging and Preventing NullPointerException in Java Backend Data Processing
Top Architect
Top Architect
Jun 20, 2024 · Backend Development

When and How to Use Null Checks in Java: Best Practices and Alternatives

This article discusses the proper use of null‑checking in Java, distinguishes between valid and invalid null returns, proposes alternatives such as returning empty collections, using assertions or throwing exceptions, and demonstrates the Null Object pattern with concrete code examples while also noting related community resources.

JavaNull Objectbackend development
0 likes · 9 min read
When and How to Use Null Checks in Java: Best Practices and Alternatives
macrozheng
macrozheng
Dec 24, 2023 · Fundamentals

Master Defensive Programming: Unconventional Naming Tricks & OOP Hacks

This article revisits defensive programming, explores quirky variable‑naming techniques—including single‑character, Chinese, and multilingual identifiers—and humorously breaks down core OOP concepts while stressing the developer’s irreplaceable role in modern software projects.

JavaOOPdefensive programming
0 likes · 7 min read
Master Defensive Programming: Unconventional Naming Tricks & OOP Hacks
Tencent Cloud Developer
Tencent Cloud Developer
May 15, 2023 · Operations

Taking Over and Stabilizing a Complex Legacy System: Tencent's Practical Experience

Tencent’s team successfully took over a 93‑service legacy content architecture, stabilizing it by building comprehensive monitoring, creating detailed code walkthrough documentation, fixing critical bugs, and streamlining R&D processes, which cut daily alerts from 159 to zero, reduced business incidents, and lowered on‑call staffing dramatically.

CI/CDDatabase Optimizationalert-governance
0 likes · 24 min read
Taking Over and Stabilizing a Complex Legacy System: Tencent's Practical Experience
Java Captain
Java Captain
Sep 27, 2022 · Backend Development

Understanding and Preventing NullPointerException in Java Backend Development

This article presents a real-world Java backend case where a newly hired developer caused a NullPointerException during data matching and batch insertion, analyzes each line of the problematic code, and offers defensive programming techniques such as null checks, Optional, and utility methods to avoid NPEs.

JavaOptionalbackend development
0 likes · 5 min read
Understanding and Preventing NullPointerException in Java Backend Development
Cognitive Technology Team
Cognitive Technology Team
Jul 2, 2022 · Fundamentals

Defensive Programming Principles and Practices

The article outlines defensive programming concepts, emphasizing input validation, error handling, resource management, isolation techniques, and design considerations such as thread safety, cache strategies, and interface versioning to build robust and resilient software systems.

defensive programmingerror handlinginput validation
0 likes · 4 min read
Defensive Programming Principles and Practices
Youku Technology
Youku Technology
Jul 17, 2020 · Backend Development

Defensive Programming, Exception Handling, and DRY Principle in Java

The article explains how defensive programming in Java—using guard clauses, validators, and side‑effect‑free assertions—prevents errors, outlines proper exception handling by distinguishing checked from unchecked exceptions, and reinforces the DRY principle, urging developers to abstract repeated logic after three occurrences.

DRY principleException HandlingJava
0 likes · 18 min read
Defensive Programming, Exception Handling, and DRY Principle in Java
Qunar Tech Salon
Qunar Tech Salon
Nov 13, 2015 · Backend Development

Top 10 Useful Yet Paranoid Java Programming Techniques

After two decades of coding, the author shares ten defensive, often‑considered paranoid Java programming practices—such as placing constants on the left side of equals, guarding against NullPointerExceptions, treating -1 as a valid index, using final for methods, variables, and parameters, and handling switch statements—to promote more robust code.

BackendJavaParanoid Coding
0 likes · 7 min read
Top 10 Useful Yet Paranoid Java Programming Techniques
Qunar Tech Salon
Qunar Tech Salon
Jan 16, 2015 · Fundamentals

Best Practices for Null‑Safe Programming in Java

To avoid NullPointerException in Java, use string literals with equals, prefer String.valueOf over toString, employ null‑safe libraries like Apache Commons StringUtils, return empty collections instead of null, annotate with @NotNull/@Nullable, prevent unnecessary autoboxing, define sensible defaults, and use Jackson's path method for safe JSON navigation.

Apache CommonsJacksonJava
0 likes · 5 min read
Best Practices for Null‑Safe Programming in Java